View previous topic :: View next topic |
Author |
Message |
abduct Apprentice

Joined: 19 Mar 2015 Posts: 222
|
Posted: Wed Mar 21, 2018 4:11 am Post subject: s2disk does not resume |
|
|
So I've been trying to piece together a hibernation via s2disk and I believe I have it all setup correctly, but upon powering up the laptop and entering my LVM passphrase it enters a normal boot cycle and I am welcomed back to a login prompt.
My setup is a simple LVM which contains 4 partitions as stated below. I am trying to suspend to the swap partition.
I have already saved my grub conf as well as rebuilt my initramfs to reflect changes. s2ram works. My kernel options are set. There are no errors on screen when creating the suspension files. I have not edited any initramfs configs, Is there something in there I need to enable?
I think this is just a configuration issue somewhere, likely in my grub config.
Here are my config files and settings.
Any tips or tricks?
Code: | # free -h
total used free shared buff/cache available
Mem: 5.7G 74M 5.6G 776K 79M 5.6G
Swap: 10G 0B 10G
|
Code: | # cat /etc/suspend.conf
snapshot device = /dev/snapshot
resume device = /dev/mapper/vg0-swap
#image size = 350000000
#suspend loglevel = 2
#compute checksum = y
#compress = y
#encrypt = y
#early writeout = y
#splash = y
|
Code: | # vi /etc/defaults/grub
[[snip]]
GRUB_CMDLINE_LINUX="dolvm crypt_root=UUID=f6d1snipaf1-a9aa-7232421eb36d root=/dev/mapper/vg0-root resume=/dev/mapper/vg0-swap vga=791 splash=silent,theme:gentoo console=tty1 quiet net.ifnames=0 root_trim=yes i915.allow_pc8=1 pci_aspm=force i915.enable_rc6=1 "
[[snip]] |
Code: |
# lvscan
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
ACTIVE '/dev/vg0/root' [25.00 GiB] inherit
ACTIVE '/dev/vg0/var' [40.00 GiB] inherit
ACTIVE '/dev/vg0/home' [390.00 GiB] inherit
ACTIVE '/dev/vg0/swap' [10.25 GiB] inherit |
Code: | # cat /etc/fstab
UUID=AsnipEC /boot vfat noauto,noatime 1 2
UUID=98dacsnip8f11-72225eac80c5 / ext4 defaults 0 1
UUID=af6ffsnip7b7-76f8aa327acee5 /var ext4 defaults 0 1
UUID=1da8snip-b965-3b73229d1c6b /home ext4 defaults 0 1
UUID=04f61snipb-98bb-e9a0a6009c swap swap defaults 0 0
tmpfs /tmp tmpfs size=3G 0 0
tmpfs /run tmpfs size=100M 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
|
|
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Mar 21, 2018 8:21 am Post subject: |
|
|
abduct ...
I'm not using those specific components (swsusp, genkernel, sys-power/suspend) so I'm probably not going to be of much help. However, with your LVM volumes within the dmcrypt then the order in which the initramfs attempts to run 'cryptsetup luksOpen', and 'vgscan', is important. I'm not sure what a genkernel created initramfs does in that regard but your GRUB_CMDLINE_LINUX has 'dolvm' prior to crypt_* ... and if that is the order in which these are executed then it would obviously fail. In my case (better-initramfs with tuxonice) I have the following:
Code: | rootfstype=ext4 luks enc_root=UUID=55862fb9-d4b0-4962-8795-ccb8a7043b7a lvm root=/dev/mapper/vg-root tuxonice resume=/dev/mapper/vg-swap |
As I said, not much help, but you might want to check what genkernel is doing in that regard (ie, in its 'init').
HTH & best ... khay |
|
Back to top |
|
 |
abduct Apprentice

