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=.
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
# 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?
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.
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.
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
boot into a snapshot
run a grub-install from within the snapshot
I essentially fixed this by doing the following
Boot into live environment
Install Timeshift (and cronie)
Restore a snapshot
chroot into the system
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.
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.
Run the following to disable & delete the service …