Resume w/ BTRFS on LUKS?

I see this error on every reboot & start up:
ERROR: resume: no device specified for hibernation

What do I need to do to get hibernation working?

I used the copy & paste version of the guide when I first set the system up, then gave the verbose version a read and followed section #7/Optional: Set up Hibernation into swap file on Btrfs.

I updated grub & mkinitcpio, and on reboot I still see the same error.

Here are my logs since this boot:

7. We also need to add the resume device to /etc/default/grub
Copy the entry starting with root=/dev/mapper/luks-… and paste before loglevel=3 on the line starting with GRUB_CMDLINE_LINUX_DEFAULT= but substitute root= with resume=.

From you log:

32-21/@ quiet cryptdevice=UUID=a440eda9-8b99-4b0c-9cfd-281e27613c24:luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 root=/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 loglevel=3 resume_offset=1967064 nowatchdog

It looks you forgot

substitute root= with resume=



The July ISO doesn’t set the resume device automatically as it did before.
This issue should now be fixed in the Wiki article.
Could be that you ran the copy&paste script shortly before the fix.

As @pebcak correctly noted you simply need to add the resume device to /etc/default/grub

  1. sudo leafpad /etc/default/grub
  2. copy the entry root=/dev/mapper/luks-... but change root= to resume=
  3. sudo grub-mkconfig -o /boot/grub/grub.cfg

That should solve your problem.


That’s very odd. I did that. This is my /etc/default/grub:

# GRUB boot loader configuration

GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=a440eda9-8b99-4b0c-9cfd-281e27613c24:luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 root=/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 resume=/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 loglevel=3 resume_offset=1967064 nowatchdog"

# 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

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.

# 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 `vbeinfo'

# 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 make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.

I paste the resume=/dev/mapper/luks-.... right after the root one, correct?

Seems to be set up right. (?)

Some things you could maybe check:

  1. If swapon -s or a sudo swapoff /swap/swapfile followed by sudo swapon /swap/swapfile don’t show any errors, you could check if the resume_offset is correct.

  2. Check if the resume hook was added after filesystems in/etc/mkinitcpio.conf

If the above doesn’t help you could simply rebuild the whole swapfile:

Set your swap size


followed by …

sudo swapoff /swap/swapfile
sudo rm /swap/swapfile
sudo truncate -s 0 /swap/swapfile
sudo chattr +C /swap/swapfile
sudo btrfs property set /swap/swapfile compression none
sudo fallocate -l $swapsizeG /swap/swapfile
sudo chmod 600 /swap/swapfile
sudo mkswap /swap/swapfile
sudo swapon /swap/swapfile
offset=`sudo ./btrfs_map_physical /swap/swapfile`
offset_arr=(`echo ${offset}`)
offset_pagesize=(`getconf PAGESIZE`)
offset=$(( offset_arr[25] / offset_pagesize ))
offset_old=`grep -oP '(?<=resume_offset=)[0-9]+' /etc/default/grub`
sudo sed -i "s/$offset_old/$offset/" /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg

swapon -s shows

Filename                                Type            Size    Used    Priority
/swap/swapfile                          file            33554428        0       -2

I double checked and the resume_offset is correct.

I recreated the swapfile, but have to wait till I’m done with work to reboot. I’ll let you know!

It didn’t work :confused:

It seems like grub.cfg isn’t actually getting updated when I run sudo grub-mkconfig -o /boot/grub/grub.cfg. I say this because I disabled quiet boot and decreased the countdown to 2 seconds and neither have been put into effect.

If that’s the case then this is a whole different problem. We’ll have to narrow it down…

  • For good measure, run the following and reboot
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo mkinitcpio -p linux
  • Then please run and post …

cat /proc/cmdline

cat /etc/mkinitcpio.conf | grep HOOKS=\"

cat /etc/fstab | grep -v "#"

Re-running the commands & rebooting didn’t help, unfortunately.


BOOT_IMAGE=/timeshift-btrfs/snapshots/2020-08-05_00-32-21/@/boot/vmlinuz-linux-zen root=UUID=531434ab-c750-4bd0-9998-1f76924e9b88 rw rootflags=subvol=timeshift-btrfs/snapshots/2020-08-05_00-32-21/@ quiet cryptdevice=UUID=a440eda9-8b99-4b0c-9cfd-281e27613c24:luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 root=/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24 loglevel=3 resume_offset=1967064 nowatchdog


HOOKS="base udev autodetect modconf block keyboard keymap encrypt filesystems resume"

UUID=27CC-11DE                                          /boot/efi                       vfat    umask=0077 0 2
/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24   /                               btrfs   subvol=@,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24   /home                           btrfs   subvol=@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24   /var/cache/pacman/pkg   btrfs   subvol=@var-cache-pacman-pkg,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
/dev/mapper/luks-a440eda9-8b99-4b0c-9cfd-281e27613c24   /swap                           btrfs   subvol=@swap,defaults,compress=no 0 0
/swap/swapfile                                          none                                  swap     defaults 0 0
UUID=7874DF7374DF331C                                   /disks/Win10                    auto    nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=24569941-f7a9-46a7-ae1c-00eea39906e2               /disks/Movies                   auto    nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=E0B4BBE7B4BBBDFA                                   /disks/TV                               auto  nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=6998540c-ddd0-4b92-96b4-d45f0acc18ec               /disks/VMs                              auto    nosuid,nodev,nofail,x-gvfs-show 0 0

