Btrfs-assistant not showing snapshots to restore to when booted into a snapshot

~$ inxi
CPU: 14-core (6-mt/8-st) 12th Gen Intel Core i7-12700H (-MST AMCP-)
speed/min/max: 1959/400/4600:4700:3500 MHz Kernel: 6.2.9-zen1-1-zen x86_64
Up: 1d 1m Mem: 3993.2/63989.8 MiB (6.2%) Storage: 2.75 TiB (7.7% used)
Procs: 445 Shell: Zsh inxi: 3.3.26

I'm on vanilla arch, but more than one person said to try posting here.

I set up a btrfs system with snapper, grub-btrfs, and importantly btrfs-assistant. Btrfs-assistant seems to do everything it's supposed to, including restoring snapshots on a live system.

However, when I boot into a snapshot, the "Browse/Restore" section has an empty dropdown meny for "Select target:". In other words, it doesn't show any snapshots, so I can't restore any.

Is this normal? It doesn't seem like the behavior I would expect.


EDIT: Here's some images showing what I see. The first three are on the regular system, the last three are when booted into a snapshot.

If you want snapshots to be taken automatically, you need to set it up. To reproduce the behavior Garuda has (to automatically take snapshots before and after updates) you need to install snap-pac.

Another way to generate snapshots is to enable timeline snapshots, which you can do from Btrfs Assistant. Just tick the checkbox for timeline snapshots and choose your snapshot retention settings (how many hourly, daily, etc you want to keep).

If you want to be able to boot snapshots from Grub, you need to add grub-btrfs-overlayfs to your hooks and rebuild your initramfs as described here: grub-btrfs/initramfs/readme.md at master · Antynea/grub-btrfs · GitHub

Sorry if I was unclear.

Everything works normally, including snapper, grub-btrfs, and btrfs-assistant. This includes creating snapshots, showing them in btrfs-assistant, restoring them with btrfs-assistant on a live system, showing them in grub, being able to boot them.

The thing that is not working as expected is that when booting into a snapshot, btrfs-assistant doesn't show any snapshots to restore. One of the key advertised features of btrfs-assistant is the ability to restore snapshots while booted into a snapshot.

What version of btrfs-assistant are you using?

~$ yay -Q btrfs-assistant
btrfs-assistant 1.8-1

Please, post links and name from the persons :slight_smile:

1 Like

Probably best to open an issue here: Issues · Btrfs Assistant / Btrfs Assistant · GitLab

Be sure to include the output of sudo btrfs sub list / and findmnt --real in the issue report.

3 Likes

I've been through probably a hundred support threads from all over the internet today, I have no idea where or who specifically. I did not say or intend to imply that someone told me specifically to post here, just that people suggest that regular arch users can try to post here. I've seen it more than once :man_shrugging:

I'm not sure if it's an issue with btrfs-assistant. My main interest right now is whether it's normal behavior. It's possible I'm just misinterpreting what's meant by "Restore snapshots in a variety of situations...When booted off a snapshot". It's possible I'm not booting into the snapshot in the way that makes this possible. There are a lot of possibilities I suppose.

Regarding those outputs, do you want them when booted into a snapshot or when?

When booted into my regular system:

~$ sudo btrfs subvol list /
ID 256 gen 309 top level 5 path @_backup_20231004184758045_testsavedbackup
ID 258 gen 386 top level 5 path @log
ID 259 gen 355 top level 5 path @pkg
ID 260 gen 382 top level 5 path @.snapshots
ID 261 gen 22 top level 269 path var/lib/portables
ID 262 gen 23 top level 269 path var/lib/machines
~$ findmnt --real
TARGET    SOURCE                                                  FSTYPE OPTIONS
/         /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@]
                                                                  btrfs  rw,rela
\E2\94\9C\E2\94\80/run/user/1000/doc
\E2\94\82         portal                                                  fuse.p rw,nosu
\E2\94\9C\E2\94\80/var/log
\E2\94\82         /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@log]
\E2\94\82                                                                 btrfs  rw,rela
\E2\94\9C\E2\94\80/.snapshots
\E2\94\82         /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@.snapshots]
\E2\94\82                                                                 btrfs  rw,rela
\E2\94\9C\E2\94\80/boot   /dev/vda1                                               vfat   rw,rela
\E2\94\94\E2\94\80/var/cache/pacman/pkg
          /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@pkg]
                                                                  btrfs  rw,rela