Joined: 19 Mar 2015 Posts: 222
|
Posted: Wed Mar 21, 2018 10:09 pm Post subject: |
|
|
Thanks for the reply.
I attempted to move the dolvm command later in the grub query, but still no luck.
How would I go about seeing how the genkernel initramfs processes everything?
Also when I am booting I am just letting the timeout hit inside grub. Do I need to go under advanced or anything and select a different boot option? |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Mar 22, 2018 12:03 am Post subject: |
|
|
abduct wrote: | How would I go about seeing how the genkernel initramfs processes everything? |
abduct ... you would need to unpack (and repack) the initramfs ... which I expect is a cpio.gz archive (again, I've never used genkernel).
Code: | # mkdir /tmp/initramfs
# cd /tmp/initramfs
# zcat /boot/initramfs.cpio.gz | cpio -idmv
# find . | cpio -o -c | gzip -9 > /boot/initramfs-new.cpio.gz |
abduct wrote: | Also when I am booting I am just letting the timeout hit inside grub. Do I need to go under advanced or anything and select a different boot option? |
I'm not a grub2 user, but without grub2 it's just a matter of passing 'resume', etc, to the kernel.
You're welcome & best ... khay |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23551
|
Posted: Thu Mar 22, 2018 1:21 am Post subject: |
|
|
What, if any, error messages does the initramfs display when you unlock the swap volume and it tries (and fails) to resume? |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Mar 22, 2018 8:47 am Post subject: |
|
|
abduct ...
just noticed this ... according to the gentoo wiki "[i]f swapfile resides in a LVM volume, GRUB must be compiled with LVM support. Otherwise, the system will not wake up and will be cold started". I suspect that the useflag is "device-mapper" (which, note, is not enabled by default).
equery -NC u sys-boot/grub | grep device-mapper: | - - device-mapper : Enable support for device-mapper from sys-fs/lvm2 |
HTH & best ... khay |
|
Back to top |
|
 |
abduct Apprentice

Joined: 19 Mar 2015 Posts: 222
|
Posted: Thu Mar 22, 2018 3:46 pm Post subject: |
|
|
Hu wrote: | What, if any, error messages does the initramfs display when you unlock the swap volume and it tries (and fails) to resume? |
None, it's as if it doesn't even attempt to resume. No logs, no messages, no output regarding hibernation or resuming. It simply asks for my passphrase, unlocks the LVM and hands off to openRC for system init.
khayyam wrote: | abduct ...
just noticed this ... according to the gentoo wiki "[i]f swapfile resides in a LVM volume, GRUB must be compiled with LVM support. Otherwise, the system will not wake up and will be cold started". I suspect that the useflag is "device-mapper" (which, note, is not enabled by default).
equery -NC u sys-boot/grub | grep device-mapper: | - - device-mapper : Enable support for device-mapper from sys-fs/lvm2 |
HTH & best ... khay |
This makes sense as to why nothing is happening. The notes on the wiki are easy to miss sometimes, maybe they should change the colors to something that pops out more. I will re-emerge and reinstall grub with the included useflag and see where it takes me sometime today. |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23551
|
Posted: Fri Mar 23, 2018 1:37 am Post subject: |
|
|
That makes no sense to me why grub would matter here. If you are required to unlock the LUKS container and activate the LVM before you can access the swap device, then you are well past the point where grub would matter.
Since it appears that it does not attempt to resume, you should investigate why. I suspect this is where using a canned solution becomes a problem. It isn't technically a black box since you could unpack it and examine it, but it's pretty close. As is, it doesn't work, it doesn't explain why it doesn't work, and if it has any debugging capabilities, neither of us knows about them. You should find what debugging capabilities it has and enable them. Running set -x early on in the initramfs, assuming it is a bash script, would be a good start. |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri Mar 23, 2018 7:52 am Post subject: |
|
|
Hu wrote: | That makes no sense to me why grub would matter here. If you are required to unlock the LUKS container and activate the LVM before you can access the swap device, then you are well past the point where grub would matter. |
Hu ... I think its because grub2 does something to set/unset S4, or S5, state. I assume this because grub2 has a parameter called GRUB_DISABLE_RECOVERY, which if set to 'true' (which by all accounts is the default) will disable hibernation. I've gleened this from various redhat/ubuntu docs, where they suggest this must be set to 'false' for hibernation to occur post grub. How this ties in with LVM (and the above tip on the wiki) I can't say, it may be a red herring, but on the basis that hibernation occurs, and there is no error on resume, I'm inclined to think that its most likely grub which is causing the issue.
I'm not going to try and figure out why it does this, or what the purpose of this parameter is (I suspect its so that the menu is changed/adjusted ... wild guess), I don't use grub because there seems to me to be way too much magic of this sort.
best ... khay |
|
Back to top |
|
 |
abduct Apprentice

Joined: 19 Mar 2015 Posts: 222
|
Posted: Sun Mar 25, 2018 9:58 pm Post subject: |
|
|
I finally got suspend to disk working. The problem was broken swsusp inside the init script that genkernel creates for the initramfs.
These are the articles I have managed to find regarding the issues, and I took bits and pieces of them to create a working environment for s2disk to work.
http://alonbl.shoutwiki.com/wiki/Gentoo/Suspend_To_Disk_Using_uswsusp_and_genkernel
https://forums.gentoo.org/viewtopic-t-978370-start-0.html
https://bugs.gentoo.org/156445
Steps to get hibernation working with genkernel:
1) In /usr/share/genkernel/defaults/initrd.scripts modify the following lines within the swsusp_resume() function:
Code: | [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume |
to become
Code: | [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume && /sbin/resume |
2) Configure /etc/suspend.conf if you have not done so already:
Code: | snapshot device = /dev/snapshot
resume device = /dev/sda2
|
3) Create the overlay to get the configuration and correct binaries into the initramfs (note: any time you make a change to suspend.conf or upgrade the binaries you should update the overlay... Perhaps if you use a hardlink this may not be needed):
Code: | mkdir -p /var/lib/genkernel/overlay/etc /var/lib/genkernel/overlay/sbin
cp /etc/suspend.conf /var/lib/genkernel/overlay/etc
cp /usr/lib/suspend/resume /var/lib/genkernel/overlay/sbin |
4) Update the initramfs:
Code: | mount /dev/sda2 /boot #mount boot if it is not already mounted
genkernel --initramfs-overlay=/var/lib/genkernel/overlay --luks --lvm initramfs |
5 Optional) If you are suspending from a graphical environment use the sys-power/hibernate-script to aid in hibernation. Config values are in one of the provided links.
The moral of this experience is that genkernel devs seem to not want to push working suspending functionality into genkernel since like 2006 resulting in having to manually patch the init scripts and provide working overlays for configs and binaries to be copied into the initramfs. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|