Ok, you’re booting the snapshot “2020-08-05_00-32-21”!

Please restore a snapshot from within Timeshift and reboot.

Then check if your /etc/default/grub contains what you need/want and run

sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo mkinitcpio -p linux

Well this is quite odd.

I restored, and on reboot I got this:

Then this:

And my avaliable snapshots aren’t showing properly

I also can’t pick any of the boot entries, I can only get back into my system by picking a snapshot.

You could try different snapshots but I think it’s best to chroot from a live-environment and rebuild some stuff.

  1. Boot into the live environment
  2. Decrypt and mount your luks partition (e. g. /dev/sda2)
sudo cryptsetup luksOpen /dev/sda2 crypt &&
sudo mount -o compress=zstd,subvol=@ /dev/mapper/crypt /mnt
  1. Mount your EFI boot folder (e. g. /dev/sda1)
sudo mount /dev/sda1 /mnt/boot/efi
  1. chroot into your system
sudo arch-chroot /mnt
  1. Do some root stuff …
grub-mkconfig -o /boot/grub/grub.cfg
mkinitcpio -p linux
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS
  1. Reboot and :pray:

That fixed my grub, but it still booted me into the old snapshot. I went back into the live USB and installed timeshift, restored the latest snapshot, then ran your commands. Now I believe I’m good.

The question is why did GRUB want to boot me into an older snapshot?

I also think it’d be very helpful to have timeshift installed by default on the ISO.

I really don’t know what went wrong in your case but am glad you’re up and running again.

On a side note, I’m going to do some extensive snapshotting and restoring - your issue has gotten me worried …

I agree it would be helpful but do understand the devs trying to keep the ISO as small in size as possible. Non Timeshift users would probably consider it bloatware and we hopefully don’t need to build and run it from a live environment that often. :wink:

1 Like

Totally understandable. I guess I’m thinking of the time where, for some reason, I can’t reach the internet.

OK, I tried to recreate your problem of the system always booting into the same snapshot, no matter what.

The good news: Timeshift’s btrfs snapshot restore system seems to be quite robust. I did try some shady stuff but nearly (see below) always recovered via a snapshot restore.

The bad news: I eventually managed to get myself into a snapshot boot loop!
Restoring other snapshots, installing applications, updating etc. had no effect; I always ended up in the same snapshot after a reboot and without the changes made to the system before.
I can think of a few situations where this would be a nifty feature but in most cases this is just annoying.

What you DON’T want to do is

  1. boot into a snapshot
  2. run a grub-install from within the snapshot

I essentially fixed this by doing the following

  1. Boot into live environment
  2. Install Timeshift (and cronie)
  3. Restore a snapshot
  4. chroot into the system
  5. update grub, rebuild kernel and run grub-install

Once you’re set up again you shouldn’t boot into or restore snapshots created before this point. Create a new snapshot and delete all old snapshots for good measure. This is because I had some weird behavior with some old snapshots when testing a restore after fixing.


Interesting! So are you saying you triggered it by booting into a snapshot then installing GRUB from there?

I’m relatively sure I never did that, but it’s possible.

Could of course also be caused by something else entirely; this is just what “worked” for me. :grin:

Short follow-up.
I made a small systemd user service that checks if I booted into a btrfs-snapshot at login and warns/informs me.

I thought I’d share it. To activate just run the following …

sudo sh -c '
cat > /etc/systemd/user/warn-if-in-snapshot.service <<- "EOF"
Description=Warn user on 1st login if system is a snapshot

ExecStart=/usr/bin/sh -c "sleep 5; placeholder"

' &&
sudo sed -i "s#placeholder#( cat \/proc\/cmdline | grep \x27BOOT_IMAGE=/@\x27 ) \&> \/dev\/null || ( echo \x27Current system IS A SNAPSHOT\!\x27; notify-send \x27ATTENTION - BTRFS-SNAPSHOT Issue\x27 \x27YOU SEEM TO HAVE BOOTED INTO A SNAPSHOT.\\\nRun the following for more info:\\\n   cat \/proc\/cmdline\\\n\\\nIt is advised not to issue update and install commands.\\\nDO NOT run grub-install.\\\n\\\nViable recommended actions:\\\n   (1) Reboot system -or-\\\n   (2) Restore a snapshot via Timeshift \& reboot\x27 --icon=dialog-warning --expire-time=0; exit 1 ) || exit; echo \x27Current system is not a snapshot\x27#" /etc/systemd/user/warn-if-in-snapshot.service &&
sudo systemctl --user --global enable warn-if-in-snapshot.service

You can check this services status with
journalctl --user-unit warn-if-in-snapshot.service

Note: You will only be informed about being in a snapshot for snapshots created after activating this service. Old snapshots obviously don’t have this service installed. :wink:

Run the following to disable & delete the service …

sudo sh -c '
systemctl --user --global disable warn-if-in-snapshot.service
rm /etc/systemd/user/warn-if-in-snapshot.service


This is great and you’re amazing!