mount, store: Handle pre-mounted ESP in status and upgrade paths - #2356
Conversation
How would that be correct?
No, I think we need to detect the case when the ESP is We should handle This PR has all the hallmarks of LLM generation but is missing an |
|
Also forgot to mention - thanks so much for the patch! This is definitely a bootc bug where we're just not internally consistent on the |
e924462 to
ca03307
Compare
|
Thanks Colin — right on both counts, and apologies for the missing
Re: tooling — Claude Opus 4.7 via Claude Code. I authored issue #2355, |
`bootc install to-filesystem` writes
`systemd.mount-extra=UUID=<ESP>:/boot:auto:ro` into the deployment
cmdline; systemd's fstab-generator then mounts /boot ro at boot. Every
subsequent `bootc status` failed with
error: Status: Mounting /dev/vda1: Device or resource busy (os error 16)
and any code path that writes the ESP (BLS install, UKI install, gc)
would hit the same EBUSY on a pre-mounted host.
Split the ESP-mount primitive into two intent-typed helpers and thread
the choice through BootedStorage:
- `mount_esp_readonly` clones an existing mount when present and does a
fresh mount otherwise; used by `bootc status`.
- `mount_esp_writable` clones an existing mount and, if the clone is
ro, remounts it rw on the private clone only. This is safe because
bootc always runs in an unshared mount namespace
(`ensure_self_unshared_mount_namespace`), so the remount does not
affect the host's view of /boot. Used by upgrade/gc.
`BootedStorage::new` grows an `EspAccess` argument; `status::get_host`
passes `ReadOnly`, `cli::get_storage` passes `ReadWrite`. The raw
`mount_esp` primitive is now module-private and only reachable through
the typed wrappers.
Also adds `bootc_mount::find_mount_target_by_source(dev)`, a walk
over pid 1's mountinfo tree that returns the existing target path for
a source device (or None), plus a table-driven unit test covering
top-level, nested, absent, empty, and deeply-nested mountinfo shapes.
Verified live on QEMU x86_64 (systemd 261.2, linux-qemu-6.18-bootc,
/boot mounted ro via systemd.mount-extra). Before: `bootc status`
fails with EBUSY. After: full YAML output and JSON output both work.
Assisted-by: Claude (Opus 4.7)
Fixes: bootc-dev#2355
Signed-off-by: Dustin Kirkland <dustin.kirkland@chainguard.dev>
ca03307 to
febce43
Compare
|
I dug in with my agents (and my eyeballs), came up with this, WDYT? Agree and OK to add that to this PR? |
Fixes #2355.
bootc install to-filesystemwritessystemd.mount-extra=UUID=<ESP>:/boot:auto:rointo the deploymentcmdline; systemd's fstab-generator then mounts /boot ro at boot. Every
subsequent
bootc statusfailed withand any code path that writes the ESP (BLS install, UKI install, gc)
would hit the same EBUSY on a pre-mounted host.
Split the ESP-mount primitive into two intent-typed helpers and thread
the choice through
BootedStorage:mount_esp_readonlyclones an existing mount when present and does afresh mount otherwise; used by
bootc status.mount_esp_writableclones an existing mount and, if the clone isro, remounts it rw on the private clone only. Safe because bootc
always runs in an unshared mount namespace
(
ensure_self_unshared_mount_namespace), so the remount does notaffect the host's view of /boot. Used by upgrade/gc.
BootedStorage::newgrows anEspAccessargument;status::get_hostpasses
ReadOnly,cli::get_storagepassesReadWrite. The rawmount_espprimitive is now module-private, reachable only via thetyped wrappers.
Also adds
bootc_mount::find_mount_target_by_source(dev)— a walkover pid 1's mountinfo tree that returns the existing target path for
a source device — with a table-driven unit test covering top-level,
nested, absent, empty, and deeply-nested mountinfo shapes.
Verified live on QEMU x86_64 (systemd 261.2, linux-qemu-6.18-bootc,
/boot mounted ro via systemd.mount-extra). Before:
bootc statusfails with EBUSY. After: full YAML and JSON output both work.
Assisted-by: Claude (Opus 4.7)— see #issuecomment-5138400886 and thereply below for context on tooling and human review.