dracut
dracut copied to clipboard
Dracut does not generate images that support hibernation
Describe the bug Images built with dracut do not allow for hibernation.
Distribution used EndeavourOS Linux
Dracut version dracut 060
Init system systemd
To Reproduce
- Build initramfs using dracut and reboot
- Run
systemctl hibernate
- The command fails with
Failed to find location to hibernate to: Invalid argument
Expected behavior The command should hibernate the system, and the state of the system should be restored from disk on boot.
Additional context
This was not an issue before I updated systemd to version 255. This issue is not present in images built with mkinitcpio
as they allow for hibernation. I ensured sure that the resume
module was included in the initramfs image using lsinitrd /boot/initramfs-linux.img -m | grep resume
Thanks @MikPisula .
Perhaps https://github.com/dracutdevs/dracut/pull/2560 and/or https://github.com/dracutdevs/dracut/pull/2527 and/or https://github.com/dracutdevs/dracut/pull/2494 .
Can you please include your log ?
Describe the bug Images built with dracut do not allow for hibernation. 2. Run
systemctl hibernate
3. The command fails with `Failed to find location to hibernate to: Invalid argument`
This error means that hibernation failed, not resume. IOW, this has nothing to do with dracut (or initrd in general). You might get more info about the reason for the failure by running SYSTEMD_LOG_LEVEL=debug systemctl hibernate
. My bet is that you have /sys/power/resume_offset
set but not /sys/power/resume
. This is not a new check, but it didn't cause a failure before v255. (It just printed a message at debug level, which was IMHO completely pointless, because just about nobody would have ever seen it).
This issue is not present in images built with
mkinitcpio
as they allow for hibernation.
I find this hard to believe.
Describe the bug Images built with dracut do not allow for hibernation. 2. Run
systemctl hibernate
3. The command fails with `Failed to find location to hibernate to: Invalid argument`
This error means that hibernation failed, not resume. IOW, this has nothing to do with dracut (or initrd in general). You might get more info about the reason for the failure by running
SYSTEMD_LOG_LEVEL=debug systemctl hibernate
. My bet is that you have/sys/power/resume_offset
set but not/sys/power/resume
. This is not a new check, but it didn't cause a failure before v255. (It just printed a message at debug level, which was IMHO completely pointless, because just about nobody would have ever seen it).This issue is not present in images built with
mkinitcpio
as they allow for hibernation.I find this hard to believe.
On the image built with mkinitpcio i can run systemctl hibernate
and the computer hibernates, and then resumes normally:
$ grep "kernel: PM:" mkinitcpio.log
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x00058000-0x00058fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x0009d000-0x000fffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x40000000-0x403fffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x75478000-0x75478fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x75479000-0x75479fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x78bf6000-0x78c86fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ede0000-0x7ff2cfff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff2d000-0x7ff99fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff9a000-0x7fffefff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x80000000-0x87ffffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x88000000-0x885fffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x88600000-0x8c7fffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0x8c800000-0xfe00ffff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe010000-0xfe010fff]
Dec 12 23:21:20 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe011000-0xffffffff]
Dec 12 23:21:20 kernel: PM: RTC time: 22:21:16, date: 2023-12-12
Dec 12 23:21:20 kernel: PM: Magic number: 3:98:401
Dec 12 23:21:20 kernel: PM: Image not found (code -22)
Dec 12 23:29:38 kernel: PM: suspend entry (deep)
Dec 12 23:29:49 kernel: PM: suspend exit
Dec 12 23:30:21 kernel: PM: hibernation: hibernation entry
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x00058000-0x00058fff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x0009d000-0x000fffff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x40000000-0x403fffff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x75478000-0x75479fff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x78bf6000-0x78c86fff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x7ede0000-0x7fffefff]
Dec 12 23:31:18 kernel: PM: hibernation: Marking nosave pages: [mem 0x80000000-0xffffffff]
Dec 12 23:31:18 kernel: PM: hibernation: Basic memory bitmaps created
Dec 12 23:31:18 kernel: PM: hibernation: Preallocating image memory
Dec 12 23:31:18 kernel: PM: hibernation: Allocated 765040 pages for snapshot
Dec 12 23:31:18 kernel: PM: hibernation: Allocated 3060160 kbytes in 2.48 seconds (1233.93 MB/s)
Dec 12 23:31:18 kernel: PM: hibernation: Creating image:
Dec 12 23:31:18 kernel: PM: hibernation: Need to copy 710734 pages
Dec 12 23:31:18 kernel: PM: hibernation: Normal pages needed: 710734 + 1024, available pages: 1324509
Dec 12 23:31:18 kernel: PM: hibernation: Basic memory bitmaps freed
Dec 12 23:31:18 kernel: PM: hibernation: hibernation exit
When I boot with an image built using dracut, systemctl hibernate
fails, so I tried hibernating manually using echo "disk" > /sys/power/state
, which did hibernate the system:
$ grep "kernel: PM:" dracut1.log
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x00058000-0x00058fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x0009d000-0x000fffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x40000000-0x403fffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x75478000-0x75478fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x75479000-0x75479fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x78bf6000-0x78c86fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ede0000-0x7ff2cfff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff2d000-0x7ff99fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff9a000-0x7fffefff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x80000000-0x87ffffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x88000000-0x885fffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x88600000-0x8c7fffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0x8c800000-0xfe00ffff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe010000-0xfe010fff]
Dec 12 23:32:52 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe011000-0xffffffff]
Dec 12 23:32:52 kernel: PM: RTC time: 22:32:52, date: 2023-12-12
Dec 12 23:32:52 kernel: PM: Magic number: 3:751:552
Dec 12 23:36:13 kernel: PM: hibernation: hibernation entry
but it does not resume correctly, and instead initiates a new boot:
$ grep "kernel: PM:" dracut2.log
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x00058000-0x00058fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x0009d000-0x000fffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x40000000-0x403fffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x75478000-0x75478fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x75479000-0x75479fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x79b69000-0x79bf9fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ede0000-0x7ff2cfff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff2d000-0x7ff99fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x7ff9a000-0x7fffefff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x80000000-0x87ffffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x88000000-0x885fffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x88600000-0x8c7fffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0x8c800000-0xfe00ffff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe010000-0xfe010fff]
Dec 12 23:36:57 kernel: PM: hibernation: Registered nosave memory: [mem 0xfe011000-0xffffffff]
Dec 12 23:36:57 kernel: PM: RTC time: 22:36:57, date: 2023-12-12
Dec 12 23:36:57 kernel: PM: Magic number: 3:854:653
Additionally, swapon recognises that the swapfile has suspend data, and rewrites its signature:
$ grep "swapon" dracut2.log
Dec 12 23:37:02 swapon[493]: swapon: /swap/swapfile: software suspend data detected. Rewriting the swap signature.
Here's the output of systemctl hibernate
on the dracut image:
$ sudo SYSTEMD_LOG_LEVEL=debug systemctl hibernate
Bus n/a: changing state UNSET → OPENING
sd-bus: starting bus by connecting to /run/dbus/system_bus_socket...
Bus n/a: changing state OPENING → AUTHENTICATING
Setting wall message "".
Bus n/a: changing state AUTHENTICATING → HELLO
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.DBus destination=:1.74 path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Bus n/a: changing state HELLO → RUNNING
Sent message type=method_call sender=n/a 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
Got message type=method_return sender=:1.3 destination=:1.74 path=n/a interface=n/a member=n/a cookie=151 reply_cookie=2 signature=n/a error-name=n/a error-message=n/a
Executing org.freedesktop.login1.Manager HibernateWithFlags dbus call.
Sent message type=method_call sender=n/a 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
Got message type=error sender=:1.3 destination=:1.74 path=n/a interface=n/a member=n/a cookie=152 reply_cookie=3 signature=s error-name=org.freedesktop.DBus.Error.InvalidArgs error-message=Invalid argument
Call to Hibernate failed: Invalid argument
Bus n/a: changing state UNSET → OPENING
sd-bus: starting bus by connecting to /run/systemd/private...
Bus n/a: changing state OPENING → AUTHENTICATING
Successfully forked off '(sd-askpwagent)' as PID 2526.
Executing dbus call org.freedesktop.systemd1.Manager StartUnit(hibernate.target, replace-irreversibly)
Bus n/a: changing state AUTHENTICATING → RUNNING
Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=StartUnit cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=3 reply_cookie=1 signature=o error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=GetUnit cookie=2 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=9 reply_cookie=2 signature=o error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/hibernate_2etarget interface=org.freedesktop.DBus.Properties member=Get cookie=3 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=20 reply_cookie=3 signature=v error-name=n/a error-message=n/a
Bus n/a: changing state RUNNING → CLOSED
Bus n/a: changing state RUNNING → CLOSED
It does seem that /sys/power/resume
is not set for the dracut image, but it is for the mkinitcpio image:
dracut:
$ cat /sys/power/resume && cat /sys/power/resume_offset
0:0
22996028
mkinitcpio:
$ cat /sys/power/resume && cat /sys/power/resume_offset
259:2
22996028
Thanks @MikPisula .
Perhaps #2560 and/or #2527 and/or #2494 .
Can you please include your log ?
After manually applying the fix in #2527, the issue seems to be resolved.
After manually applying the fix in #2527, the issue seems to be resolved.
Thanks for your feedback, I'd keep this open to avoid future duplicates.