What's the command to set the system to standby mode after a specific time?

With a Internet search, I found Hibernation in Fedora Workstation - Fedora Magazine however, I suppose hibernation and standby mode are not the same.

What’s the command to set the system to standby mode e.g. in 10 minutes?

sleep 10m && systemctl suspend

3 Likes

Is ‘suspend’ mode the same as standby mode?

Yes, very similar. Usually called suspend in Linux.
This link may help understand it. (Note: it was written for Ubuntu but holds pretty true for any linux install that uses systemd.)
suspend

1 Like

Hibernate and Standby Mode (whereby according to this website ‘In Ubuntu, Standby mode is not a separate mode’) were explained understandably but it remains unclear why the commands for Sleep and Suspend Mode are the same although the modes themselves are not the same (‘However, it’s worth noting that Suspend mode typically uses less power than Sleep mode.’).

If you do not want to use a command and prefer the UI in Gnome : Settings > Power will take you to what you are looking for. here are some screenshots. I’m on a Laptop, but a desktop has slightly different features.


On a Desktop, The instructions would be to Suspend the session ( turning off your monitor, locking the screen and going into Suspend mode ) after a period of inactivity.

1 Like

On my system in Settings->Power, the prerequisite to set the system to in german ‘Bereitschaft’ is inativity what shouldn’t be the case with sleep 10m && systemctl suspend.

@grumpey @kc1di @hamrheadcorvette


When it says in german ‘Bereitschaft’ which mode (Sleep, Suspend, Standby or Hibernate Mode) is enabled there?

Which mode (Sleep, Suspend, Standby or Hibernate Mode) is set with sleep 10m && systemctl suspend?

Bereitschaft

Please execute the command in the command-line and then check what it stored in your config.

p.s.

.po file for translation:
Source: Module Translation: gnome-control-center

# Ich glaube hier können (beliebig viele) Schlagworte frei gewählt werden
#. Translators: Search terms to find the Power panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
#: panels/power/gnome-power-panel.desktop.in:15
msgid ""
"Power;Sleep;Suspend;Hibernate;Battery;Brightness;Dim;Blank;Monitor;DPMS;Idle;"
"Energy;"
msgstr ""
"Energie;Schlafmodus;Bereitschaft;Ruhezustand;Akku;Helligkeit;Abdunkeln;"
"Abschalten;Bildschirm;DPMS;Energie;Einschaltknopf;"

Is there Suspend Mode enabled?

How do I do this?

That should execute suspend after waiting 10 minutes.
Which should be determined by: cat /sys/power/mem_sleep

https://www.kernel.org/doc/Documentation/power/states.txt

If you’re trying to set the system to suspend, sleep etc after 10 minutes of idle time you should do it through the gnome control center as pointed out by other folks in this thread.

1 Like

Does this refer to

?

Is the system set to Suspend, Sleep, Hibernate or Standby Mode if in Settings app>Energy the option with ‘Bereitschaft’ (see above screensthot) is turned on?

yes, that will wait 10 minutes and execute suspend

Based on the translation that was posted that should be suspend.
From a terminal, can you provide the results of cat /sys/power/mem_sleep

That should tell you what kind of suspend it is going to be based on the kernel power states documentation previously posted.

The output of cat /sys/power/mem_sleep is s2idle [deep].

There’s no exact match with one of the System Power Management Sleep States on https://www.kernel.org/doc/Documentation/power/states.txt.

The 2 states that come into consideration are:

  • State: Suspend-To-Idle
    ACPI state: S0
    Label: “s2idle” (“freeze”)
  • State: Suspend-to-RAM
    ACPI State: S3
    Label: “deep

Which state is the system set to if in Settings app>Energy the option with ‘Bereitschaft’ is turned on and what’s the command that’s executed in the background to set the system to the corresponding state?

Deep, suspend to ram is what is used.

The “s2idle” mode is always available, while the other ones are only available
if supported by the platform (if not supported, the strings representing them
are not present in /sys/power/mem_sleep). The string representing the suspend
mode to be used subsequently is enclosed in square brackets

1 Like

What’s the command that’s executed in the background when Settings>Energy>‘Bereitschaft’ option sets the system to ‘Deep, suspend to ram’?

Something similar to:
dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true

You can watch the dbus calls with:
sudo dbus-monitor --system "interface=org.freedesktop.login1.Manager"

Do you have something in particular you are trying to accomplish?

Because the command only says Suspend without specifying one of the System Power Management Sleep States on https://www.kernel.org/doc/Documentation/power/states.txt, does the command set the system to ‘Deep, suspend to ram’ because it reads the /sys/power/state file, the string of which is “mem” which is controlled by the /sys/power/mem_sleep file, the mode of which [deep] is enclosed in square brackets representing the suspend mode to be used subsequently?

Is sleep a command to get a countdown and does systemctl suspend also read the /sys/power/state file and so on?

At the beginning I only had the question in the title of this discussion but then one answer led to the next question e.g. which Sleep States or modes exist, at all, what are the commands to execute them, does sleep 10m && systemctl suspend set the system to a different Sleep State than Settings>Energy>‘Bereitschaft’ option does… There’s nothing special that I want to do.

Gnome (or any of the DE that use systemd-logind) or systemctl suspend → systemd-logind → systemd → systemd-sleep → linux kernel

/etc/systemd/sleep.conf,
default values: SuspendState=mem standby freeze

SuspendState=

The string to be written to /sys/power/state by systemd-suspend.service(8). More than one value can be specified by separating multiple values with whitespace. They will be tried in turn, until one is written without error. If none of the writes succeed, the operation will be aborted.

The allowed set of values is determined by the kernel and is shown in the file itself (use cat /sys/power/state to display).

ref: systemd-sleep.conf

Writing mem to /sys/power/state activates the suspend mode enclosed in brackets in /sys/power/mem_sleep


If there are other modes available in /sys/power/state … ie …
cat /sys/power/state
freeze mem

You can also do echo -n freeze | sudo tee /sys/power/state to put in an s2idle state.

You can temporarily change the mem_sleep values by:
echo -n s2idle | sudo tee /sys/power/mem_sleep
I believe they can be permanently changed by utilizing the mem_sleep_default=“mode” kernel parameter, but I’ve never had to do that.

Is sleep a command to get a countdown

yes

does sleep 10m && systemctl suspend set the system to a different Sleep State than Settings>Energy>‘Bereitschaft’ option does
[/quote]

No it should not.

2 Likes

In my email notification of your post it says:

does sleep 10m && systemctl suspend set the system to a different Sleep State than Settings>Energy>‘Bereitschaft’ option does
[/quote]

No it should not.

yes

Can you clarify the attitional ‘yes’ or in other words, does sleep 10m && systemctl suspend set the system to a different Sleep State than Settings>Energy>‘Bereitschaft’ option does or not?