From the systemctl manpage:
suspend
Suspend the system. This will trigger activation of the special target unit suspend.target. This command is asynchronous, and will
return after the suspend operation is successfully enqueued. It will
not wait for the suspend/resume cycle to complete.
On my system the suspend.target
looks like this:
[Unit]
Description=Suspend
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=systemd-suspend.service
After=systemd-suspend.service
StopWhenUnneeded=yes
If I look at the man:systemd.special(7)
listed there I get find this:
suspend.target
A special target unit for suspending the system. This pulls in sleep.target.
If I dig more into systemd-suspend.service
I get:
systemd-suspend.service is a system service that is pulled in by
suspend.target and is responsible for the actual system suspend.…
Internally, this service will echo a string like "mem" into
/sys/power/state, to trigger the actual system suspend. What exactly
is written where can be configured in the "[Sleep]" section of
/etc/systemd/sleep.conf or a sleep.conf.d file.
The documentation on sleep.conf
tells me:
The default configuration is defined during compilation, so a
configuration file is only needed when it is necessary to deviate from
those defaults.
There is no sleep.conf
on my system so it must be using the compiled defaults. I can't figure out what those are.
What are the exact commands being sent to /sys/power/state
and friends by systemctl suspend
by default?
Best Answer
The defaults are
"mem", "standby", "freeze"
(the last two and the ability to configure sleep modes have been added in 2013 so they might not be available on older setups).The manual page you quoted describes how it's done, namely
systemd-suspend.service
writesFor more information about the sleep states and the
sysfs
interface that can be used by user space to control those states consult the official docs: System Sleep States