#7
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=.
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
sudo leafpad /etc/default/grub
copy the entry root=/dev/mapper/luks-... but change root= to resume=
That’s very odd. I did that. This is my /etc/default/grub:
grub
# GRUB boot loader configuration
GRUB_DEFAULT="0"
GRUB_TIMEOUT="2"
GRUB_DISTRIBUTOR="EndeavourOS"
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"
GRUB_CMDLINE_LINUX=""
# 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
#GRUB_ENABLE_CRYPTODISK="y"
# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE="menu"
# Uncomment to use basic console
GRUB_TERMINAL_INPUT="console"
# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT="console"
# 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'
GRUB_GFXMODE="2560x1440,auto"
# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX="keep"
# 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"
#GRUB_DISABLE_LINUX_UUID="true"
# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
GRUB_THEME="/boot/grub/themes/EndeavourOS/theme.txt"
# 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.
#GRUB_SAVEDEFAULT="true"
GRUB_DISABLE_SUBMENU="y"
GRUB_ENABLE_CRYPTODISK="y"
I paste the resume=/dev/mapper/luks-.... right after the root one, correct?
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.
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:
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.
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.
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.
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"
[Unit]
Description=Warn user on 1st login if system is a snapshot
[Service]
ExecStart=/usr/bin/sh -c "sleep 5; placeholder"
[Install]
WantedBy=default.target
EOF
' &&
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 …