Btrfs system wont boot from the default subvolume?

I must be misunderstanding btrfs (what a surprise).

Im sure from what iv read that when you use snapper rollback that it should change the default snapshot which should then be booted from.
I just dont see how to get btrfs to boot from the set default snapshot

snapper has set a default snapshot

sudo btrfs subvolume get-default /                                                                                                                         <b2> βœ”
ID 345 gen 1492 top level 263 path @/.snapshots/52/snapshot

some info on that default snapshot

sudo btrfs subvolume show /.snapshots/52/snapshot                                                                                                      ξ‚² INT ✘ 
@/.snapshots/52/snapshot
        Name:                   snapshot
        UUID:                   639ef70e-9dc9-9f40-b083-52d734060e8b
        Parent UUID:            e6c5ebce-4cad-8140-ac44-e858437473b7
        Received UUID:          -
        Creation time:          2024-07-07 10:25:55 +0100
        Subvolume ID:           345
        Generation:             1492
        Gen at creation:        1492
        Parent ID:              263
        Top level ID:           263
        Flags:                  -
        Send transid:           0
        Send time:              2024-07-07 10:25:55 +0100
        Receive transid:        0
        Receive time:           -
        Snapshot(s):
        Quota group:            n/a

snapper indicates that it should be booted from after the next reboot

sudo snapper -c root list                                                                                                                                  ξ‚² βœ” 
  # β”‚ Type   β”‚ Pre # β”‚ Date                         β”‚ User β”‚ Cleanup  β”‚ Description            β”‚ Userdata
────┼────────┼───────┼──────────────────────────────┼──────┼──────────┼────────────────────────┼──────────────
 0  β”‚ single β”‚       β”‚                              β”‚ root β”‚          β”‚ current                β”‚
 2  β”‚ single β”‚       β”‚ Mon 03 Jun 2024 03:33:30 BST β”‚ root β”‚          β”‚                        β”‚
 7  β”‚ single β”‚       β”‚ Mon 03 Jun 2024 04:01:24 BST β”‚ root β”‚          β”‚ Manual Snapshot        β”‚
23  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 11:27:53 BST β”‚ root β”‚          β”‚ Manual Snapshot        β”‚
32  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 19:00:13 BST β”‚ root β”‚ timeline β”‚ timeline               β”‚
34  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 19:56:39 BST β”‚ root β”‚ number   β”‚ rollback backup        β”‚ important=yes
37  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:00:15 BST β”‚ root β”‚ timeline β”‚ timeline               β”‚
38  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:02:25 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
39  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:16:44 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
40  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:26:56 BST β”‚ root β”‚ number   β”‚ rollback backup of #35 β”‚ important=yes
41  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:26:56 BST β”‚ root β”‚          β”‚ writable copy of #37   β”‚
42  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 20:28:27 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
43  β”‚ single β”‚       β”‚ Sat 06 Jul 2024 21:00:08 BST β”‚ root β”‚ timeline β”‚ timeline               β”‚
44  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 09:39:00 BST β”‚ root β”‚          β”‚ boot                   β”‚
45  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 09:46:43 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
46  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 09:52:28 BST β”‚ root β”‚          β”‚ hellothere             β”‚
47  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:00:00 BST β”‚ root β”‚ number   β”‚ timeline               β”‚
48  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:10:13 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
49  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:18:52 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
50  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:21:34 BST β”‚ root β”‚          β”‚ new                    β”‚
51  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:25:55 BST β”‚ root β”‚ number   β”‚ rollback backup of #47 β”‚ important=yes
52+ β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:25:55 BST β”‚ root β”‚          β”‚ writable copy of #50   β”‚
53  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 10:26:35 BST β”‚ root β”‚ number   β”‚ boot                   β”‚
54  β”‚ single β”‚       β”‚ Sun 07 Jul 2024 11:00:00 BST β”‚ root β”‚ timeline β”‚ timeline               β”‚
 οŒ’ ξ‚°  ~ ξ‚°                                                 

But after a reboot as far as i can tell its still booting from the @ snapshot

findmnt /                                                                                                                                                  ξ‚² βœ” 
TARGET SOURCE        FSTYPE OPTIONS
/      /dev/sda1[/@] btrfs  rw,relatime,space_cache=v2,subvolid=329,subvol=/@

I have changed the fstab and the default/grub to remove the subvol=X, its supposed to boot from the default subvolume now?

sudo cat /etc/default/grub                                                                                                                                 ξ‚² βœ” 
# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="root=UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 quiet splash udev.log_priority=3"
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 'menu' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=hidden

# 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 'videoinfo'
GRUB_GFXMODE=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-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/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"

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

