Installer mounts the default subvolume on BTRFS

Calamares mounts the default subvolume instead of the root subvolume on BTRFS if I choose a BTRFS partition as root partition and choose not to format it. Here is what happens:

I have 2 BTRFS partitions. One of them multiple linux distributions seperated by subvolumes like this, the other is for testing:
/@
/@/.snapshots
/@/.snapshots/1/snapshot (openSUSE root)(default subvolume)
/@/var , /@/srv … (openSUSE contains fstab entries for these and manually mounts them)
/@/arch (Arch Linux root)
/@/mint (Linux Mint root)
/@/fedora (Fedora root)

If my setup looks insane, I admit that it is not normal, yet I am not the only one who does this :slight_smile:

While I initially tried to install EndeavourOS, I had renamed /@ to /linux so installer would create its own subvolumes like /@, /@home and not touch the existing subvolumes. Instead, it mounted /linux/.snapshots/1/snapshot (the default subvolume) and tried to create its subvolumes there and installation failed at a later stage.

I tried to reproduce the behavior in the dummy partition with the subvolumes
/linux/.snapshots/1/snapshot (default)
/linux/
/linux/.snapshots

  1. Installer mounts the dummy partition. There is no -o subvol=/ so default subvolume is mounted.
00:06:49 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("mount", "-t", "btrfs", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/") 
    ..  Finished. Exit code: 0 
  1. Installer creates new subvolumes under the default subvolume. So there are subvolumes like
    /linux/.snapshots/1/snapshot/@
    /linux/.snapshots/1/snapshot/@home
Create subvolume '/tmp/calamares-root-pj5s76nn/@'
Create subvolume '/tmp/calamares-root-pj5s76nn/@home'
Create subvolume '/tmp/calamares-root-pj5s76nn/@cache'
Create subvolume '/tmp/calamares-root-pj5s76nn/@log'
  1. Instaler looks for these subvolumes at the root of the partition and fails.
Running "env" ("mount", "-t", "btrfs", "-o", "subvol=/@,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/") 
    ..  Target cmd: ("mount", "-t", "btrfs", "-o", "subvol=/@,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/") Exit code: 32 output:
 mount: /tmp/calamares-root-pj5s76nn: mount(2) system call failed: No such file or directory.
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("udevadm", "settle") 
    ..  Finished. Exit code: 0 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("sync") 
    ..  Finished. Exit code: 0 
WARNING: [PYTHON JOB]: "Cannot mount /dev/sda10" 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("mount", "-t", "btrfs", "-o", "subvol=/@home,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/home") 
    ..  Target cmd: ("mount", "-t", "btrfs", "-o", "subvol=/@home,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/home") Exit code: 32 output:
 mount: /tmp/calamares-root-pj5s76nn/home: mount(2) system call failed: No such file or directory.
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("udevadm", "settle") 
    ..  Finished. Exit code: 0 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("sync") 
    ..  Finished. Exit code: 0 
WARNING: [PYTHON JOB]: "Cannot mount /dev/sda10" 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("mount", "-t", "btrfs", "-o", "subvol=/@cache,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/var/cache") 
    ..  Target cmd: ("mount", "-t", "btrfs", "-o", "subvol=/@cache,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/var/cache") Exit code: 32 output:
 mount: /tmp/calamares-root-pj5s76nn/var/cache: mount(2) system call failed: No such file or directory.
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("udevadm", "settle") 
    ..  Finished. Exit code: 0 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("sync") 
    ..  Finished. Exit code: 0 
WARNING: [PYTHON JOB]: "Cannot mount /dev/sda10" 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("mount", "-t", "btrfs", "-o", "subvol=/@log,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/var/log") 
    ..  Target cmd: ("mount", "-t", "btrfs", "-o", "subvol=/@log,", "/dev/sda10", "/tmp/calamares-root-pj5s76nn/var/log") Exit code: 32 output:
 mount: /tmp/calamares-root-pj5s76nn/var/log: mount(2) system call failed: No such file or directory.
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("udevadm", "settle") 
    ..  Finished. Exit code: 0 
00:06:50 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
    Running "env" ("sync") 
    ..  Finished. Exit code: 0 
WARNING: [PYTHON JOB]: "Cannot mount /dev/sda10" 

Then the installer continues and fails with error ERROR: Installation failed: "Failed to unpack image \"/run/archiso/bootmnt/arch/x86_64/airootfs.sfs\"" .. - message: "Failed to unpack image \"/run/archiso/bootmnt/arch/x86_64/airootfs.sfs\"" .. - details: rsync failed with error code 11. Full log: http://ix.io/3xRf

Solution would be adding -o subvol=/ to the command in (1). Even if I had tried to install the os to a partition with other operating systems, the intended behaviour of the installer is to mount the root subvolume and create other subvolumes there, not at somewhere else so I recommend this change.

Calamares doesn’t support what you are trying to do.

I think support would have to be added to Calamares itself to support that use case. You might consider submitting an MR upstream.

Alternatively, just set the default subvolume to be the root before you install :wink:

It kind of does. :scream: Out of curiosity, why did you put everything under @? I do something somewhat similar to what you are doing but I have things like fedora-root at the root of the partition.

I did that later but expected the installer to mount the root subvolume because

I am sending these posts from a successful install :wink:

To be able to move everything at once, just in case.
Weirdly, openSUSE does not mount them. It relies on default subvolume for finding where the root is and mounts other predefined subvolumes (like @/var) in fstab. If a subvolume is not in fstab, it does not appear so it is entirely safe to put them under @.

1 Like