How to boot in a snapshot

Hi there.

I am using Tumbleweed (KDE), updated.

I am trying to read some documentation, but probably I’m not understanding everything. I feel sure about having all the conditions to have Snapper. sudo snapper list is showing me a list of snapshots, meaning that it’s working. Disk is 60GB, it’s only one.

Documentations:
https://en.opensuse.org/openSUSE:Snapper_Tutorial

What I’m reading is " 1. Boot the system. In the boot menu choose Bootable snapshots and select the snapshot you want to boot. The list of snapshots is listed by date—the most recent snapshot is listed first."

Does this mean that I should see a bootable Tumbleweed in GRUB? Because, in this case, I can’t see anything but the usual TW and Recovery options.

Otherwise, are snapshots just working with Snapper when booting in a bootable system in order to undo a couple of things that didn’t actually break too much?

Thank you.

You may have to scroll down in the grub menu if there are multiple bootable kernels to see the options to boot from the snapshots.

I ran into that a few months back when I was doing this myself.

I can only see old versions of the kernel, but not snapshots.

Now I actually have a doubt: I have a separate /boot partition, and maybe this will not enable the bootable snapshots.

Separate boot partition doesn’t make any difference.

Here’s what you should see:

image

If there are a lot of options in the menu, you need to scroll down further to see the option. (That’s what happened to me - I had 3 or 4 kernels listed on that page, and it wasn’t clear to me that this menu scrolls when you get to the bottom of it).

Once in the menu, you’ll see something like this:

image

Note that if you’re not running btrfs, you won’t have this option. btrfs is required on the root partition.

I’m running with Btrfs and chose the snapshots options when installing. But /boot is in ext4 partition, so I’m still thinking that this might create an issue. Perhaps I might try to do a conversion to Btrfs.

This is what I see at boot


What is the output of:

mount | grep boot

and:

mount | grep '/ '

That should give us some answers about whether you need to change any filesystems.

You can also try running:

snapper list

(You may need to do this as root)

~> mount | grep boot
/dev/nvme0n1p4 on /boot type ext4 (rw,relatime,data=ordered)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

> mount | grep '/ '
/dev/mmcblk0p1 on / type btrfs (rw,relatime,compress-force=zstd:3,ssd,discard=async,space_cache=v2,subvolid=263,subvol=/@/.snapshots/1/snapshot)

I’ve also run “sudo zypper dup” and then

~> sudo snapper list
[sudo] password di root: 
  # │ Tipo   │ Pre # │ Data                      │ Utente │ Spazio utilizzato │ Pulitura │ Descrizione           │ Dati utente
────┼────────┼───────┼───────────────────────────┼────────┼───────────────────┼──────────┼───────────────────────┼──────────────
 0  │ single │       │                           │ root   │                   │          │ current               │
 1* │ single │       │ lun 17 giu 2024, 19:03:41 │ root   │          7,15 MiB │          │ first root filesystem │
