Hibernation on swap file does not resume // 'ERROR: no device specified for hibernation'

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.

  1. 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.
  2. Then I must have the resume hook in /etc/mkinitcpio.conf. This has always been there. Anyway, this is how the HOOKS 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 the resume hook is created without error messages.
  3. 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 running findmnt -no UUID -T /swapfile)
    • The resume_offset= one, which specifies the physical offset where /swapfile starts: resume_offset=65067008 (I got this by running filefrag -v /swapfile)
    • I obviously ran update-grub after checking these parameters.

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.

The command line looks correct - but some of the arguments are new to me - no surprise - learning every day.

These were defaults for systems with snap enabled - only Xfce edition has it at present.

Granted - I have only rarely touched the consept of encrypting my system - are they specific to your system brand or hardware?

You are correct in assuming the message indicates that resume is not applied which is why you get a normal boot. This is - usually - caused by a disrecpancy in the swap UUID or the resume_offset for swapfile - but you appear to have the necessary knowledge - so if you haven’t pinned it …

I would recheck both the UUID and resume_offset - that is if you already did that and the number verifies - there is no need for you to do it.

When using hibernation and encryption I would preferably be using the LTS kernel and excersise caution if I were to change the kernel major.minor version (revision should not pose issues ) e.g. 6.1 to 6.6 - perhaps it is just me …

1 Like

Just a sidenote: These are wrong. It has to be started with the module name, so: i915.enabled_fbc=1

Note from the wiki:

For a stacked block device such as an encrypted container (LUKS), RAID or LVM, the resume parameter must point to the unlocked/mapped device that contains the file system with the swap file.

That means: resume=/dev/mapper/unlocked-device It is the device which contains the swapfile.

Doesn’t work that way on btrfs. Hope you have ext4 or xfs.

1 Like

Thanks to both, I’ve made some changes following your suggestions.

Those entries all date back at when I set up my laptop and I was trying to make deep suspension and other things work. I took them from people who had the same model. Frankly, I think most of them are probably not (longer) useful, but since they didn’t bother me I just let them there.

Anyway, I have removed apparmor=1 security=apparmor, and I’ll see how it goes.

If I modify enable_fbc=1 enable_psr=1 the way you recommend, though, when I try update-grub I get

/etc/default/grub: line 11: i915.enable_fbc=1: command not found

So I have to revert those changes for the time being. I’m not removing them for the moment – I think they are irrelevant at best, I don’t think the do any harm to hibernation.

I also changed resume=UUID=e6c4e28c-1714-4aa0-8378-71e34489645d to resume=/dev/mapper/luks-558055a3-e71d-4692-926f-516ae14a27c3. I’ll report if that makes a difference.

I have ext4.

Update: after the changes, and booting with LTS kernel 61, hibernation still doesn’t work, the message ERROR: no device specified for hibernation still shows up at boot.

Since I use hibernation very rarely and the rest works fine, I’ll stay this way. Thanks to both for your help :pray:

There is definitely something wrong with your syntax which result in that misbehavior.

What contains these files?

cat /proc/cmdline  
cat /etc/default/grub

cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64 root=UUID=e6c4e28c-1714-4aa0-8378-71e34489645d ro cryptdevice=UUID=558055a3-e71d-4692-926f-516ae14a27c3:luks-558055a3-e71d-4692-926f-516ae14a27c3

cat /etc/default/grub

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 enable_fbc=1 enable_psr=1 disable_power_well=0 mem_sleep_default=deep resume=/dev/mapper/luks-558055a3-e71d-4692-926f-516ae14a27c3 resume_offset=65067008

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.

# Preload both GPT and MBR modules so that they are not missed
# GRUB_PRELOAD_MODULES=part_gpt part_msdos

# Uncomment to enable booting from LUKS encrypted devices

# Uncomment to use basic console

# Uncomment to disable graphical terminal

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'

# More readable font on high dpi screen

# Uncomment to allow the kernel use the same resolution used by grub

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format root=/dev/xxx instead of root=/dev/disk/by-uuid/xxx

# Uncomment to disable generation of recovery mode menu entries

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.

# Uncomment one of them for the gfx desired, a image background or a gfxtheme

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE=480 440 1

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically

# To get Windows 10 entry in the GRUB menu

@MattG The grub file is part of a shell script. That means: space is a separator.

As you see at /proc/cmdline, only the first parameter of GRUB_CMDLINE_LINUX_DEFAULT was applied. You must use quotation marks to prevent separation. I really have no idea why all quotation marks are removed in your file.




Yeah, after setting quotation marks and running sudo update-grub you should get what you want (resuming from hibernation).

1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.