Skip to content

no recognition of proper btrfs layout when using labels in fstab #142

Open

Description

@RouL

Describe the bug
timeshift doesn't recognize proper btrfs layout, if labels are used in fstab instead of UUIDs

To Reproduce

  • setup Ubuntu 22.04 LTS with btrfs and configure the fstab with labels instead of uuids (see below)
  • install timeshift
  • configure timeshift (no error during configuration!)
  • try to make your first snapshot
  • => message indicating unsupported fs layout

doesn't work:

# /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>
LABEL=system       /               btrfs   defaults,noatime,compress=zstd:3,subvol=@       0       1
LABEL=boot         /boot           ext4    defaults                                        0       2
LABEL=ESP          /boot/efi       vfat    umask=0077                                      0       1
LABEL=system       /.swap          btrfs   defaults,noatime,subvol=@swap                   0       2
/.swap/swapfile    none            swap    defaults                                        0       0
LABEL=system       /var/log        btrfs   defaults,noatime,compress=zstd:3,subvol=@log    0       2
LABEL=system       /var/cache      btrfs   defaults,noatime,compress=zstd:3,subvol=@cache  0       2
LABEL=system       /var/tmp        btrfs   defaults,noatime,compress=zstd:3,subvol=@tmp    0       2
LABEL=system       /home           btrfs   defaults,noatime,compress=zstd:3,subvol=@home   0       2

does work:

# /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=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /               btrfs   defaults,noatime,compress=zstd:3,subvol=@       0       1
UUID=3926c20d-4ef1-4448-ab29-5cd84e887994       /boot           ext4    defaults                                        0       2
UUID=F999-ADE8                                  /boot/efi       vfat    umask=0077                                      0       1
UUID=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /.swap          btrfs   defaults,noatime,subvol=@swap                   0       2
/.swap/swapfile                                 none            swap    defaults                                        0       0
UUID=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /var/log        btrfs   defaults,noatime,compress=zstd:3,subvol=@log    0       2
UUID=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /var/cache      btrfs   defaults,noatime,compress=zstd:3,subvol=@cache  0       2
UUID=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /var/tmp        btrfs   defaults,noatime,compress=zstd:3,subvol=@tmp    0       2
UUID=6f975e3c-6fe5-4c5f-81d6-16df041b2a63       /home           btrfs   defaults,noatime,compress=zstd:3,subvol=@home   0       2

output of lsblk -o +LABEL /dev/mmcblk0

NAME        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS                            LABEL
mmcblk0     179:0    0 57,6G  0 disk
├─mmcblk0p1 179:1    0  524M  0 part  /boot/efi                              ESP
├─mmcblk0p2 179:2    0  1,7G  0 part  /boot                                  boot
└─mmcblk0p3 179:3    0 55,4G  0 part                                         cryptsystem
  └─system  253:0    0 55,4G  0 crypt /run/timeshift/backup                  system
                                      /var/tmp
                                      /var/log
                                      /var/cache
                                      /.swap
                                      /home
                                      /var/snap/firefox/common/host-hunspell
                                      /

Expected behavior
proper recognition of of btrfs layout no matter if UUID, LABEL, PARTLABEL, PARTUUID or /dev/[...] is used

System:

  • Ubuntu 22.04 LTS
  • Gnome 42.5
  • Timeshift 21.09.1

Activity

  1. changed the title [-]no recognition of proper fs layout when using labels in fstab[/-] [+]no recognition of proper btrfs fs layout when using labels in fstab[/+] on Feb 7, 2023
  2. changed the title [-]no recognition of proper btrfs fs layout when using labels in fstab[/-] [+]no recognition of proper btrfs layout when using labels in fstab[/+] on Feb 7, 2023
  3. shuuji3 commented on Sep 29, 2023

    @shuuji3

    I also encountered the same issue when using LABEL= for partitions, and It was difficult to spot the actual issue. I wanted to manage the partitions with LABEL since it's more human-readable.

    For reference, a similar issue was reported in the previous repository: teejee2008/timeshift#828.

  4. DJCrashdummy commented on Mar 30, 2026

    @DJCrashdummy

    just my 2 cents: you could use paths as a workaround for labels because they are also human readable and as long as you don't fiddle around with your hardware, they shouldn't change. ...and IIRC Timeshift should work fine with paths. 🤷
    another option would be to still use UUIDs and simply add the Label at the end of each line as a comment. 😁

    @RouL for a btrfs file system any value - except 0 - for <pass> in the 6th column of the /etc/fstab makes no sense.
    BTW: if this is your whole /etc/fstab, i would use tmpfs for /tmp or at least a separate subvolume, to exclude it from the snapshots.

  5. RouL commented on Apr 27, 2026

    @RouL
    Author

    @DJCrashdummy Of course those are working temporary workarounds, but they really should stay temporary. 😁

    About <pass>: Didn't know that, good that you mention it, I'll fix it, when I'm at home and find the time. :)
    About /tmp: Good catch. I believe, I did move it into a subvolume a while ago. But I'll check that, just to be sure.

  6. sklynic commented on Oct 29, 2026

    @sklynic

    I'm using PARTUUIDs and just met this problem. Would love to see a better implementation on parsing fstab.

  7. mskiptr commented on Oct 29, 2026

    @mskiptr

    Since this is the more canonical place for tracking this bug, I am re-posting this here:

    Alright, by staring at the code a bunch I've now found the offending line. The checks here, will consider anything mounted via a LABEL, a PARTLABEL or a PARTUUID to be a "system directory". And that's relevant when building up the sys_subvolumes hashmap, which in turn is what ultimately signals whether the @ and @home subvolumes are present. Otherwise the code path does seem to be mostly alright (besides a few strings which would be set to empty). The rest of the code however appears to assume it's working with either UUIDs or device paths and it also has some special /dev/mapper/ handling. I am not sure how well it would deal with both of those missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions