After each hibernation process I get a corrupted root filesystem. My setup is a LUKS encrypted root and swap partition on LVM. I use a GPG encrypted key for the root filesystem and a unencrypted key file on the root partition for swap decryption. The initramfs is generated by genkernel with

genkernel --lvm --luks --gpg initramfs

For the hibernation setup I followed the Gentoo Wiki. I tried using

s2disk -r /dev/mapper/swap
echo disk > /sys/power/state

but all result in a corrupted root partition. I am not using tuxonice as (afaik) I would need to switch to other kernel sources or apply patches.


Kernel 4.9.6-gentoo-r1
pm-utils 1.4.1-r7

Disk layout:

sda            8:0    0  477G  0 disk  
├─sda2         8:2    0  128M  0 part  /boot
├─sda3         8:3    0  410G  0 part  
│ ├─vg1-swap 253:1    0   30G  0 lvm   
│ │ └─swap   253:3    0   30G  0 crypt [SWAP]
│ └─vg1-root 253:0    0  380G  0 lvm   
│   └─root   253:2    0  380G  0 crypt /
└─sda1         8:1    0    2M  0 part  
  • The virtual partition manager is called LVM. On the other hand LLVM is a compiler toolkit.
    – bodo
    Commented Mar 7, 2018 at 8:39

1 Answer 1


I use a GPG encrypted key for the root filesystem and a unencrypted key file on the root partition for swap decryption.

Does that mean you have to mount the root filesystem in order to be able to decrypt swap? If so, this could likely be the cause of your problems. You're not allowed to access (write) filesystems while in hibernation (because they are "still mounted" by the hibernated system).


 * BIG FAT WARNING *********************************************************
 * If you touch anything on disk between suspend and resume...
 *              ...kiss your data goodbye.
 * If you do resume from initrd after your filesystems are mounted...
 *              ...bye bye root partition.
 *          [this is actually same case as above]

Hibernation is very chancy business, basically you have to hope for whatever your Initramfs flavour to handle all cases properly. It's best to use a plain swap partition that can be reached without any shenanigans.

  • Thank you for your answer! I don't like the swap to be unencrypted (then I could simply suspend to RAM), but that sounds like it should work, if the encryption key file is on the USB stick, too (which I use for the keyfile of the root partition. Edit: I'm not sure how to understand the second part, what exactly does it mean? Commented Feb 27, 2017 at 14:16
  • Since you already mention the Gentoo wiki, I never got around to finishing this article wiki.gentoo.org/wiki/Custom_Initramfs/Hibernation but it explains some of the issues you may encounter. If you end up with filesystem corruption then either your resume failed altogether or initramfs did something it was not allowed to do. Loading the keyfile from a third party should be fine, only question is does your initramfs support it... Commented Feb 27, 2017 at 14:41
  • Thank you for the link, I already considered an custom initramfs, so if this fails I will give it a try. It definitely supports loading the keyfile from an external medium as I already use if for the root fs. Commented Feb 27, 2017 at 14:47
  • At least for two times in a row now everything worked with the key on a external drive. Commented Feb 27, 2017 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .