I have Manjaro installed on an encrypted partition, and a swap file of 16Gb.
I set up hibernation when I installed the system about three years ago, and it worked fine. Recently, when I tried to hibernate my system, I found out that
- hibernation is apparently performed correctly (i.e. the computer apparently writes on the swap file and goes to sleep without encountering problems)
- when rebooting and loading the kernel, a message “ERROR: no device specified for hibernation” (N.B. this shows up at every boot) appears and the system reboots as if I had shut it down
I interpret this as a sign that the problem is not in hibernation, but in the system’s inability to correctly find (and read) the swap file when attempting to resume from hibernation.
When I set up hibernation, I used the info provided in the Arch Wiki (Power management/Suspend and hibernate - ArchWiki), so I went back to that page to see if some required parameter or syntax has changed in the meantime.
- The first step is having a swap partition or file that is large enough. Since mine is 16Gb, this shouldn’t be a problem. Anyway, when the swap is not enough, hibernation fails to complete (it happened to me once). If the process completes without reporting problems, I assume swap size is not the issue here.
- Then I must have the
resume
hook in/etc/mkinitcpio.conf
. This has always been there. Anyway, this is how theHOOKS
line of my/etc/mkinitcpio.conf
file looks like:
HOOKS=(base udev resume autodetect modconf block keyboard keymap plymouth plymouth-encrypt filesystems)
This seems correct to me.
mkinitcpio -P
executes correclty and theresume
hook is created without error messages. - Then I must specify the correct kernel parameters. Following the Arch Wiki guide, I have:
- The
resume=
parameter, which specifies the UUID of the ext4 partition on which the swap file has been created:resume=UUID=e6c4e28c-1714-4aa0-8378-71e34489645d
(I got this by runningfindmnt -no UUID -T /swapfile
) - The
resume_offset=
one, which specifies the physical offset where/swapfile
starts:resume_offset=65067008
(I got this by runningfilefrag -v /swapfile
) - I obviously ran
update-grub
after checking these parameters.
- The
And yet, the system apparently hibernates (I write “apparently” because it seems to do the same it did when hibernation worked: the screen goes black, you hear some writing on the disk and then it shuts down) but at reboot, when the resume hook is loaded, the message ERROR: no device specified for hibernation
briefly appears on my screen and I get a ‘normal’ boot.
My guess is that it’s more likely to be a problem with kernel parameters (i.e. step 3) than with the rest, but I’m happy to get any suggestion. As I said hibernation has worked for ~3 years, and then, without any change on my side, it stopped working. Probably some configuration has changed and I have to update mine, but so far I’m clueless. Thanks for any help.
P.S. If there’s any additional information that I should provide, just let me know.
P.P.S. Just in case there’s something in the grub configuration that may interfere with resuming from hibernation, this is how the GRUB_CMDLINE_LINUX_DEFAULT=
looks like:
GRUB_CMDLINE_LINUX_DEFAULT=cryptdevice=UUID=558055a3-e71d-4692-926f-516ae14a27c3:luks-558055a3-e71d-4692-926f-516ae14a27c3 root=/dev/mapper/luks-558055a3-e71d-4692-926f-516ae14a27c3 apparmor=1 security=apparmor enable_fbc=1 enable_psr=1 disable_power_well=0 mem_sleep_default=deep resume=UUID=e6c4e28c-1714-4aa0-8378-71e34489645d resume_offset=65067008
I specify that none of these parameters has been added or changed recently.