bootable snapshots option disappeared in grub

Was going to take another snapshot via snapper cli after system updates and got a error " .snapshots not a btrfs filesystem" …or something like that error. Rebooted and could then take them file. All the snapshots both the ones yast has been taking and the ones I manually created all show up with a snapper ls or in the snapper UI. But…the option to boot via a snapshot from grub has disappeared. I only have the general two options in grub now to boot normally or advanced but no entry for snapshots. I noticed after a system update on Sunday or so that it installed a new grub package and on initially reboot it had a uefi shim box message but it goes away and boots normally so I’m not sure it’s related or not; I see someone else has mentioned this in another post here. It seems like something was wrong with the last grub package install. Anyone else having these issues?

sudo btrfs subvolume list /
[sudo] password for root:
ID 256 gen 32 top level 5 path @
ID 257 gen 34293 top level 256 path @/var
ID 258 gen 23278 top level 256 path @/usr/local
ID 259 gen 34282 top level 256 path @/tmp
ID 260 gen 23278 top level 256 path @/srv
ID 261 gen 34235 top level 256 path @/root
ID 262 gen 23278 top level 256 path @/opt
ID 263 gen 34293 top level 256 path @/home
ID 264 gen 21595 top level 256 path @/boot/grub2/x86_64-efi
ID 265 gen 28 top level 256 path @/boot/grub2/i386-pc
ID 266 gen 34235 top level 256 path @/.snapshots
ID 274 gen 64 top level 266 path @/.snapshots/2/snapshot
ID 291 gen 18055 top level 266 path @/.snapshots/17/snapshot
ID 293 gen 18111 top level 266 path @/.snapshots/18/snapshot
ID 298 gen 19067 top level 266 path @/.snapshots/23/snapshot
ID 301 gen 18952 top level 266 path @/.snapshots/24/snapshot
ID 302 gen 19066 top level 266 path @/.snapshots/25/snapshot
ID 303 gen 34264 top level 266 path @/.snapshots/26/snapshot
ID 304 gen 19103 top level 266 path @/.snapshots/27/snapshot
ID 305 gen 19206 top level 266 path @/.snapshots/28/snapshot
ID 306 gen 19309 top level 266 path @/.snapshots/29/snapshot
ID 310 gen 21560 top level 266 path @/.snapshots/32/snapshot
ID 311 gen 21567 top level 266 path @/.snapshots/33/snapshot
ID 312 gen 21594 top level 266 path @/.snapshots/34/snapshot
ID 313 gen 23277 top level 266 path @/.snapshots/35/snapshot
ID 314 gen 23288 top level 266 path @/.snapshots/36/snapshot
ID 316 gen 34192 top level 266 path @/.snapshots/37/snapshot
ID 317 gen 34225 top level 266 path @/.snapshots/38/snapshot
ID 318 gen 34234 top level 266 path @/.snapshots/39/snapshot
neal@localhost:~>

If grub2 was upgraded while the /.snapshots wasn’t mounted there won’t be the snapshot option in grub menu. This was a recurring problem around February-March, I described it here: https://forums.opensuse.org/showthread.php/539125-TW-after-update-to-20200211-My-user-hard-drive-partitions-do-not-get-mounted-at-boot-any-longer?p=2928735#post2928735

Things to do:

  • Make sure have a “.snapshots” entry in /etc/fstab;
  • Check out journalctl -b -p 0..4;
  • Run mount -a, and re-generate grub (make a random change in YaST Bootloader and save);
  • Attempt to disable btrfsmaintenance (if is the original problem re-emerging): https://en.opensuse.org/SDB:Fix_btrfsmaintenance-refresh

I can disable the btrfsmaintenance service and try but the rest looks good. The snapshots folder is mounted, fstab has the entry, the /boot grub config has the menu entry and the source file is available. I guess something happened during the grub install…so what your saying is try the following.

“grub2-mkconfig and grub2-install”

Is this correct for TW to gengerate and reinstall grub?

Thanks,

Neal

mount | grep snap
/dev/sda3 on / type btrfs (rw,relatime,ssd,space_cache,subvolid=303,subvol=/@/.snapshots/26/snapshot)
/dev/sda3 on /.snapshots type btrfs (rw,relatime,ssd,space_cache,subvolid=266,subvol=/@/.snapshots)

/var/lib/snapd/snaps/snapd_8542.snap on /snap/snapd/8542 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/mailspring_488.snap on /snap/mailspring/488 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1506.snap on /snap/gtk-common-themes/1506 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_1885.snap on /snap/core18/1885 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/bashtop_112.snap on /snap/bashtop/112 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_9665.snap on /snap/core/9665 type squashfs (ro,nodev,relatime,x-gdu.hide)
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,mode=755)
nsfs on /run/snapd/ns/bashtop.mnt type nsfs (rw)

localhost:/home/neal # df -h |grep snap
/dev/sda3 460G 12G 447G 3% /.snapshots
/dev/loop0 30M 30M 0 100% /snap/snapd/8542
/dev/loop1 194M 194M 0 100% /snap/mailspring/488
/dev/loop3 63M 63M 0 100% /snap/gtk-common-themes/1506
/dev/loop2 56M 56M 0 100% /snap/core18/1885
/dev/loop4 24M 24M 0 100% /snap/bashtop/112
/dev/loop5 97M 97M 0 100% /snap/core/9665