41  │ pre    │       │ mar 18 giu 2024, 14:53:17 │ root   │        384,00 KiB │ number   │ zypp(zypper)          │ important=yes
42  │ post   │    41 │ mar 18 giu 2024, 14:53:19 │ root   │        364,00 KiB │ number   │                       │ important=yes
45  │ pre    │       │ mar 18 giu 2024, 15:00:59 │ root   │          1,02 MiB │ number   │ zypp(zypper)          │ important=yes
46  │ post   │    45 │ mar 18 giu 2024, 15:03:11 │ root   │         11,59 MiB │ number   │                       │ important=yes
47  │ pre    │       │ mar 18 giu 2024, 15:09:08 │ root   │        376,00 KiB │ number   │ zypp(zypper)          │ important=yes
48  │ post   │    47 │ mar 18 giu 2024, 15:09:37 │ root   │          2,61 MiB │ number   │                       │ important=yes
49  │ pre    │       │ mar 18 giu 2024, 15:12:20 │ root   │        416,00 KiB │ number   │ zypp(zypper)          │ important=yes
50  │ post   │    49 │ mar 18 giu 2024, 15:13:56 │ root   │          5,43 MiB │ number   │                       │ important=yes
53  │ pre    │       │ mar 18 giu 2024, 15:19:02 │ root   │          1,70 MiB │ number   │ zypp(zypper)          │ important=yes
54  │ post   │    53 │ mar 18 giu 2024, 15:19:30 │ root   │          4,41 MiB │ number   │                       │ important=yes
63  │ pre    │       │ mar 18 giu 2024, 17:17:28 │ root   │          1,72 MiB │ number   │ zypp(zypper)          │ important=no
64  │ post   │    63 │ mar 18 giu 2024, 17:17:32 │ root   │          1,50 MiB │ number   │                       │ important=no
65  │ pre    │       │ mar 18 giu 2024, 17:27:16 │ root   │         96,00 KiB │ number   │ yast bootloader       │
66  │ post   │    65 │ mar 18 giu 2024, 17:28:38 │ root   │        320,00 KiB │ number   │                       │
67  │ pre    │       │ mar 18 giu 2024, 20:23:31 │ root   │          1,06 MiB │ number   │ yast sw_single        │
68  │ pre    │       │ mar 18 giu 2024, 20:24:01 │ root   │        380,00 KiB │ number   │ zypp(ruby.ruby3.3)    │ important=no
69  │ post   │    68 │ mar 18 giu 2024, 20:24:07 │ root   │        652,00 KiB │ number   │                       │ important=no
70  │ pre    │       │ mar 18 giu 2024, 20:28:01 │ root   │        288,00 KiB │ number   │ zypp(ruby.ruby3.3)    │ important=no
71  │ post   │    70 │ mar 18 giu 2024, 20:28:15 │ root   │        464,00 KiB │ number   │                       │ important=no
72  │ post   │    67 │ mar 18 giu 2024, 20:28:20 │ root   │         80,00 KiB │ number   │                       │
73  │ pre    │       │ mar 18 giu 2024, 20:43:58 │ root   │        976,00 KiB │ number   │ zypp(zypper)          │ important=no
74  │ post   │    73 │ mar 18 giu 2024, 20:45:41 │ root   │          9,47 MiB │ number   │                       │ important=no

Time is perfect.

I do not use Btrfs, but I am pretty sure you are correct here. When /boot is not part of the / Btrfs file system, all what is inside it (the kernel e.g.) will not be the subject of snapshotting.

Sounds very logical to me.

In this case I might see if I can use the btrfs-convert util, but I know that it was dismissed years ago. Might have to use a Live USB OS and should also be very careful to change the fstab in advance.

I feel unsure for now though. I don’t really feel like re-installing, so this one is not an option :stuck_out_tongue:

I concur. On my system, I do use btrfs, and /boot is part of /, and is btrfs. /boot/efi is vfat (as expected).

What most users want to have is:

3400g:~ # fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Samsung SSD 950 PRO 512GB               
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A84F222E-0177-499B-A7EA-BDA6F31E2196

Device          Start        End    Sectors   Size Type
/dev/nvme0n1p1   2048     206847     204800   100M EFI System
/dev/nvme0n1p2 206848 1000212479 1000005632 476.8G Linux filesystem
3400g:~ # 
3400g:~ # lsblk -f /dev/nvme0n1
NAME        FSTYPE FSVER LABEL      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1                                                                                 
├─nvme0n1p1 vfat   FAT16 950PRO     6DEC-64F9                              99.1M     1% /boot/efi
└─nvme0n1p2 btrfs        Tumbleweed e7ad401f-4f60-42ff-a07e-f54372bc1dbc  130.7G    72% /var
                                                                                        /root
                                                                                        /opt
                                                                                        /srv
                                                                                        /usr/local
                                                                                        /home
                                                                                        /boot/grub2/x86_64-efi
                                                                                        /boot/grub2/i386-pc
                                                                                        /.snapshots
                                                                                        /
3400g:~ # 

Converting to Super Simple Partitioning is straight forward in most cases.

I know and I understand your point. In fact I have a machine like that.

But this specific situation requires me to have a /boot partition on a different disk in order for the system to boot. It’s on a disk that is not bootable

No. The problem is not what filesystem /boot has, but the fact that it is a separate filesystem. Rollback is only supported if /boot is part of the / filesystem.

1 Like

Great!

Ouch! However if booted you always may run snapper rollback. Actually I used this command to recover from the latest and greatest annoyance: Catastrophic result after today's graphics driver update - #98 by karlmistelberger.