fstab

sudo cat /etc/fstab                                                                                                                                        ξ‚² βœ” 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /              btrfs   defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /home          btrfs   subvol=/@home,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/cache     btrfs   subvol=/@cache,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/log       btrfs   subvol=/@log,defaults 0 0

But it still boots from @ ?

How are
sudo snapper rollback
sudo btrfs subvolume set-default

supposed to work?

Slightly off-topic, but, I’ll just mention that I (still) don’t use BTRFS nor have I educated myself on the topic beyond basics. However, if I ever do ever decide to use it, I can most likely just refer to your threads for related information; so, keep learning. :wink:

Cheers.

2 Likes

LOL, you made me chuckle.

You are absolutely correct. I am just about at that point where I throw in the towel and say β€œthis is ridiculous, it’s just too damned complex and user unfriendly.” (although I have never done that before, which is my problem).

I’m happy with btrfs, timeshift & btrfs-assistant, so worst comes to the worst and I shall just use a front-end like timeshift and leave the understanding of the minutiae to others.

I get board… tinker…and boom goes the system ^^
I once heard this quote:
β€œWhich to you value the most, your security and privacy, use linux. Your time & sanity, use windows/apple!”

2 Likes

You might find it helpful to read some of these threads:

There some things are done manual, that snapper also does.

:footprints:
P.S.: I use Snapper to create snapshots, but I do my rollbacks manually. This is necessary because I use an exotic btrfs subvolume layout.

2 Likes

You need subvol, and it shouldn’t have to change. But subvolid you will want to get rid of.

The Snapper rollback command sets this for you.

But Snapper does rely on get-default for the current live environment.

i still dont know what fstab and grub are supposed to be to have the system boot from the default subvolume, because it does not at the moment.

I know snapper changes the default subvolume and i can also manually change the default subvolume but the system does not boot the default subvolume.

What are these supposed to be to get it to do so?

UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /              btrfs   defaults 0 0
GRUB_CMDLINE_LINUX_DEFAULT="root=UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 quiet splash udev.log_priority=3"

Is that part of your fstab? Where is subvol=@ and the others?

I don’t think this is the problem. But I don’t put a root UUID here.

The file you want to verify UUIDs, boot paths/volumes, etc. They will be hardcoded in /boot/grub/grub.cfg. (Which, as you probably already know, is regenerated every update-grub.)

e.g, For me, my first menu entry is:

grep -m 2 -E 'vmlinuz|initrd' /boot/grub/grub.cfg
        linux   /@/boot/vmlinuz-6.6-x86_64 root=UUID=310e0472-f96e-485c-8fa1-585bcccfb624 rw rootflags=subvol=@  quiet nosplash apparmor=1 security=apparmor resume=UUID=9f5a3a86-21ad-4bcc-9db7-2377aee3d05c udev.log_priority=3 amd_iommu=on vfio-pci.ids=10de:2216,10de:1aef video=efifb:off isolcpus=6-11,18-23 fbcon=rotate:1
        initrd  /@/boot/amd-ucode.img /@/boot/initramfs-6.6-x86_64.img

As far as I can tell from what you posted in the original question: everything looks fine?

snapper sets the default subvolume - under the hood, it probably uses btrfs subvolume set-default. That means that fstab doesn’t need to be changed at all, because it picks the default that snapper sets. The findmnt command’s output is correct, because /@ refers to the default subvolume, not the root subvolume.

If you want to verify which subvolume is currently mounted on /, then you want to use btrfs subvolume show /, which will give you the correct subvolume info. Hopefully that helps.

