Repository navigation
Description
What I'm seeing
I passed --karg console=ttyS0,115200 to bootc install to-filesystem --composefs-backend --bootloader=systemd. The install completes cleanly, but the written Boot Loader Specification (BLS) entry carries no trace of the karg. There's no warning; the machine just comes up without the argument. The identical flag lands correctly via install to-disk, with and without --composefs-backend. Reproduced 3/3 on bootc 1.16.3 (Fedora 44).
The written entry (loader/entries/bootc_fedora-44-1.conf, which the composefs backend places on the ESP):
title Fedora Linux 44 (Forty Four)
version 44
linux /EFI/Linux/bootc_composefs-4fa664fc.../vmlinuz
initrd /EFI/Linux/bootc_composefs-4fa664fc.../initrd
options root=UUID=5ebfe70b-... rw boot=UUID=25f24bf6-... composefs=4fa664fc... systemd.mount-extra=UUID=25f24bf6-...:/boot:auto:ro
sort-key bootc-fedora-0
No console=ttyS0,115200 anywhere. For kargs like console= or LUKS parameters this is a silent boot-behavior change rather than a visible failure, which is why I'm filing it as a bug rather than a docs gap. The install docs also describe to-disk as effectively invoking to-filesystem --karg=root=UUID=..., and show --karg console=ttyS0,115200 as the serial-console example for Type 1 BLS setups (docs/src/bootc-install.md), so I've been reading --karg on to-filesystem as a supported interface.
Reproduction
truncate -s 20G disk.raw
loop=$(sudo losetup -fP --show disk.raw)
sudo sgdisk -n 1:0:+512M -t 1:ef00 -n 2:0:+512M -t 2:8300 -n 3:0:0 -t 3:8300 $loop
sudo mkfs.vfat ${loop}p1 && sudo mkfs.ext4 ${loop}p2 && sudo mkfs.ext4 -O verity ${loop}p3
sudo mkdir -p /mnt/tgt && sudo mount ${loop}p3 /mnt/tgt
sudo mkdir -p /mnt/tgt/boot && sudo mount ${loop}p2 /mnt/tgt/boot
sudo mkdir -p /mnt/tgt/boot/efi && sudo mount ${loop}p1 /mnt/tgt/boot/efi
sudo podman run --rm --privileged --pid=host \
-v /var/lib/containers:/var/lib/containers -v /dev:/dev \
-v /mnt/tgt:/target --security-opt label=type:unconfined_t \
<image with bootc 1.16.3, systemd-boot-unsigned installed> \
bootc install to-filesystem --skip-fetch-check --generic-image \
--composefs-backend --bootloader=systemd \
--karg console=ttyS0,115200 /target
# then inspect the ESP:
sudo cat /mnt/tgt/boot/efi/loader/entries/bootc_fedora-44-1.confWhere I think the plumbing diverges (v1.16.3; same on main)
I went looking for where the karg goes missing. What I found:
install_to_filesystemconstructsRootSetup.kargspurely from the root/boot mount specs,rw, and btrfs subvol args. It never readsstate.config_opts.karg: https://github.com/bootc-dev/bootc/blob/v1.16.3/crates/lib/src/install.rs#L2691-L2721- On the composefs branch, the BLS writer's only source of CLI kargs is that vector (
cmdline_options.extend(&root_setup.kargs)): https://github.com/bootc-dev/bootc/blob/v1.16.3/crates/lib/src/bootc_composefs/boot.rs#L506 to-diskworks becauseinstall_create_rootfsfolds the CLI kargs intoRootSetup.kargsup front: https://github.com/bootc-dev/bootc/blob/v1.16.3/crates/lib/src/install/baseline.rs#L480-L485- Plain (ostree-backend)
to-filesystemalso works, but only becauseinstall_containerindependently re-readsstate.config_opts.kargon top ofRootSetup.kargs, which masks the missing construction on that path: https://github.com/bootc-dev/bootc/blob/v1.16.3/crates/lib/src/install.rs#L1168-L1172 /usr/lib/bootc/kargs.dis unaffected (different consumer:get_kargs_in_rootreads the image directly), and that's the workaround I'm using meanwhile.
Between v1.16.3 and current main the only commit touching these files is the linux-kernel-cmdline crate rename, so I believe the shape is unchanged on main.
Possible fix
Two resolutions would both fit patterns already in the codebase, and I'm happy to send a PR for whichever matches your intent:
- Thread the kargs: fold
state.config_opts.karginto the kargs vector ininstall_to_filesystemjust before theRootSetupconstruction, mirroring what baseline.rs does for to-disk. That fixes the composefs BLS path and removes the asymmetry without touchingsetup_composefs_bls_bootorinstall_container(the ostree path's re-read stays harmless:Cmdline::addskips exact-match duplicates, and to-disk already lives with that same double-read today). - Reject loudly: if kargs on this path are meant to come from
kargs.donly, error out the way the UKI path already does (require_no_kargs_for_uki: "Cannot use externally specified kernel arguments with UKI"), so the drop is at least not silent.
Which way matches the intent for the BLS path?
Activity
composefs/bls: Add user provided kargs