When booted into a snapshot:

~$ sudo btrfs subvol list /
ERROR: not a btrfs filesystem: /
ERROR: can't access '/'
~$ findmnt --real
TARGET                SOURCE                  FSTYPE      OPTIONS
/run/user/1000/doc    portal                  fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
/boot                 /dev/vda1               vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro
/.snapshots           /dev/vda2[/@.snapshots] btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=260,subvol=/@.snapshots
/var/cache/pacman/pkg /dev/vda2[/@pkg]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=259,subvol=/@pkg
/var/log              /dev/vda2[/@log]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=258,subvol=/@log

NOTE: while the issue has happened since I first tried to restore from a snapshot while booted into one, these logs are from after a point where I restored a snapshot while on my regular "live" system after ignoring the warning about mounting things some specific way. So the logs may be misleading if they show you something related to that and you want to use that info to diagnose the problem which was happening before the logs looked like this.

You don’t have an @ subvolume or any snapper snapshots. Is this the full output?

Are you referring to the output from when I'm booted into a snapshot? Yes, that's the full output. I assume that's related to the issue at hand.

Here are images comparing what it looks like on the "real" system (first 3 images) vs on the snapshot (last 3 images): Imgur: The magic of the Internet

What are the contents of /etc/fstab?

~$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/         	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=256,subvol=/@	0 0

# /dev/vda1
UUID=1B68-6A52      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/.snapshots	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=260,subvol=/@.snapshots	0 0

# /dev/vda2
#UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/home     	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=257,subvol=/@home	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/cache/pacman/pkg	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=259,subvol=/@pkg	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/log  	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=258,subvol=/@log	0 0

That warning tells you that if you mount by subvolid in /etc/fstab, restoring a snapshot can cause an unexpected outcome and that you should fix that before proceeding.

If you ignored it and restored anyway, that would leave the system in a strange state. However it shouldn’t cause this:

You literally don’t have any snapshots according to this output. You also don’t have an @ even though it is being shown as having your root filesystem mounted on it.

I left the snapshots out for brevity, it's just a bunch of snapshots. Sorry if that was unhelpful:

~$ sudo btrfs subvol list /
ID 256 gen 309 top level 5 path @_backup_20231004184758045_testsavedbackup
ID 258 gen 411 top level 5 path @log
ID 259 gen 355 top level 5 path @pkg
ID 260 gen 405 top level 5 path @.snapshots
ID 261 gen 22 top level 269 path var/lib/portables
ID 262 gen 23 top level 269 path var/lib/machines
ID 263 gen 79 top level 260 path @.snapshots/1/snapshot
ID 264 gen 134 top level 260 path @.snapshots/2/snapshot
ID 265 gen 156 top level 260 path @.snapshots/3/snapshot
ID 266 gen 197 top level 260 path @.snapshots/4/snapshot
ID 267 gen 242 top level 260 path @.snapshots/5/snapshot
ID 268 gen 307 top level 260 path @.snapshots/6/snapshot
ID 269 gen 414 top level 5 path @
ID 270 gen 322 top level 260 path @.snapshots/7/snapshot
ID 271 gen 324 top level 260 path @.snapshots/8/snapshot
ID 272 gen 331 top level 260 path @.snapshots/9/snapshot
ID 273 gen 333 top level 260 path @.snapshots/10/snapshot
ID 274 gen 338 top level 260 path @.snapshots/11/snapshot
ID 275 gen 339 top level 260 path @.snapshots/12/snapshot
ID 276 gen 345 top level 260 path @.snapshots/13/snapshot
ID 277 gen 362 top level 260 path @.snapshots/14/snapshot
ID 278 gen 378 top level 260 path @.snapshots/15/snapshot
ID 279 gen 404 top level 260 path @.snapshots/16/snapshot

Regarding the restore, it's not the cause of what's happening now but if it would make things simpler I can just re-setup the VM again. It would take about 3 minutes, maybe 5 if I try to delete the @home subvolume (I set it up using archinstall defaults for maximum standardness while I'm experimenting with btrfs and snapshots, and that includes @home by default which I don't want).


EDIT: wtf is @ doing in the middle of my snapshots :rofl::man_shrugging:

That must be related to the restore. I've messed with at least 30 btrfs VMs (and 2 bare metal installs) over the last week and haven't seen that yet, but yesterday was the first time I actually used the btrfs-assistant restore feature because failing getting it to work in snapshots I wanted to see if it worked at all.

Thanks for all the help so far. I'll follow up to any new replies tomorrow.

As you can see, the subvolumes are in order by subvolume ID.

Actually, this may be related to your issue.

This entry from your fstab specifies mounting subvolid=256 at /, which is this subvolume:

As was mentioned, by including values for subvolid in your fstab you may be setting yourself up for unexpected behavior (you are not allowing your system to boot to subvolumes correctly when the subvolume ID has changed, for example when booting a snapshot).

Try removing all of the subvolid=XXX values from your fstab. This value is not needed when you have specified the subvol= value. Then, create new snapshots and test again.

1 Like

OK I removed the subvol ID's from /etc/fstab then rebooted. Here's the real system and the snapshot is below:

~$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/         	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@	0 0

# /dev/vda1
UUID=1B68-6A52      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/.snapshots	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@.snapshots	0 0

# /dev/vda2
#UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/home     	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@home	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/cache/pacman/pkg	btrfs     	rw,relatime,discard=async,space_cache=v2,,subvol=/@pkg	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/log  	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@log	0 0
~$ sudo btrfs subvol list /
[sudo] password for user1: 
ID 256 gen 309 top level 5 path @_backup_20231004184758045_testsavedbackup
ID 258 gen 456 top level 5 path @log
ID 259 gen 355 top level 5 path @pkg
ID 260 gen 454 top level 5 path @.snapshots
ID 261 gen 22 top level 269 path var/lib/portables
ID 262 gen 23 top level 269 path var/lib/machines
ID 263 gen 79 top level 260 path @.snapshots/1/snapshot
ID 264 gen 134 top level 260 path @.snapshots/2/snapshot
ID 265 gen 156 top level 260 path @.snapshots/3/snapshot
ID 266 gen 197 top level 260 path @.snapshots/4/snapshot
ID 267 gen 242 top level 260 path @.snapshots/5/snapshot
ID 268 gen 307 top level 260 path @.snapshots/6/snapshot
ID 269 gen 456 top level 5 path @
ID 270 gen 322 top level 260 path @.snapshots/7/snapshot
ID 271 gen 324 top level 260 path @.snapshots/8/snapshot
ID 272 gen 331 top level 260 path @.snapshots/9/snapshot
ID 273 gen 333 top level 260 path @.snapshots/10/snapshot
ID 274 gen 338 top level 260 path @.snapshots/11/snapshot
ID 275 gen 339 top level 260 path @.snapshots/12/snapshot
ID 276 gen 345 top level 260 path @.snapshots/13/snapshot
ID 277 gen 362 top level 260 path @.snapshots/14/snapshot
ID 278 gen 378 top level 260 path @.snapshots/15/snapshot
ID 279 gen 404 top level 260 path @.snapshots/16/snapshot
ID 280 gen 437 top level 260 path @.snapshots/17/snapshot
ID 281 gen 445 top level 260 path @.snapshots/18/snapshot
ID 282 gen 453 top level 260 path @.snapshots/19/snapshot
~$ findmnt --real
TARGET                  SOURCE                  FSTYPE      OPTIONS
/                       /dev/vda2[/@]           btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=269,subvol=/@
\E2\94\9C\E2\94\80/run/user/1000/doc    portal                  fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
\E2\94\9C\E2\94\80/.snapshots           /dev/vda2[/@.snapshots] btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=260,subvol=/@.snapshots
\E2\94\9C\E2\94\80/var/cache/pacman/pkg /dev/vda2[/@pkg]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=259,subvol=/@pkg
\E2\94\9C\E2\94\80/var/log              /dev/vda2[/@log]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=258,subvol=/@log
\E2\94\94\E2\94\80/boot                 /dev/vda1               vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro

Here are some outputs from a new snapshot:

~$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/         	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@	0 0

# /dev/vda1
UUID=1B68-6A52      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/.snapshots	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@.snapshots	0 0

# /dev/vda2
#UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/home     	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@home	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/cache/pacman/pkg	btrfs     	rw,relatime,discard=async,space_cache=v2,,subvol=/@pkg	0 0

# /dev/vda2
UUID=440938de-36eb-4e4c-baf7-7a42c188fb6f	/var/log  	btrfs     	rw,relatime,discard=async,space_cache=v2,subvol=/@log	0 0
~$ findmnt --real
TARGET                SOURCE                                                               FSTYPE      OPTIONS
/run/user/1000/doc    portal                                                               fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
/.snapshots           /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@.snapshots] btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=260,subvol=/@.snapshots
/var/cache/pacman/pkg /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@pkg]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=259,subvol=/@pkg
/var/log              /dev/disk/by-uuid/440938de-36eb-4e4c-baf7-7a42c188fb6f[/@log]        btrfs       rw,relatime,discard=async,space_cache=v2,subvolid=258,subvol=/@log
/boot                 /dev/vda1

On an unrelated note, you guys have the best forum UI/UX I've ever used. It looks like some other ones but I haven't used them, all I know is this one uses markdown AND shows the reading view right next to the editing view, and shows when others are typing, and shows new replies without refreshing. Just awesome.

Still getting this output in a snapshot on a new fresh install:

~$ sudo btrfs subvol list /
[sudo] password for user1: 
ERROR: not a btrfs filesystem: /
ERROR: can't access '/'
~$ findmnt --real
TARGET   SOURCE                                                   FSTYPE OPTIONS
/run/user/1000/doc
         portal                                                   fuse.p rw,nosu
/.snapshots
         /dev/disk/by-uuid/8421b3f7-7a99-4db1-818b-86762a56b09e[/@.snapshots]
                                                                  btrfs  rw,rela
/home    /dev/disk/by-uuid/8421b3f7-7a99-4db1-818b-86762a56b09e[/@home]
                                                                  btrfs  rw,rela
/var/cache/pacman/pkg
         /dev/disk/by-uuid/8421b3f7-7a99-4db1-818b-86762a56b09e[/@pkg]
                                                                  btrfs  rw,rela
/var/log /dev/disk/by-uuid/8421b3f7-7a99-4db1-818b-86762a56b09e[/@log]
                                                                  btrfs  rw,rela
/boot    /dev/vda1                                                vfat   rw,rela

And on the real system (i.e. not in a snapshot):

~$ findmnt --real
TARGET               SOURCE                  FSTYPE  OPTIONS
/                    /dev/vda2[/@]           btrfs   rw,relatime,discard=async,s
\E2\94\9C\E2\94\80/run/user/1000/doc portal                  fuse.po rw,nosuid,nodev,relatime,us
\E2\94\9C\E2\94\80/.snapshots        /dev/vda2[/@.snapshots] btrfs   rw,relatime,discard=async,s
\E2\94\9C\E2\94\80/home              /dev/vda2[/@home]       btrfs   rw,relatime,discard=async,s
\E2\94\9C\E2\94\80/var/log           /dev/vda2[/@log]        btrfs   rw,relatime,discard=async,s
\E2\94\9C\E2\94\80/var/cache/pacman/pkg
\E2\94\82                    /dev/vda2[/@pkg]        btrfs   rw,relatime,discard=async,s
\E2\94\94\E2\94\80/boot              /dev/vda1               vfat    rw,relatime,fmask=0022,dmas
~$ sudo btrfs subvol list /
ID 256 gen 132 top level 5 path @
ID 257 gen 132 top level 5 path @home
ID 258 gen 131 top level 5 path @log
ID 259 gen 92 top level 5 path @pkg
ID 260 gen 122 top level 5 path @.snapshots
ID 261 gen 17 top level 256 path var/lib/portables
ID 262 gen 18 top level 256 path var/lib/machines
ID 263 gen 118 top level 260 path @.snapshots/1/snapshot
~$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/vda2
UUID=8421b3f7-7a99-4db1-818b-86762a56b09e	/         	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=256,subvol=/@	0 0

# /dev/vda1
UUID=0907-05CE      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro0 2

# /dev/vda2
UUID=8421b3f7-7a99-4db1-818b-86762a56b09e	/.snapshots	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=260,subvol=/@.snapshots	0 0

# /dev/vda2
UUID=8421b3f7-7a99-4db1-818b-86762a56b09e	/home     	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=257,subvol=/@home	0 0

# /dev/vda2
UUID=8421b3f7-7a99-4db1-818b-86762a56b09e	/var/cache/pacman/pkg	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=259,subvol=/@pkg	0 0

# /dev/vda2
UUID=8421b3f7-7a99-4db1-818b-86762a56b09e	/var/log  	btrfs     	rw,relatime,discard=async,space_cache=v2,subvolid=258,subvol=/@log	0 0