Home Home > 2009 > 07 > 13 > suspend to disk with encrypted root file system on lvm
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

suspend to disk with encrypted root file system on lvm

July 13th, 2009 by

Suspend to disk a.k.a. Hybernation doesn’t quite work when running openSUSE in an encrypted root file system and swap on LUKS on LVM, as with Ludwig Nussel’s instructions. The system is not able to resume from the swap area, because the initial ramdisk opens the lvm system before the luks. This results in only root logical volume being opened at that time, but not the swap volume. A regular boot follows.

Here’s the mkinitd boot scripts (or their symlinks, rather) in question:

$ ls -1 /lib/mkinitrd/boot
...
61-lvm2.sh
71-luks.sh
...

Until all this is properly supported, here is a quirk to make it work: Make the lvm2 initrd boot script depend on the luks one*.

Edit /lib/mkinitrd/scripts/boot-lvm2.sh (this is what 61-lvm2.sh points to) and change the third line from
#%depends: evms
to
#%depends: evms luks

Recreate the initrd.
$ cp -iv /boot/mkinitrd /boot/mkinitrd.backup
$ mkinitrd

You will notice that the symlinks were renamed now:
71-luks.sh
72-lvm2.sh

No try suspending to disk, you should be prompted for your luks password and resume from disk should work.

$ s2disk

*This of course assumes that you only have lvm devices inside luks, not the other way around. It’s not too hard to have both –  simply duplicate and adjust the luks script and run one instance before and one after lvm.

Both comments and pings are currently closed.

2 Responses to “suspend to disk with encrypted root file system on lvm”

  1. Ludwig Nussel

    Interesting read. According to man 5 initrd your solution is not
    possible though 🙂 boot-luks and boot-lvm2 are in different stages
    so the order between the two is fixed. However if I understand it
    correctly all we need is a vgchange call in boot-luks, right? Would
    oyu mind opening a bug for that?

    • Andreas Stieger

      Yes you are right in saying that the manpage states that, and in fact those two scripts belong to different stages. The stage of the lvm2 symlink is moved. At least those two scripts are both the only ones in their respective stage, so there shouldn’t be many side effects except for each other.

      I’ll investigate this further, but not until in about two weeks, also not until I compared it with factory’s progress on this. I think there are already enough bugs and feature request for this particular feature. 🙂