sudo btrfs subvolume list /                                                                                                                         ξ‚² βœ” ξ‚² 3s ο‰’ 
ID 256 gen 1411 top level 5 path @_backup_2024-07-06T18:44:19.339Z_xxxx
ID 257 gen 1059 top level 5 path @home_backup_2024-07-06T10:35:08.774Z_backup-home
ID 258 gen 1400 top level 5 path @cache
ID 259 gen 1662 top level 5 path @log
ID 263 gen 1661 top level 329 path .snapshots
ID 265 gen 213 top level 263 path .snapshots/2/snapshot
ID 270 gen 256 top level 263 path .snapshots/7/snapshot
ID 271 gen 1637 top level 315 path @home/.snapshots
ID 272 gen 270 top level 271 path @home/.snapshots/1/snapshot
ID 275 gen 400 top level 271 path @home/.snapshots/2/snapshot
ID 277 gen 440 top level 271 path @home/.snapshots/4/snapshot
ID 278 gen 470 top level 271 path @home/.snapshots/5/snapshot
ID 295 gen 835 top level 271 path @home/.snapshots/13/snapshot
ID 300 gen 908 top level 271 path @home/.snapshots/14/snapshot
ID 301 gen 963 top level 271 path @home/.snapshots/15/snapshot
ID 303 gen 1002 top level 271 path @home/.snapshots/16/snapshot
ID 304 gen 984 top level 263 path .snapshots/23/snapshot
ID 309 gen 1128 top level 5 path @home_backup_2024-07-06T17:06:10.052Z_restroe-backup
ID 311 gen 1044 top level 271 path @home/.snapshots/17/snapshot
ID 314 gen 1125 top level 271 path @home/.snapshots/18/snapshot
ID 315 gen 1662 top level 5 path @home
ID 317 gen 1182 top level 271 path @home/.snapshots/19/snapshot
ID 318 gen 1188 top level 271 path @home/.snapshots/20/snapshot
ID 319 gen 1199 top level 271 path @home/.snapshots/21/snapshot
ID 320 gen 1270 top level 263 path .snapshots/32/snapshot
ID 321 gen 1311 top level 5 path @_backup_2024-07-06T19:16:14.565Z_ffff
ID 323 gen 1269 top level 263 path .snapshots/34/snapshot
ID 326 gen 1280 top level 271 path @home/.snapshots/22/snapshot
ID 327 gen 1329 top level 263 path .snapshots/37/snapshot
ID 329 gen 1662 top level 5 path @
ID 331 gen 1328 top level 263 path .snapshots/40/snapshot
ID 332 gen 1329 top level 263 path .snapshots/41/snapshot
ID 334 gen 1376 top level 271 path @home/.snapshots/23/snapshot
ID 335 gen 1376 top level 263 path .snapshots/43/snapshot
ID 336 gen 1399 top level 263 path .snapshots/44/snapshot
ID 338 gen 1426 top level 263 path .snapshots/46/snapshot
ID 339 gen 1440 top level 271 path @home/.snapshots/24/snapshot
ID 340 gen 1440 top level 263 path .snapshots/47/snapshot
ID 341 gen 1461 top level 263 path .snapshots/48/snapshot
ID 342 gen 1479 top level 263 path .snapshots/49/snapshot
ID 343 gen 1492 top level 263 path .snapshots/50/snapshot
ID 344 gen 1491 top level 263 path .snapshots/51/snapshot
ID 345 gen 1492 top level 263 path .snapshots/52/snapshot
ID 346 gen 1497 top level 263 path .snapshots/53/snapshot
ID 347 gen 1540 top level 271 path @home/.snapshots/25/snapshot
ID 348 gen 1592 top level 263 path .snapshots/54/snapshot
ID 349 gen 1591 top level 263 path .snapshots/55/snapshot
ID 350 gen 1592 top level 263 path .snapshots/56/snapshot
ID 351 gen 1600 top level 263 path .snapshots/57/snapshot
ID 352 gen 1609 top level 263 path .snapshots/58/snapshot
ID 353 gen 1623 top level 263 path .snapshots/59/snapshot
ID 354 gen 1624 top level 271 path @home/.snapshots/26/snapshot
ID 355 gen 1625 top level 263 path .snapshots/60/snapshot
ID 356 gen 1660 top level 263 path .snapshots/61/snapshot

the default subvolid is 350 (that is named subvol .snapshots/56/snapshot)

sudo btrfs subvolume get-default /                                                                                                                         ξ‚² βœ” 
ID 350 gen 1592 top level 263 path @/.snapshots/56/snapshot

but its booting subvolume 329 name @

findmnt /                                                                                                                                                  ξ‚² βœ” 
TARGET SOURCE        FSTYPE OPTIONS
/      /dev/sda1[/@] btrfs  rw,relatime,space_cache=v2,subvolid=329,subvol=/@
sudo btrfs subvolume show /                                                                                                                                ξ‚² βœ” 
[sudo] password for greg: 
@
        Name:                   @
        UUID:                   6a21020a-a6bc-9740-b6e8-d5d100e46b80
        Parent UUID:            61f6782b-c287-154e-8e82-0574c2cfbc46
        Received UUID:          -
        Creation time:          2024-07-06 20:16:14 +0100
        Subvolume ID:           329
        Generation:             1661
        Gen at creation:        1309
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Send transid:           0
        Send time:              2024-07-06 20:16:14 +0100
        Receive transid:        0
        Receive time:           -
        Snapshot(s):
                                @/.snapshots/40/snapshot
                                @/.snapshots/43/snapshot
                                @/.snapshots/44/snapshot
                                @/.snapshots/46/snapshot
                                @/.snapshots/47/snapshot
                                @/.snapshots/48/snapshot
                                @/.snapshots/49/snapshot
                                @/.snapshots/50/snapshot
                                @/.snapshots/51/snapshot
                                @/.snapshots/53/snapshot
                                @/.snapshots/54/snapshot
                                @/.snapshots/55/snapshot
                                @/.snapshots/57/snapshot
                                @/.snapshots/58/snapshot
                                @/.snapshots/59/snapshot
                                @/.snapshots/60/snapshot
                                @/.snapshots/61/snapshot
        Quota group:            n/a

