#645010 initramfs-tools: should check uswsusp.conf for resume image

#645010#5
Date:
2011-10-11 18:26:15 UTC
From:
To:
Hello,
I tried to use the uswsusp package on my squeeze installation with backported
2.6.39-486 kernel on my Thinkpad X40. I encrypted the whole disk on
installation with the dm-crypt methode allowed by the installer.

Now I have a device called /dev/mapper/sda2_crypt -> ../dm-0 (which points to
dm-0).
I created a swapfile with the same size as my physical ram (/swap.file).
Calling dpkg-reconfigure uswsusp gave me the following /etc/uswsusp.conf :
# /etc/uswsusp.conf(5) -- Configuration file for s2disk/s2both
resume device = /dev/dm-0
splash = y
compress = y
early writeout = y
image size = 728065802
suspend loglevel = 2
max loglevel = 1
RSA key file = /etc/uswsusp.key
shutdown method = platform
resume offset = 61440

The generated initrd image incuded all hooks and this .conf file. After calling
hibernate on the commandline as root, the image seems to be written on the disk
without any problems and the machines powers off.

Anyway, after switching the laptop on again, I've never noticed an attempt to
resume from disk. I also tried "resume device = /dev/mapper/sda2_crypt", but
the suspend image which might be written correctly to /swap.file was never
recovered. The installation boots as if there were no suspend image.

How do I notice, if some attempt is even made?

Regards,
Ossy

#645010#12
Date:
2013-11-23 10:42:40 UTC
From:
To:
Hi,

could you try to install the latest initramfs-tools package (version 0.115) and then try again? It is currently in unstable and testing.

initramfs-tools had a typo in previous versions that can affect uswsusp.

Thanks a lot,
Cheers,
kix

#645010#17
Date:
2013-12-01 21:21:18 UTC
From:
To:
Hi,

In the meanwhile I upgraded to wheezy.
I have installed initramfs from jessie. Anyway the behaviour is the same:
image seems to be written, but afterwards it is not resumed (file named
/swap.file on device dm-0 which is a crypted device).

# dmesg|grep image
[    1.223756] PM: Hibernation image not present or could not be loaded.

initramfs-tools    0.115
uswsusp            1.0+20110509-3

Are there any possibilities to get debug info where the initramfs tries
to find it?

#645010#22
Date:
2013-12-02 07:22:08 UTC
From:
To:
Hi Marcus,

try to set the resume device as "/swap.file" because this file
contains the resume image.

You can try it in the kernel boot, and if is ok, you can update the
/etc/uswsusp.conf file (and probably the
/etc/initramfs-tools/conf.d/resume file.

Cheers,
kix

Marcus Osdoba <marcus.osdoba@googlemail.com> escribió:

#645010#27
Date:
2013-12-21 17:33:20 UTC
From:
To:
Hi Marcus,

is the problem solved?

Thanks.
kix

#645010#32
Date:
2013-12-21 21:20:28 UTC
From:
To:
Hi Rodolfo,

Thanks for asking. Surprisingly I launched another trial today. My (not
that expensive) SSD was broken and I had to recover from a former backup
(now on a new SLC ssd).

The problem is solved now. For documention purposes I write my config
down here.

Bascially I followed to wiki under [0]
..which told me to use the device! (not /swap.file) where the swap file
resides. Unfortunately, all my trials were unsuccessful, until I finally
added GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mapper/sda2_crypt quiet"
to my grub cfg.

My ssd layout is as follows:
/dev/sda1 -> 512M /boot
/dev/sda2 -> base for a crypt device -> /dev/mapper/sda2_crypt -> rootfs
swap.file is a file on the fs on sda2_crypt

The installation of uswsusp automagically detected the device and the
offset, where the swap file lives. I just never tried to add the above
mentioned kernel option.

 ># cat /etc/uswsusp.conf
# /etc/uswsusp.conf(5) -- Configuration file for s2disk/s2both
resume device = /dev/mapper/sda2_crypt
#resume device = /swap.file # this does not work (verify [0])
compress = y
image size = 728022466
suspend loglevel = 1
max loglevel = 1
RSA key file = /etc/uswsusp.key
shutdown method = platform
resume offset = 1832960
# offset automagically detected, e.g. dpkg-reconfigure uswsusp

I didn't downgrade to initramfs-tools from wheezy(base), so I can't tell
you if it also works with the wheezy version. Mine is:
initramfs-tools    0.115~bpo70+1  all

The kernel option for GRUB_CMDLINE_LINUX_DEFAULT is documented in the
wiki. Maybe it is possible to add a hint during the configuration
questions. I believe the same applies to swapfiles on non-crypt devices,
too.

Regards,
Marcus

[0] https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition

#645010#37
Date:
2013-12-22 11:16:50 UTC
From:
To:
Hi Marcus,

could you try this:

edit /etc/initramfs-tools/conf.d/resume

If the device is different than /dev/mapper/sda2_crypt, change it and set /dev/mapper/sda2_crypt
Then, remove the GRUB_CMDLINE_LINUX_DEFAULT in grub.cfg
recreate the initramfs file
reboot.

Is only for testing if initramfs-tools should check /etc/uswsusp.conf file.

Thanks a lot for your help.
kix

On Sat, 21 Dec 2013, Marcus Osdoba escribió:

#645010#42
Date:
2013-12-25 12:23:37 UTC
From:
To:
Am 22.12.2013 12:16, schrieb Rodolfo García Peñas:
Hi Rodolfo,

I created
cat /etc/initramfs-tools/conf.d/resume
RESUME=/dev/mapper/sda2_crypt
#RESUME=/dev/disk/by-uuid/17e633e9-e181-4d57-8025-9e53e695599e
removed resume from grub cmdline (/etc/default/grub)
update-grub
update-initramfs -u
did a hibernate while writing this email with icedove
..and continued after a successful resume ;-)

Is it a correct assumption, that initramfs-tools need to create
/etc/initramfs-tools/conf.d/resume even if only a swap FILE exists?
Or is the creation of /etc/initramfs-tools/conf.d/resume a feature of
the uswsusp package?
I still believe, that the same applies for swap FILEs on non-crypt
devices, too.

Best regards and merry christmas,
Marcus

#645010#57
Date:
2013-12-26 10:32:04 UTC
From:
To:
Hi,

I reassigned this bug to initramfs-tools because the postinst script
doesn't check the uswsusp.conf config file (/etc/uswsusp.conf). If the
user is using a file as resume device, the initramfs-tools package is
unable to know it, and is unable to resume. For this reason
initramfs-tools should check the uswsusp.conf file.

This bug is minor, because the user can use a workaround in the GRUB
config file:

GRUB_CMDLINE_LINUX_DEFAULT="resume=<partition with resume file> quiet"

But this workaround needs more user knowledge.

Probably is possible to use the patches I sent
(http://lists.debian.org/debian-kernel/2013/07/msg01000.html) for the
problem with multiple swap devices.

Thanks a lot,
kix
--
  .''`.
: :'  : Rodolfo García Peñas (kix) <kix@debian.org>
`. `'`  Proud Debian Developer
  `-