Skip to content

Support bcachefs in filesystem installs and updates - #2661

Open
snizovtsev wants to merge 4 commits into
bootc-dev:mainfrom
snizovtsev:bcachefs
Open

snizovtsev wants to merge 4 commits into
bootc-dev:mainfrom
snizovtsev:bcachefs

Conversation

@snizovtsev

Copy link
Copy Markdown

I've been running bootc with Arch Linux and bcachefs on my home desktop,
which is my main workstation, for a few months. This PR brings support for
existing bcachefs roots, including multi-device filesystems, into bootc.
Related to #2341.

The changes resolve each backing device, search their disks for an ESP,
and recover the filesystem UUID when findmnt cannot provide it. The shared
device discovery also searches all ZFS pool members instead of only the
first one.

Scope

This supports storage prepared outside bootc. install to-disk still
rejects bcachefs before partitioning or formatting and directs users to
install to-filesystem. bcachefs is commonly used across multiple devices
and offers many formatting options. I'd rather leave those storage layout
and formatting choices to the user than add that complexity to bootc.

GRUB installations need a separate /boot on a filesystem GRUB can read,
and a bootupd built against the blockdev crate from this branch: bootupd
0.2.34 as released stops on the colon-separated source. With systemd-boot,
the kernels and boot entries are on the ESP.

Runtime filesystem capability detection, also requested in #2341, is
outside this PR's scope. ZFS installation support will be submitted
separately; this PR includes only the shared device discovery changes.

Testing

I asked for extensive QEMU testing of installation and subsequent updates,
including the paths that previously failed on multi-device roots. The
bcachefs tests used UEFI, three virtio disks and bcachefs-tools 1.39.7, with
the root on /dev/vda:/dev/vdb:/dev/vdc2 and the only ESP on the third disk:

  • composefs with systemd-boot: install to-filesystem without
    --root-mount-spec, boot, bootc switch, bootc upgrade and
    bootc rollback, with reboots between operations. ESP discovery was also
    checked with LoaderDevicePartUUID hidden to exercise the fallback search.
  • ostree with GRUB and a separate ext4 /boot: install, boot,
    bootc switch and bootc rollback, with reboots between operations.
  • The new tmt test passes in the bcachefs VM and fails with
    "No filesystem uuid found in target root" without the UUID fix. It skips
    environments without the bcachefs module or tools.

AI assistance and human review

Most of the implementation was developed by Claude and reviewed by Astra.
I manually read and understand the code being submitted, directed the QEMU
testing above, and requested three or four rounds of cleanup and style
changes before publishing. This work supports my main workstation, and
I've put substantial time into reviewing both the implementation and its
behavior. My few months of daily use provide the motivation and operational
context; the tests above describe the validation of this patch series.

install to-filesystem rejects bcachefs roots as an unknown filesystem.
Recognize bcachefs so externally prepared roots can use this installation
path. Treat fs-verity as unsupported, as for XFS; sealed composefs images
remain unsupported.

Keep install to-disk unsupported and reject bcachefs before partitioning
or formatting. Automatic bcachefs formatting is not implemented, and GRUB
installations require a separate /boot on a filesystem GRUB can read.

Assisted-by: AI
Related: bootc-dev#2341
Signed-off-by: Sergei Nizovtsev <snizovtsev@gmail.com>
Multi-device bcachefs mounts expose a colon-separated source. Passing
strings such as `/dev/nvme0n1p1:/dev/sda:/dev/sdb` directly to lsblk
prevents bootc from discovering the backing devices.

Resolve each member separately and search their disks when locating an
ESP. For installation paths that require one representative device,
prefer a member whose disk has an ESP. Aggregate read-only flags across
the resolved members.

Enumerate all ZFS pool members as well, so ESP discovery is not limited
to the first device listed by zpool. Allow unresolved ZFS leaves, such as
file vdevs, when another block device can be resolved.

Single-device filesystems resolve exactly as before.

Assisted-by: AI
Related: bootc-dev#2341
Signed-off-by: Sergei Nizovtsev <snizovtsev@gmail.com>
findmnt derives a filesystem UUID from a single source device. For a
multi-device bcachefs mount the source is a colon-separated list such as
`/dev/vda:/dev/vdb:/dev/vdc2`, so findmnt reports no UUID and
`install to-filesystem` stops with:

    error: Installing to filesystem: No filesystem uuid found in target root

Every member of the filesystem carries its UUID. When findmnt has none
for a bcachefs root, take it from the backing devices, so the
default `root=UUID=...` argument can be written as for other filesystems.

Assisted-by: AI
Related: bootc-dev#2341
Signed-off-by: Sergei Nizovtsev <snizovtsev@gmail.com>
Format three loop devices as one bcachefs filesystem, with the only ESP
on the disk of the last one, and run `install to-filesystem` on it. The
mount source is then `/dev/loop0:/dev/loop1:/dev/loop2p2`, so the
install only succeeds if bootc resolves the devices one by one, finds
the ESP on the third disk and takes the root UUID from the devices; the
test checks the boot entries on that ESP for `root=UUID=`.

The test runs with the composefs backend and systemd-boot only: there
the kernels and the boot entries are on the ESP, so no bootloader has to
read bcachefs. bcachefs is not in the mainline kernel: without the
module or bcachefs-tools the test is skipped.

Assisted-by: AI
Related: bootc-dev#2341
Signed-off-by: Sergei Nizovtsev <snizovtsev@gmail.com>
@github-actions github-actions Bot added area/install Issues related to `bootc install` area/documentation Updates to the documentation labels Nov 17, 2026
@bootc-bot
bootc-bot Bot requested a review from gursewak1997 November 17, 2026 18:40

This branch has not been deployed

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

Labels

area/documentation Updates to the documentation area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant