If a mountPoint has subvolume: "" don't use subvol= arguments.

When testing with a / mountPoint set to subvolume: "" it tried and
failed to mount the subvolume:

    .. Running ("mount", "-t", "btrfs", "-o", "subvol=,", "/dev/sda3", "/tmp/calamares-root-ylvhpxys/")
    .. Target cmd: ("mount", "-t", "btrfs", "-o", "subvol=,", "/dev/sda3", "/tmp/calamares-root-ylvhpxys/") Exit code: 32 output:
 mount: /tmp/calamares-root-ylvhpxys: wrong fs type, bad option, bad superblock on /dev/sda3, missing codepage or helper program, or other error.

This fix makes the following config in mount.conf let us drop out of any
subvolume handling:

btrfsSubvolumes:
    - mountPoint: /
      subvolume: ""
This commit is contained in:
Jeremy Whiting 2023-11-01 19:45:26 -06:00
parent 97da73b170
commit deb35d8b49

View File

@ -298,7 +298,12 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun
mount_option_no_subvol = get_mount_options("btrfs_swap", mount_options, partition)
else:
mount_option_no_subvol = get_mount_options(fstype, mount_options, partition)
mount_option = f"subvol={s['subvolume']},{mount_option_no_subvol}"
# Only add subvol= argument if we are not mounting the entire filesystem
if s['subvolume']:
mount_option = f"subvol={s['subvolume']},{mount_option_no_subvol}"
else:
mount_option = mount_option_no_subvol
subvolume_mountpoint = mount_point[:-1] + s['mountPoint']
mount_options_list.append({"mountpoint": s['mountPoint'], "option_string": mount_option_no_subvol})
if libcalamares.utils.mount(device,