this is my /etc/default/grub in full

sudo cat /etc/default/grub                                                                                                                                 ξ‚² βœ” 
# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="root=UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 quiet splash udev.log_priority=3"
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 'menu' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=hidden

# 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 'videoinfo'
GRUB_GFXMODE=1024x768

# 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-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/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"

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

and the fstab in full

sudo cat /etc/fstab                                                                                                                                        ξ‚² βœ” 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /              btrfs   defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /home          btrfs   subvol=/@home,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/cache     btrfs   subvol=/@cache,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/log       btrfs   subvol=/@log,defaults 0 0

what have i got to do?

To put it more clearly, change that :arrow_up:.
To this: :arrow_down:

UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 / btrfs subvol=/@,defaults 0 0

Your /boot/grub/grub.cfg has zero entries to boot from. As your fstab isn’t pointing to the root volume. Update grub after fixing it.

but thats what it was before and it didn’t work. That tells it use the subvolume /@ which is number 329 in my list atm, which is what its already doing. The manuals etc say if you want it to boot from the default that you should not point to a specific subvolume, you should either point to the volume root / or not point to anything at all, then it will use the default. That was how i thought it worked?

I shall certainly go and try it.

ok i tried but no luck :slightly_frowning_face:

this is after i changed the fstab, update-grub, reboot.

its booting from the wrong (not default) ID?

 οŒ’ ξ‚°  ~ ξ‚° findmnt /                                                                                                                                           ξ‚² βœ” ξ‚² 4s ο‰’ 
TARGET SOURCE        FSTYPE OPTIONS
/      /dev/sda1[/@] btrfs  rw,relatime,space_cache=v2,subvolid=329,subvol=/@
 οŒ’ ξ‚°  ~ ξ‚° sudo btrfs subvolume get-default /                                                                                                                         ξ‚² βœ” 
ID 350 gen 1592 top level 263 path @/.snapshots/56/snapshot
 οŒ’ ξ‚°  ~ ξ‚° sudo cat /etc/fstab                                                                                                                                        ξ‚² βœ” 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /              btrfs   subvol=/@,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /home          btrfs   subvol=/@home,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/cache     btrfs   subvol=/@cache,defaults 0 0
UUID=c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /var/log       btrfs   subvol=/@log,defaults 0 0

If i try it manually by mounting the btrfs block device without the subvol it does work! It successfully mounts the default subvolume.

sudo mount -U c863c9b5-d87a-4196-bdfb-5002d20e4ce0 /mnt                                                                                                 ξ‚² 32 ✘ 
 οŒ’ ξ‚°  ~ ξ‚° findmnt /mnt                                                                                                                                               ξ‚² βœ” 
TARGET SOURCE                               FSTYPE OPTIONS
/mnt   /dev/sda1[/@/.snapshots/56/snapshot] btrfs  rw,relatime,space_cache=v2,subvolid=350,subvol=/@/.snapshots/56/snapshot

Did you already read [HowTo] Manual rollback with btrfs ?

What i do when i rollback:

  • mount / of btrfs (to /mnt/…)
  • move /@ to β€œ/@old”
  • create a writable snapshot of /@my_snapshot_that_i_want_to_restore to /@
  • change the β€œdefault” so it points to the new /@ (may be optional)
  • reboot into the system

A few days later i delete snapshot β€œ/@old”


  1. I always keep the readonly-snapshot that is my good state
    So i can do any number of rollbacks
  2. I always use /@ as my actuall system
    This prevents problems with nested snapshots and snapper

:footprints:

I understand that, but it’s not really what I’m asking. I know I could just send a RW snapshot to @ etc., but I want to know why the default Btrfs snapshot won’t boot as it should?

This is the purpose of the default snapshot, this is why snapper creates a ro copy of the rollback snapshot and then creates a rw copy of it and then sets it as the default snapshot, because it is supposed to then boot from it.

I want to understand it and possibly use it.

https://wiki.archlinux.org/title/btrfs

Mounting subvolume as root

