[systemd-devel] how to let systemd hibernate start/stop the swap area?

Lennart Poettering lennart at poettering.net
Wed Mar 29 14:36:31 UTC 2023


On Mi, 29.03.23 14:07, Christoph Anton Mitterer (calestyo at scientia.org) wrote:

> When I use 
>    systemd.log_level=debug systemd.log_target=console
> in the kernel parameters, and then do systemctl hibernate during the
> system I get:
> Mar 29 12:04:48 hbt systemd-logind[780]: Got message type=method_call sender=:1.9 destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=SetWallMessage cookie=2 reply_cookie=0 signature=sb error-name=n/a error-message=n/a
> Mar 29 12:04:48 hbt systemd-logind[780]: Sent message type=method_return sender=n/a destination=:1.9 path=n/a interface=n/a member=n/a cookie=61 reply_cookie=2 signature=n/a error-name=n/a error-message=n/a
> Mar 29 12:04:48 hbt systemd-logind[780]: Got message type=method_call sender=:1.9 destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=HibernateWithFlags cookie=3 reply_cookie=0 signature=t error-name=n/a error-message=n/a
> Mar 29 12:04:48 hbt systemd-logind[780]: Sleep mode "disk" is supported by the kernel.
> Mar 29 12:04:48 hbt systemd-logind[780]: Disk sleep mode "shutdown" is supported by the kernel.
> Mar 29 12:04:48 hbt systemd-logind[780]: No possible swap partitions or files suitable for hibernation were found in /proc/swaps.
> Mar 29 12:04:48 hbt systemd-logind[780]: Sent message type=error sender=n/a destination=:1.9 path=n/a interface=n/a member=n/a cookie=62 reply_cookie=3 signature=s error-name=org.freedesktop.login1.SleepVerbNotSupported error-message=Not enough swap space for hibernation
> Mar 29 12:04:48 hbt systemd-logind[780]: Failed to process message type=method_call sender=:1.9 destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=HibernateWithFlags cookie=3 reply_cookie=0 signature=t error-name=n/a error-message=n/a: Not enough swap space for hibernation
>
> Does that mean it's the same problem as with the desktop environment?
> I.e. systemdctl first asking logind whether hibernate was available,
> before even starting hibernate.target?

Yeah, all requests that go through logind check that.

You can override the check via an environment variable,
SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1 btw, see
https://systemd.io/ENVIRONMENT/

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list