[Bug 1219020] New: hibernation over luks encryted swap partition failed
https://bugzilla.suse.com/show_bug.cgi?id=1219020 Bug ID: 1219020 Summary: hibernation over luks encryted swap partition failed Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: screening-team-bugs@suse.de Reporter: werwolf131313@gmail.com QA Contact: qa-bugs@suse.de Target Milestone: --- Found By: --- Blocker: --- by this doc: https://en.opensuse.org/SDB:Encrypted_root_file_system#Additional_steps_when...
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-resume.conf add_device+=" UUID=ffb2ef5d-0757-49b6-987f-9166f4528318 " add_dracutmodules+=" resume "
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-luks-key.conf install_items+=" /etc/main.key "
[werwolf@workbook] ~ ❯ sudo cat /etc/crypttab | grep swap [sudo] пароль для root: cr_swap UUID=ffb2ef5d-0757-49b6-987f-9166f4528318 /etc/main.key key-slot=1,discard
[werwolf@workbook] ~ ❯ cat /etc/fstab | grep swap /dev/mapper/cr_swap swap swap discard 0 0
[werwolf@workbook] ~ ❯ free total used free shared buff/cache available Mem: 15128532 3875824 9142956 178356 2604596 11252708 Swap: 17761600 0 17761600
[werwolf@workbook] ~ ❯ cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-6.6.11-1-default root=UUID=eb54b167-a9a2-4641-8b74-b645cb0e4776 splash=silent resume=UUID=ffb2ef5d-0757-49b6-987f-9166f4528318 quiet security=apparmor mitigations=off delayacct
[werwolf@workbook] ~ ❯ sudo systemctl hibernate Call to Hibernate failed: Not enough swap space for hibernation
I remember that it worked before, it definitely worked on my previous laptop. Because of this problem, I temporarily had to abandon encrypted swap since I need hibernation. and this is unsafe. -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 Dmitry Markov <werwolf131313@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |werwolf131313@gmail.com -- You are receiving this mail because: You are on the CC list for the bug.
sudo systemctl edit systemd-logind.service next strings: [Service] Environment=SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1 but it didn't work for tumbleweed, I got another error: Failed to find location to hibernate to: Function not implemented and with debug next log in journalctl: янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: /dev/dm-1: is a candidate device. янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: No swap partitions or files matching resume config were found in /proc/swaps. янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Sent message type=method_return sender=n/a destination=:1.17 path=n/a interface=n/a member=n/a cookie=164 reply_cookie=42 signature=s error-name=n/a error-message=n/a янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Got message type=signal sender=:1.2 destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnitRemoved cookie=3229 reply_cookie=0 signature=so error-name=n/a error-message=n/a янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Got message type=method_call sender=:1.17 destination=org.freedesktop.login1 path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=CanHybridSleep cookie=43 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Failed to open configuration file '/etc/systemd/sleep.conf': Нет такого файла или каталога янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Sleep mode "disk" is supported by the kernel. янв 19 20:31:27 workbook.itrus.su systemd-logind[4908]: Disk sleep mode "platform" is supported by the kernel.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 https://bugzilla.suse.com/show_bug.cgi?id=1219020#c1 --- Comment #1 from Dmitry Markov <werwolf131313@gmail.com> --- Somewhere in the issues systemd github repo I found this advice: add to the error is repeated several times -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 https://bugzilla.suse.com/show_bug.cgi?id=1219020#c9 --- Comment #9 from Dmitry Markov <werwolf131313@gmail.com> --- (In reply to Antonio Feijoo from comment #8)
Could you please `zypper dup` and check if this is still reproducible with the latest systemd version. If that's the case, please set `systemctl log-level debug`, issue `systemctl hibernate` and attach the output of `journalctl -b -o short-monotonic`. Thanks!
So. I again created luks encrypted swap, added a key file to it, registered it in fstab, crypttab and kernel cmdline as indicated in the manual, but I never got around to testing hibernation. Now the system simply does not boot with this resume in cmdline (to boot I manually erase this parameter by editing the menu item in grub), the system simply cannot start using swap with this uuid.
[werwolf@workbook] ~ ❯ sudo lsblk -o +UUID NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS UUID nvme0n1 259:0 0 476,9G 0 disk *********************************************************************************************** └─nvme0n1p4 259:4 0 16,9G 0 part 855f2aa2-2f74-4f5f-9197-825c406b84ab └─cr_swap 254:1 0 16,9G 0 crypt [SWAP] 5a0d6b5f-3c80-4778-ad50-0b157b67415c
[werwolf@workbook] ~ ❯ cat /etc/fstab | grep -i swap UUID=5a0d6b5f-3c80-4778-ad50-0b157b67415c swap swap defaults,discard 0 0
[werwolf@workbook] ~ ❯ sudo cat /etc/crypttab | grep swap cr_swap UUID=855f2aa2-2f74-4f5f-9197-825c406b84ab /etc/main.key key-slot=1,discard
[werwolf@workbook] ~ ❯ sudo cat /etc/default/grub | grep resume GRUB_CMDLINE_LINUX_DEFAULT="splash=silent resume=UUID=5a0d6b5f-3c80-4778-ad50-0b157b67415c quiet security=apparmor mitigations=off delayacct"
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-luks-key.conf install_items+=" /etc/main.key "
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-resume.conf add_device+=" UUID=855f2aa2-2f74-4f5f-9197-825c406b84ab " add_dracutmodules+=" resume "
in my opinion it can be called “it has become worse”. or I forgot to do something, but I don’t understand what. -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 https://bugzilla.suse.com/show_bug.cgi?id=1219020#c10 --- Comment #10 from Dmitry Markov <werwolf131313@gmail.com> --- Created attachment 872955 --> https://bugzilla.suse.com/attachment.cgi?id=872955&action=edit boot fail photo of the boot log with an error -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 https://bugzilla.suse.com/show_bug.cgi?id=1219020#c12 Dmitry Markov <werwolf131313@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Flags|needinfo?(werwolf131313@gma | |il.com) | --- Comment #12 from Dmitry Markov <werwolf131313@gmail.com> --- (In reply to Antonio Feijoo from comment #11)
(In reply to Dmitry Markov from comment #9)
(In reply to Antonio Feijoo from comment #8)
Could you please `zypper dup` and check if this is still reproducible with the latest systemd version. If that's the case, please set `systemctl log-level debug`, issue `systemctl hibernate` and attach the output of `journalctl -b -o short-monotonic`. Thanks!
So. I again created luks encrypted swap, added a key file to it, registered it in fstab, crypttab and kernel cmdline as indicated in the manual, but I never got around to testing hibernation. Now the system simply does not boot with this resume in cmdline (to boot I manually erase this parameter by editing the menu item in grub), the system simply cannot start using swap with this uuid.
[werwolf@workbook] ~ ❯ sudo lsblk -o +UUID NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS UUID nvme0n1 259:0 0 476,9G 0 disk *********************************************************************************************** └─nvme0n1p4 259:4 0 16,9G 0 part 855f2aa2-2f74-4f5f-9197-825c406b84ab └─cr_swap 254:1 0 16,9G 0 crypt [SWAP] 5a0d6b5f-3c80-4778-ad50-0b157b67415c
[werwolf@workbook] ~ ❯ cat /etc/fstab | grep -i swap UUID=5a0d6b5f-3c80-4778-ad50-0b157b67415c swap swap defaults,discard 0 0
[werwolf@workbook] ~ ❯ sudo cat /etc/crypttab | grep swap cr_swap UUID=855f2aa2-2f74-4f5f-9197-825c406b84ab /etc/main.key key-slot=1,discard
[werwolf@workbook] ~ ❯ sudo cat /etc/default/grub | grep resume GRUB_CMDLINE_LINUX_DEFAULT="splash=silent resume=UUID=5a0d6b5f-3c80-4778-ad50-0b157b67415c quiet security=apparmor mitigations=off delayacct"
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-luks-key.conf install_items+=" /etc/main.key "
[werwolf@workbook] ~ ❯ cat /etc/dracut.conf.d/99-resume.conf add_device+=" UUID=855f2aa2-2f74-4f5f-9197-825c406b84ab " add_dracutmodules+=" resume "
in my opinion it can be called “it has become worse”. or I forgot to do something, but I don’t understand what.
The UUID in fstab and the resume kernel command line option (/etc/default/grub) is wrong, it should be `855f2aa2-2f74-4f5f-9197-825c406b84ab`.
ok, I checked when changing the resume parameter in cmdline from uuid swap partition to uuid luks partition with swap partition, the system boots correctly but if the same change is made in fstab, then after booting the system swap will be unused. which in my opinion is logical, because this uuid does not point to swap but to luks encrypted partition. I returned the uuid swap partition to swap, and left uuid luks with swap in cmdline, so the system booted correctly and swap worked. however, this did not lead to hibernation working:
[werwolf@workbook] ~ ❯ sudo systemctl hibernate Call to Hibernate failed: Not enough swap space for hibernation
[werwolf@workbook] ~ ❯ sudo journalctl -b -o short-monotonic -f
[ 306.396753] workbook.itrus.su sudo[6895]: werwolf : TTY=pts/3 ; PWD=/home/werwolf ; USER=root ; COMMAND=/usr/bin/systemctl hibernate [ 306.397215] workbook.itrus.su sudo[6895]: pam_kwallet5(sudo:setcred): pam_kwallet5: pam_sm_setcred [ 306.397803] workbook.itrus.su sudo[6895]: pam_unix(sudo:session): session opened for user root(uid=0) by werwolf(uid=1000) [ 306.397998] workbook.itrus.su sudo[6895]: pam_kwallet5(sudo:session): pam_kwallet5: pam_sm_open_session [ 306.398070] workbook.itrus.su sudo[6895]: pam_kwallet5(sudo:session): pam_kwallet5: we were already executed [ 306.408035] workbook.itrus.su sudo[6895]: pam_unix(sudo:session): session closed for user root [ 306.408146] workbook.itrus.su sudo[6895]: pam_kwallet5(sudo:session): pam_kwallet5: pam_sm_close_session [ 306.408213] workbook.itrus.su sudo[6895]: pam_kwallet5(sudo:setcred): pam_kwallet5: pam_sm_setcred
(In reply to Dmitry Markov from comment #10)
Created attachment 872955 [details] boot fail
photo of the boot log with an error
Please next time attach common formats, like jpg or png. Thanks.
sorry, I'll take this into account in the future -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1219020 https://bugzilla.suse.com/show_bug.cgi?id=1219020#c14 Dmitry Markov <werwolf131313@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #14 from Dmitry Markov <werwolf131313@gmail.com> --- (In reply to Antonio Feijoo from comment #13)
Sorry, I should've asked to add `systemd.log_level=debug` in the kernel command line to be able to see what's happening. But, I was able to reproduce your issue locally, and the logs match what you wrote in comment #1:
[ 82.172170] localhost systemd-logind[1065]: Got message type=method_call sender=:1.21 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 [ 82.172170] localhost systemd-journald[792]: Forwarding to syslog missed 464 messages. [ 82.172383] localhost systemd-logind[1065]: Sent message type=method_return sender=n/a destination=:1.21 path=n/a interface=n/a member=n/a cookie=58 reply_cookie=2 signature=n/a error-name=n/a error-message=n/a [ 82.172406] localhost systemd[1]: systemd-logind.service: Got notification message from PID 1065 (WATCHDOG=1) [ 82.172522] localhost systemd-logind[1065]: Got message type=method_call sender=:1.21 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 [ 82.172637] localhost systemd-logind[1065]: Failed to open configuration file '/etc/systemd/sleep.conf': No such file or directory [ 82.172660] localhost systemd-logind[1065]: Sleep mode "disk" is supported by the kernel. [ 82.172694] localhost systemd-logind[1065]: Disk sleep mode "shutdown" is supported by the kernel. [ 82.172720] localhost systemd-logind[1065]: /dev/dm-1: is a candidate device. [ 82.172737] localhost systemd-logind[1065]: No swap partitions or files matching resume config were found in /proc/swaps. [ 82.172760] localhost systemd-logind[1065]: Sent message type=error sender=n/a destination=:1.21 path=n/a interface=n/a member=n/a cookie=59 reply_cookie=3 signature=s error-name=org.freedesktop.login1.SleepVerbNotSupported error-message=Not enough swap space for hibernation [ 82.172778] localhost systemd-logind[1065]: Failed to process message type=method_call sender=:1.21 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
With the following actions I managed to make it work: - Set `resume=/dev/mapper/cr_swap` on the kernel command line. - Remove `add_device+=" UUID=... "` from /etc/dracut.conf.d/99-resume.conf - In /etc/crypttab, append the following two options to the cr_swap entry (4th column): x-initrd.attach,force - Run `dracut -f` - Reboot and try again `systemctl hibernate`.
If it does not work in your system, add `systemd.log_level=debug` and attach the output of `journalctl -b -o short-monotonic`. Thanks.
I'm back with good news As I understand it, adding `x-initrd.attach` to crypttab helped. Now hibernation works as it should. it might make sense to note this in the documentation from the first comment. wi-fi does not work when waking up, but this is not the topic of this bugreport. thanks for help! -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com