Hibernation resume fails for systemd based initramfs on luks2+btrfs+swapfile
Created by: GaKu999
Summary:
An attempt at resume after hibernation fails for a swapfile in a btrfs filesystem under luks2, all preparations where done beforehand and the current setup works in the busybox based initramfs. An initramfs made with dracut was also successful.
Steps to reproduce
Following the wiki:
- Have the system on a btrfs filesystem under luks2
- https://wiki.archlinux.org/title/Btrfs#Swap_file
- https://wiki.archlinux.org/title/Swap_file#Swap_file_creation
- https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file_on_Btrfs
- Once swap is working, bootloader entry for a mkinitcpio's systemd initramfs with the relevant resume and resume_offset
- Test hibernation and boot the respective entry
If the replication was successful it will not resume at all and instead boot normally.
Relevant part of the journal for mkinitcpio, if useful, of a boot with prior hibernation
...
Oct 09 09:51:21 midgard systemd[1]: Found device /dev/mapper/luks-19608893-78b4-4238-a26d-0b37d8628c3e.
Oct 09 09:51:21 midgard systemd[1]: Finished Cryptography Setup for luks-19608893-78b4-4238-a26d-0b37d8628c3e.
Oct 09 09:51:21 midgard audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-cryptsetup@luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/init" hostname=? addr=? terminal=? res=success'
Oct 09 09:51:21 midgard systemd[1]: Reached target Local Encrypted Volumes.
Oct 09 09:51:21 midgard systemd[1]: Reached target Initrd Root Device.
Oct 09 09:51:21 midgard systemd[1]: Mounting /sysroot...
Oct 09 09:51:21 midgard systemd[1]: Starting Resume from hibernation using device /dev/mapper/luks-19608893-78b4-4238-a26d-0b37d8628c3e...
Oct 09 09:51:21 midgard systemd-hibernate-resume[306]: Could not resume from '/dev/mapper/luks-19608893-78b4-4238-a26d-0b37d8628c3e' (254:0).
Oct 09 09:51:21 midgard systemd[1]: systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.service: Deactivated successfully.
Oct 09 09:51:21 midgard systemd[1]: Finished Resume from hibernation using device /dev/mapper/luks-19608893-78b4-4238-a26d-0b37d8628c3e.
Oct 09 09:51:21 midgard kernel: PM: Image not found (code -16)
Oct 09 09:51:21 midgard audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/init" hostname=? addr=? terminal=? res=success'
Oct 09 09:51:21 midgard audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/init" hostname=? addr=? terminal=? res=success'
...
Relevant part of the journal for dracut, if useful, of a boot without prior hibernation
...
Oct 09 09:37:52 midgard systemd[1]: Found device dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.device.
Oct 09 09:37:52 midgard systemd[1]: Finished systemd-cryptsetup@luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.service.
Oct 09 09:37:52 midgard audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-cryptsetup@luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Oct 09 09:37:52 midgard systemd[1]: Reached target cryptsetup.target.
Oct 09 09:37:52 midgard systemd[1]: Reached target initrd-root-device.target.
Oct 09 09:37:52 midgard audit: BPF prog-id=42 op=LOAD
Oct 09 09:37:52 midgard audit: BPF prog-id=43 op=LOAD
Oct 09 09:37:52 midgard systemd[1]: Starting systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.service...
Oct 09 09:37:52 midgard systemd[1]: Finished dracut-initqueue.service.
Oct 09 09:37:52 midgard audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=dracut-initqueue comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Oct 09 09:37:52 midgard systemd[1]: Reached target remote-fs-pre.target.
Oct 09 09:37:52 midgard systemd[1]: Reached target remote-cryptsetup.target.
Oct 09 09:37:52 midgard systemd[1]: Reached target remote-fs.target.
Oct 09 09:37:52 midgard systemd-hibernate-resume[563]: Could not resume from '/dev/mapper/luks-19608893-78b4-4238-a26d-0b37d8628c3e' (254:0).
Oct 09 09:37:52 midgard kernel: PM: Image not found (code -22)
Oct 09 09:37:52 midgard systemd[1]: dracut-pre-mount.service was skipped because all trigger condition checks failed.
Oct 09 09:37:52 midgard systemd[1]: systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.service: Deactivated successfully.
Oct 09 09:37:52 midgard systemd[1]: Finished systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e.service.
Oct 09 09:37:52 midgard audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Oct 09 09:37:52 midgard audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hibernate-resume@dev-mapper-luks\x2d19608893\x2d78b4\x2d4238\x2da26d\x2d0b37d8628c3e comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
...
Edited by nl6720