localhost:/home/neal # cat /etc/fstab
UUID=3bced946-a98e-4cdb-8037-612743e971ba / btrfs defaults 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /var btrfs subvol=/@/var 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /usr/local btrfs subvol=/@/usr/local 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /tmp btrfs subvol=/@/tmp 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /srv btrfs subvol=/@/srv 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /root btrfs subvol=/@/root 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /opt btrfs subvol=/@/opt 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /home btrfs subvol=/@/home 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /boot/grub2/x86_64-efi btrfs subvol=/@/boot/grub2/x86_64-efi 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0
UUID=FD93-2E41 /boot/efi vfat utf8 0 2
UUID=9bb1e0c7-703f-449a-a5fc-5399e5e77e36 swap swap defaults 0 0
UUID=3bced946-a98e-4cdb-8037-612743e971ba /.snapshots btrfs subvol=/@/.snapshots 0 0
localhost:/home/neal #

neal # cat /boot/grub2/grub.cfg |grep snap
menuentry “Help on bootable snapshot #$snapshot_num” {
echo “Select the default entry of the snapshot boot menu.”
echo “Examine the snapshot, and if it’s OK,”
echo " run ‘snapper rollback’ and reboot."

BEGIN /etc/grub.d/80_suse_btrfs_snapshot

if -f “/.snapshots/grub-snapshot.cfg” ]; then
source “/.snapshots/grub-snapshot.cfg”

END /etc/grub.d/80_suse_btrfs_snapshot

And that file is there:

cat /.snapshots/grub-snapshot.cfg
if -z “$extra_cmdline” ]; then
submenu “Start bootloader from a read-only snapshot” {
if -f “/.snapshots/48/grub-snapshot.cfg” ]; then
source “/.snapshots/48/grub-snapshot.cfg”
fi
if -f “/.snapshots/47/grub-snapshot.cfg” ]; then
source “/.snapshots/47/grub-snapshot.cfg”
fi
if -f “/.snapshots/46/grub-snapshot.cfg” ]; then
source “/.snapshots/46/grub-snapshot.cfg”
fi
if -f “/.snapshots/45/grub-snapshot.cfg” ]; then
source “/.snapshots/45/grub-snapshot.cfg”
fi
if -f “/.snapshots/44/grub-snapshot.cfg” ]; then
source “/.snapshots/44/grub-snapshot.cfg”
fi
if -f “/.snapshots/43/grub-snapshot.cfg” ]; then
source “/.snapshots/43/grub-snapshot.cfg”
fi
if -f “/.snapshots/42/grub-snapshot.cfg” ]; then
source “/.snapshots/42/grub-snapshot.cfg”
fi
if -f “/.snapshots/41/grub-snapshot.cfg” ]; then
source “/.snapshots/41/grub-snapshot.cfg”
fi
if -f “/.snapshots/40/grub-snapshot.cfg” ]; then
source “/.snapshots/40/grub-snapshot.cfg”
fi
if -f “/.snapshots/37/grub-snapshot.cfg” ]; then
source “/.snapshots/37/grub-snapshot.cfg”
fi
if -f “/.snapshots/36/grub-snapshot.cfg” ]; then
source “/.snapshots/36/grub-snapshot.cfg”
fi
if -f “/.snapshots/35/grub-snapshot.cfg” ]; then
source “/.snapshots/35/grub-snapshot.cfg”
fi
if -f “/.snapshots/34/grub-snapshot.cfg” ]; then
source “/.snapshots/34/grub-snapshot.cfg”
fi
if -f “/.snapshots/33/grub-snapshot.cfg” ]; then
source “/.snapshots/33/grub-snapshot.cfg”
fi
if -f “/.snapshots/32/grub-snapshot.cfg” ]; then
source “/.snapshots/32/grub-snapshot.cfg”
fi
if -f “/.snapshots/29/grub-snapshot.cfg” ]; then
source “/.snapshots/29/grub-snapshot.cfg”
fi
if -f “/.snapshots/28/grub-snapshot.cfg” ]; then
source “/.snapshots/28/grub-snapshot.cfg”
fi
if -f “/.snapshots/27/grub-snapshot.cfg” ]; then
source “/.snapshots/27/grub-snapshot.cfg”
fi
if -f “/.snapshots/25/grub-snapshot.cfg” ]; then
source “/.snapshots/25/grub-snapshot.cfg”
fi
if -f “/.snapshots/24/grub-snapshot.cfg” ]; then
source “/.snapshots/24/grub-snapshot.cfg”
fi
if -f “/.snapshots/23/grub-snapshot.cfg” ]; then
source “/.snapshots/23/grub-snapshot.cfg”
fi
if -f “/.snapshots/18/grub-snapshot.cfg” ]; then
source “/.snapshots/18/grub-snapshot.cfg”
fi
if -f “/.snapshots/17/grub-snapshot.cfg” ]; then
source “/.snapshots/17/grub-snapshot.cfg”
fi
if -f “/.snapshots/2/grub-snapshot.cfg” ]; then
source “/.snapshots/2/grub-snapshot.cfg”
fi
if x$snapshot_found != xtrue ]; then
submenu “Not Found” { true; }
fi
}
fi

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

That worked…thanks so much…guess there was a problem on the initial install. I’ll look into that service you mentioned and see the pros and or cons of turning it off.

I am confused. I have up to date installs of Tumbleweed as well as Leap 15.2. Tumbleweed has .snapshots in its fstab, but no entry in the grub menu. Leap 15.2 has no .snapshots in its fstab, but all snapshots in the grub menu. Any idea?

I’d regenerate grub to see whether the entries appear/disappear. For TW also check out cat /.snapshots/grub-snapshot.cfg