If the machine won’t boot any more use a rescue system and manually create a writeable copy of the snapshot you want to boot and make it the default subvolume.

1 Like

You may consider systemd-boot instead of grub2. In this case kernel and initrd are on ESP and loader does not need access to the root filesystem.

1 Like

Ohhh, what do you mean with “writable copy”? Or, can I use snapper via command line in the rescue tool of opensuse dvd?

Never used anything but grub, but I’ll definitely check this out!

Snapper created the following upon running snapper rollback 2868:

3400g:~ # snapper list |grep 2868
2868  │ post   │  2867 │ Mon Jun 17 16:00:01 2024 │ root │ number  │                         │ important=no
2890* │ single │       │ Wed Jun 19 15:22:28 2024 │ root │         │ writable copy of #2868  │
3400g:~ # 

I created a writeable copy of #2822 (oldest available) and verified by booting into it:

Mounted topmost subvolume (subvolid=5) at existing directory /Btrbk:

3400g:~ # grep /Btrbk /etc/fstab 
UUID=e7ad401f-4f60-42ff-a07e-f54372bc1dbc  /Btrbk                  btrfs  noauto,subvolid=5             0  0
3400g:~ # 
  1. Created a new directory:
mkdir /Btrbk/@/.snapshots/2891
  1. Created snapshot:
btrfs subvolume snapshot /Btrbk/@/.snapshots/2822/snapshot /Btrbk/@/.snapshots/2891
  1. Added description:
cp /Btrbk/@/.snapshots/2890/info.xml /Btrbk/@/.snapshots/2891
nano /Btrbk/@/.snapshots/2891/info.xml

Adjusted strings as required:

3400g:~ # cat /Btrbk/@/.snapshots/2891/info.xml 
<?xml version="1.0"?>
<snapshot>
  <type>single</type>
  <num>2891</num>
  <date>2024-06-19 14:52:28</date>
  <description>writable copy of #2822</description>
</snapshot>
3400g:~ # 
  1. Changed default subvolume and rebooted:
btrfs subvolume set-default /Btrbk/@/.snapshots/2891/snapshot

Host 3400g successfully rolled back and booted into #2891 Tumbleweed 20240206, writeable copy of #2822:

3400g:~ # journalctl -b -1|head -3
Jun 19 16:58:03 3400g kernel: Linux version 6.8.1-1-default (geeko@buildhost) (gcc (SUSE Linux) 13.2.1 20240206 [revision 67ac78caf31f7cb3202177e6428a46d829b70f23], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.42.0.20240130-2) #1 SMP PREEMPT_DYNAMIC Tue Mar 19 07:32:20 UTC 2024 (d922afa)
Jun 19 16:58:03 3400g kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-6.8.1-1-default root=UUID=e7ad401f-4f60-42ff-a07e-f54372bc1dbc quiet loglevel=0 plymouth.enable=0 mitigations=off
  1. Set default back to #2890 and booted again:
3400g:~ # snapper list |grep -E '2822|2868'
2822  │ pre    │       │ Thu May  9 15:29:45 2024 │ root │ number  │ zypp(zypper)            │ important=yes
2823  │ post   │  2822 │ Thu May  9 15:39:33 2024 │ root │ number  │                         │ important=yes
2868  │ post   │  2867 │ Mon Jun 17 16:00:01 2024 │ root │ number  │                         │ important=no
2890* │ single │       │ Wed Jun 19 15:22:28 2024 │ root │         │ writable copy of #2868  │
2891  │ single │       │ Wed Jun 19 16:52:28 2024 │ root │         │ writable copy of #2822  │
3400g:~ # 
1 Like

In the end I tried to make btrfs /boot a subvolume of /, but nothing booted at all.

I converted to systemd-boot (I wish I selected it in the first place when installing TW) by using this: Systemd-boot - openSUSE Wiki

Now I have the snapshots, after making the efi partition a bit bigger. The Known Issues part is important as “First boot with systemd-boot may select wrong snapshot. Workaround by holding the spacebar on first boot and select the correct snapshot from the menu. Then press ‘d’ to set it as default.”.

Also /boot should NOT be on a separate partition. or grub won’t see the snaps