To use a subvolume as the root mountpoint, either make it the default subvolume, or specify the subvolume via a kernel parameter using rootflags=subvol=/path/to/subvolume. Edit the root mountpoint in /etc/fstab and specify the mount option subvol=. Alternatively, the subvolume can be specified with its id, rootflags=subvolid=objectid as kernel parameter and subvolid=objectid as mount option in /etc/fstab. It is preferable to mount using subvol=/path/to/subvolume, rather than the subvolid, as the subvolid may change when restoring #Snapshots, requiring a change of mount configuration, or else the system will not boot.
Changing the default sub-volume

The default sub-volume is mounted if no subvol= mount option is provided. To change the default subvolume, do:

https://btrfs.readthedocs.io/en/latest/btrfs-subvolume.html#man-subvolume-set-default

set-default [| ]

Set the default subvolume for the (mounted) filesystem.

Set the default subvolume for the (mounted) filesystem at path. This will hide the top-level subvolume (i.e. the one mounted with subvol=/ or subvolid=5). Takes action on next mount.

http://snapper.io/manpages/snapper.html

rollback [options] [number]

Creates two new snapshots and sets the default subvolume. Per default the system boots from the default subvolume of the root filesystem. The exact actions depend on whether a number is provided or not:

    Without a number, a first read-only snapshot of the default subvolume is created. A second read-write snapshot of the current system is created. The system is set to boot from the second snapshot.

    With a number, a first read-only snapshot of the current system is created. A second read-write snapshot is created of number. The system is set to boot from the second snapshot.

Rollback is only supported with btrfs and requires a properly configured system.

Then you have to look at Suse (where snapper comes from as far as I know). At least there is a lot of information there.

I guess, no one can help you here.

You shouldn’t do it for Manjaro and Arch based distros, but it only works for OpenSuse.

If you want to revert back to the default subvolume ID 5 (FS_TREE), here is a solution:

$ sudo btrfs subvolume get-default @
ID 352 gen 3478 top level 262 path @/.snapshots/79/snapshot
$ sudo mount -t btrfs -o subvol=/ /dev/disk/by-uuid/c863c9b5-d87a-4196-bdfb-5002d20e4ce0  /mnt
$ sudo btrfs subvolume set-default /mnt/
$ sudo btrfs subvolume get-default /
ID 5 (FS_TREE) 

Then fix your fstab:


If you want to learn how to manually restore a snapshot in the default nested Snapper layout, follow the instructions:

No i was trying to follow the wikis and manuals saying that whatever btrfs default snapshot is set should be the one it boots to, not the (FS_TREE) the very top level but a default subvolume.

I dont even think the very top level is called a β€œsubvolume” its the top level not a sub level. maybe, i dont really know.

Thats all i wanted to know. I can only go by what i am reading in the snapper manual, the btrfs manuals, searching the net etc.
Now you have said that you can not do this in Manjaro/Arch then so be it, that answers my questions. I can do a rollback manually no problem, i just wanted to know why everything was saying you should be able to do what im asking about.

So to sum up what you are all saying is that

  • snapper rollback does not and can not work on Arch/manjaro and also
  • btrfs subvolume set-default has no function at all on Arch/Manjaro either.

No problems, Thank you.

snapper rollback is hard-coded and requires a specific Btrfs layout + boot config (OpenSuse layout). But it only rolls back a root subvolume from boot, it can’t rollback any other subvolume like @home in OpenSuse.

If I remember correctly, when restoring a home snapshot in OpenSuse, YasT as OpenSuse tool copies every file from a home snapshot to the home subvolume like rsync for some stability reason (subvolume ID remains unchanged). OpenSuse never uses snapper rollback for any random subvolume in OpenSuse layout except the root subvolume from boot.

That’s why snapper rollback is inflexible.

The getter/setter method has no function, but only serves as info to tell another tool what to do.

Ok, that cool. I was never asking about other subvolumes like @home i was specifically questioning about the root rollback and booting/mounting root from the default subvolume.

It seems to be that you are all saying that it is not something for distros other than OpenSuse.

I shall (well already have) move on to take a look at btrbk and after that i can decide what i want to use and how i want to set it all up.

Timeshift
snapper
btrfs-assistant
btrbk
btrfs-progs
btrfsmaintenance

None are great, not as a single point of use, not to do local and remote copies of snapshots, auto timeline removal (local and remote), with simple rollback and grub menu integration, but between them all and some of my own scripts i will be ok. Just hope that when it comes time for an emergency i can remember what the hell it was all about and how to use it :confused:

Thx all.

A look into the forum will help you anytime :wink:

For external btrfs-snapshot-backup there also is BackSnap :wink: