Problems with refind-btrfs snapshots

Hello everyone; I have installed Endeavour OS on this machine:

xxxxxxxxxxx@xxxxxxxxxxx-80eu ~]$ fastfetch
                     ./o.                   XXXXXXXXXXXXXXXXXXXXXX
                   ./sssso-                 ------------------------
                 `:osssssss+-               OS: EndeavourOS x86_64
               `:+sssssssssso/.             Host: 80EU (Lenovo B50-70)
             `-/ossssssssssssso/.           Kernel: Linux 6.12.10-arch1-1
           `-/+sssssssssssssssso+:`         Uptime: 13 mins
         `-:/+sssssssssssssssssso+/.        Packages: 1105 (pacman)
       `.://osssssssssssssssssssso++-       Shell: bash 5.2.37
      .://+ssssssssssssssssssssssso++:      Display (SDC3652): 1366x768 @ 60 Hz in 16" [Built-in]
    .:///ossssssssssssssssssssssssso++:     DE: KDE Plasma 6.2.5
  `:////ssssssssssssssssssssssssssso+++.    WM: KWin (Wayland)
`-////+ssssssssssssssssssssssssssso++++-    WM Theme: Breeze
 `..-+oosssssssssssssssssssssssso+++++/`    Theme: Breeze (Dark) [Qt], Breeze-Dark [GTK2], Breeze [GTK3]
   ./++++++++++++++++++++++++++++++/:.      Icons: breeze-dark [Qt], breeze-dark [GTK2/3/4]
  `:::::::::::::::::::::::::------``        Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4]
                                            Cursor: breeze (24px)
                                            Terminal: konsole 24.12.1
                                            CPU: Intel(R) Core(TM) i3-4030U (4) @ 1.80 GHz
                                            GPU: Intel Haswell-ULT Integrated Graphics Controller @ 1.00 GHz ]
                                            Memory: 1.52 GiB / 11.60 GiB (13%)
                                            Swap: Disabled
                                            Disk (/): 7.75 GiB / 475.93 GiB (2%) - btrfs
                                            Local IP (wlan0): xxxxxxxxxxxxxxxxxxxxxx
                                            Battery (PABAS0241231): 100% [AC Connected]
                                            Locale: it_IT.UTF-8

My purpose is to have the system create snapshots from which to boot ,in case of a crash, via refind. I will tell you what I did. I installed refind despite having only one OS and modified refind.conf by inserting the following block:

menuentry "Endeavour OS"  {
        icon    /EFI/refind/icons/os_endeavouros.png
        volume   "VOLFS"
        loader   @/boot/vmlinuz-linux
        initrd   @/boot/initramfs-linux.img
        options   "root=PARTUUID=93622fa8-49e9-4ccf-8a24-0a85eba0fc5b rw rootflags=subvol=@ quiet splash udev.log_priority=3"
        submenuentry "Boot using fallback initramfs" {
        initrd @/boot/initramfs-linux-fallback.img
        }
        submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
        }
}


the entry “root” is justified because:

sudo blkid
[sudo] password di xxxxxxxxx:
/dev/sda2: LABEL="VOLFS" UUID="ce5492b6-2a24-49b8-8f6a-8befe130db4c" UUID_SUB="a8c91a7a-cd0e-420b-a6b8-3dfeb7cb18f5" BLOCK_SIZE="4096" TYPE="btrfs" PARTLABEL="endeavouros" PARTUUID="93622fa8-49e9-4ccf-8a24-0a85eba0fc5b"

Having done that ,I got an extra entry in the refind boot menu, which ,if selected, always starts Endeavour with the previous “options”; at this point I install refind-btrfs . Here the problems begin: to configure it I modified /etc/refind-btrfs.conf. In particular: in the block

# esp_uuid = <string>
## Explicitly defined ESP's Part-UUID which can be used in case the ESP itself
## cannot be automatically located on the system (for whatever reason).
## This option is, by default, defined as an empty UUID which means that it is
## ignored.

esp_uuid = "35c14e60-4dfb-404d-97ee-5e7ffa5fe574"

I entered esp_uuid which is the Part-UUID of ESP, which is basically /dev/sda1; as for the “[[snapshot-search]]” part then, after many attempts , I entered

[[snapshot-search]]
## directory = "/.snapshots"
directory = "/mnt/timeshift/timeshift-btrfs/snapshots"
is_nested = false
max_depth = 4

“directory” is justified in that the snapshots are ( by default ) in /timeshift-btrfs/snapshots , which however refind-btrfs does not see. So I mounted “/” to “/mnt/timeshift” as seen from fstab which I attach:


UUID=BD11-2FB6                            /boot/efi      vfat    fmask=0137,dmask=0027 0 2
UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c /              btrfs   subvol=/@,noatime,compress=zstd 0 0
UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c /home          btrfs   subvol=/@home,noatime,compress=zstd 0 0
UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c /var/cache     btrfs   subvol=/@cache,noatime,compress=zstd 0 0
UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c /var/log       btrfs   subvol=/@log,noatime,compress=zstd 0 0
UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c /mnt/timeshift btrfs   subvol=/,rw 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

At this point refind-btrfs sees the folder /mnt/timeshift/timeshift-btrfs/snapshots , and runs without error to the end, creating the snapshots. As expected, at boot refind it presents a new entry for some snapshots ,from which to boot, prior to the last update.
By booting from the last of these snapshots, however, the system is not stable: once it starts, it fails to run timeshift properly, and when you try to update the system, pacman -Syu fails ( because precisely timeshift, which is called, crashes).
I report the tree structure of the partition “/”

live@live:/media/live/VOLFS$ ls -la
totale 16
drwxr-xr-x  1 root root  62 19 gen 14.55 .
drwxr-x---+ 3 root root  60 21 gen 14.35 ..
drwxr-xr-x  1 root root 122 19 gen 08.50 @
drwxr-xr-x  1 root root 118 19 gen 08.58 @cache
drwxr-xr-x  1 root root  18 19 gen 08.59 @home
drwxr-xr-x  1 root root 358 20 gen 18.11 @log
drwxr-xr-x  1 root root 210 20 gen 17.35 timeshift-btrfs

live@live:/media/live/VOLFS$ cd timeshift-btrfs
live@live:/media/live/VOLFS/timeshift-btrfs$ ls -la
totale 16
drwxr-xr-x 1 root root 210 20 gen 17.35 .
drwxr-xr-x 1 root root  62 19 gen 14.55 ..
drwxr-xr-x 1 root root 114 20 gen 17.35 snapshots
drwxr-xr-x 1 root root   0 20 gen 17.35 snapshots-boot
drwxr-xr-x 1 root root   0 20 gen 17.35 snapshots-daily
drwxr-xr-x 1 root root   0 20 gen 17.35 snapshots-hourly
drwxr-xr-x 1 root root   0 20 gen 17.35 snapshots-monthly
drwxr-xr-x 1 root root 152 20 gen 17.35 snapshots-ondemand
drwxr-xr-x 1 root root   0 20 gen 17.35 snapshots-weekly

cd snapshots
live@live:/media/live/VOLFS/timeshift-btrfs/snapshots$ ls -la
totale 0
drwxr-xr-x 1 root root 114 20 gen 17.35 .
drwxr-xr-x 1 root root 210 20 gen 17.35 ..
drwxr-xr-x 1 root root  20 19 gen 18.40 2025-01-19_19-40-42
drwxr-xr-x 1 root root  20 19 gen 18.44 2025-01-19_19-44-13
drwxr-xr-x 1 root root  20 20 gen 17.35 2025-01-20_18-35-28


Here is the result of running refind-btrfs

sudo refind-btrfs
Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/sda' using lsblk.
Analyzing the 'refind-btrfs.conf' file.
Initializing the live partition table for device '/dev/sda' using findmnt.
Initializing the physical partition table for device '/dev/sr0' using lsblk.
Initializing the live partition table for device '/dev/sr0' using findmnt.
Found the ESP mounted at '/boot/efi' on '/dev/sda1'.
Found the root partition on '/dev/sda2'.
Searching for snapshots of the '@' subvolume in the '/mnt/timeshift/timeshift-btrfs/snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 3 snapshots of the '@' subvolume.
Searching for the 'refind.conf' file on '/dev/sda1'.
Found 1 boot stanza matched with the root partition.
Initializing the static partition table for subvolume 'timeshift-btrfs/snapshots/2025-01-24_16-31-02/@' from its fstab file.
Initializing the static partition table for subvolume 'timeshift-btrfs/snapshots/2025-01-24_16-30-32/@' from its fstab file.
Initializing the static partition table for subvolume 'timeshift-btrfs/snapshots/2025-01-23_16-17-39/@' from its fstab file.
Found 3 snapshots for addition.
Found 3 snapshots for removal.
Modifying the '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-24_16-31-02/@/etc/fstab' file.
Modifying the '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-24_16-30-32/@/etc/fstab' file.
Modifying the '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-23_16-17-39/@/etc/fstab' file.
WARNING: The '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-20_18-35-28/@' directory is not a subvolume.
WARNING: The '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-19_19-40-42/@' directory is not a subvolume.
WARNING: The '/mnt/timeshift/timeshift-btrfs/snapshots/2025-01-19_19-44-13/@' directory is not a subvolume.
Writing to the 'btrfs-snapshot-stanzas/volfs_vmlinuz-linux.conf' file.

and here is the timeshift msg when run from the terminal (when the system starts from a snapshot):

[xxxxxxxx@xxxxxxxx-80eu ~]$ sudo timeshift --list
[sudo] password di francesco:
Mounted '/dev/sda2' at '/run/timeshift/1661/backup'
Errore di segmentazione

Does anyone have an idea how to modify the procedure ?

Keep in mind, one of the critical issues with Timeshift is that it’s snapshots are read/write. This means if you boot a snapshot, doing something like updating the system is a relatively bad idea.

Can you boot off a snapshot and share the output of findmnt --real and sudo brtrfs sub list /

Blockquote
Keep in mind, one of the critical issues with Timeshift is that it’s snapshots are read/write. This means if you boot a snapshot, doing something like updating the system is a relatively bad idea.

What else should be done if an update crashes the system ?
Here are the results of:

$ findmnt --real
TARGET SOURCE FSTYPE     OPTIONS
/      /dev/sda2[/timeshift-btrfs/snapshots/2025-01-24_16-31-02/@]
│             btrfs      rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=270,subvol=/timeshift-btrfs/snapshots/2
├─/mnt/timeshift
│      /dev/sda2
│             btrfs      rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/
├─/var/cache
│      /dev/sda2[/@cache]
│             btrfs      rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@cache
├─/run/user/1000/doc
│      portal fuse.porta rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
├─/home
│      /dev/sda2[/@home]
│             btrfs      rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home
├─/var/log
│      /dev/sda2[/@log]
│             btrfs      rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@log
└─/boot/efi
       /dev/sda1
              vfat       rw,relatime,fmask=0137,dmask=0027,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro

and

 sudo btrfs sub list /
ID 256 gen 747 top level 5 path @
ID 257 gen 757 top level 5 path @home
ID 258 gen 749 top level 5 path @cache
ID 259 gen 757 top level 5 path @log
ID 260 gen 25 top level 256 path @/var/lib/portables
ID 261 gen 25 top level 256 path @/var/lib/machines
ID 268 gen 672 top level 5 path timeshift-btrfs/snapshots/2025-01-23_16-17-39/@
ID 269 gen 672 top level 5 path timeshift-btrfs/snapshots/2025-01-24_16-30-32/@
ID 270 gen 757 top level 5 path timeshift-btrfs/snapshots/2025-01-24_16-31-02/@

When you boot into a snapshot, you aren’t restoring the snapshot, you are literally booting into it temporarily. When you boot a snapshot, the only thing you should do is restore the snapshot and then reboot.

Any changes you make while booted into the snapshot will impact the snapshot itself. This not only make it fairly useless for recovery, but it can be harmful to anything that lives outside the snapshot.(Like the bootloader).

This all looks fine to me, I am not sure exactly why timeshift --list is crashing. For that matter, it isn’t clear if it’s crashing is related to refind-btrfs or something being wrong inside that snapshot.

There are not many people using refind-btrfs with timeshift here.

Blockquote
@dalto
When you boot into a snapshot, you aren’t restoring the snapshot, you are literally booting into it temporarily. When you boot a snapshot, the only thing you should do is restore the snapshot and then reboot.

Agreed @dalto, but how to restore from a snapshot if timeshift doesn’t start ?
Thanks anyway

Does timeshift --list work in the system when not booted from a snapshot?

Also, does it fail in all snapshots, or just that one?

timeshift --list

works in the system non booted from a snapshot. Also it fails in all snapshots (3).

I ran timeshift in debug mode; this is the result:

xxxxxxxx@xxxxxxxxxx-80eu ~]$ sudo timeshift --debug
[sudo] password di xxxxxxxx:
D: Main()
D:
D: Running Timeshift v24.06.6
D:
D: Session log file: /var/log/timeshift/2025-01-29_08-19-36_.log
D: Distribution: EndeavourOS rolling (rolling)
D: DIST_ID: EndeavourOS
D: Main: check_dependencies()
D: Main: add_default_exclude_entries()
D: Main: add_default_exclude_entries(): exit
D: update_partitions()
D: df -T -B1
D: Device: get_disk_space_using_df(): 6
D: Device: get_mounted_filesystems_using_mtab(): 2
D: Device: get_filesystems(): 4
D: partition list updated
D: detect_system_devices()
D: /boot/efi is mapped to device: /dev/sda1, UUID=BD11-2FB6
D: /home is mapped to device: /dev/sda2, UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c, subvol=@home
D: / is mapped to device: /dev/sda2, UUID=ce5492b6-2a24-49b8-8f6a-8befe130db4c, subvol=/timeshift-btrfs/snapshots/2025-01-27_16-05-56/@
D: Searching subvolume for system at path: /
D: Found subvolume: /timeshift-btrfs/snapshots/2025-01-27_16-05-56/@, on device: /dev/sda2
D: Found subvolume: @home, on device: /dev/sda2
D: Found subvolume: @cache, on device: /dev/sda2
D: Found subvolume: @log, on device: /dev/sda2
D: Users: francesco root
D: Encrypted home users:
D: Encrypted home dirs:

D: Encrypted private dirs:

D: Main: load_app_config()
App config loaded: /etc/timeshift/timeshift.json
D: IconManager: init()
D: found images directory: /usr/share/timeshift/images
D: Main(): ok
D: AppConsole: parse_arguments()
D: Main: initialize_repo()
D: backup_uuid=ce5492b6-2a24-49b8-8f6a-8befe130db4c
D: backup_parent_uuid=
D: Setting snapshot device from config file
D: repo: creating from uuid
D: SnapshotRepo: from_uuid(): BTRFS
D: uuid=ce5492b6-2a24-49b8-8f6a-8befe130db4c
D: SnapshotRepo: init_from_device()
D:
D: SnapshotRepo: unlock_and_mount_devices()
D: device=/dev/sda2
D: SnapshotRepo: unlock_and_mount_device()
D: device=/dev/sda2
D: Device: get_mounted_filesystems_using_mtab(): 2
D: ------------------
D: arg=ce5492b6-2a24-49b8-8f6a-8befe130db4c, device=/dev/sda2
D: /var/log
D: /var/cache
D: /mnt/timeshift
D: /home
D: /
D: ------------------
D: Device: get_mounted_filesystems_using_mtab(): 2
Mounted '/dev/sda2' at '/run/timeshift/1655/backup'
D: Searching subvolume for system at path: /run/timeshift/1655/backup/@
D: Found subvolume: @, on device: /dev/sda2
D: Found subvolume: @home, on device: /dev/sda2
D: Found subvolume: @cache, on device: /dev/sda2
D: Found subvolume: @log, on device: /dev/sda2
D: SnapshotRepo: load_snapshots()
D: Querying subvolume info...
D: query_subvolume_id():@
D: btrfs subvolume list '/run/timeshift/1655/backup'
Errore di segmentazione

does this message add anything?

I don’t see anything obvious.

I think you should ask the timeshift team if they know what is going on. Everything in all your output look normal to me.

Okay, I’ll do that.

1 Like

I solved it by replacing timeshift & timeshift-autosnap with snapper & btrfs-assistant , so refind-btrfs produces usable snapshots.
Time-consuming but effective work.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.