ephemeral: Do container namespace setup in bcvk instead of bwrap - #329
Draft
yeetypete wants to merge 4 commits into
Draft
ephemeral: Do container namespace setup in bcvk instead of bwrap#329yeetypete wants to merge 4 commits into
yeetypete wants to merge 4 commits into
Conversation
Requiring bubblewrap in the target image is not obvious to users, and several distributions' images do not carry it. bwrap was providing an unshare, a handful of bind mounts, a pivot_root and a PID namespace. Podman already gives the container a PID namespace with bcvk as its init, so what remains is a short piece of rustix. The entrypoint script moves under /run, because `podman exec` joins the namespace bcvk now runs in, where /var/lib/bcvk is not visible. Closes: bootc-dev#7 Assisted-by: AI Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
The script assembled /run/tmproot, read the image's systemd version and exec'd bcvk. Doing this in Rust allows us to stop depending on bash in a target image. Assisted-by: AI Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
…lation readme. Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
bcvk is bind-mounted into the container it starts and runs there before the entrypoint switches to the host's /usr. A dynamic build must load against the image's glibc, which fails when the image ships an older one than the build host, such as centos-bootc:stream9. A static build has no such dependency. Assisted-by: AI Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
Author
|
@cgwalters thoughts? I see in #7 you mention trying out a different approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #7
Target images currently have to ship bubblewrap and bash.
entrypoint.shbuilds the hybrid root and then execs bwrap, which unshares, binds the API filesystems, callspivot_rootand becomes PID 1.bcvk can do this itself: podman already provides the PID namespace with bcvk as its init, so the rest is replaced by a lightweight namespace setup in the container entrypoint. The dependency on both bubblewrap and bash go away with removing
entrypoint.sh.bcvk now runs in the image's userspace so it needs to be linked statically to work on older distros like stream9 with an older libc. Thoughts on this change?
This also fixes running Ubuntu 26.04 hosts. This was actually the original reason I looked into removing bubblewrap. On 26.04 the bwrap-userns-restrict AppArmor profile denies capabilities to bwrap's children. virtiofsd exits at startup with "can't apply the child capabilities" and bcvk polls for SSH until it times out. This might also be related to #306.
Tested by running all integration tests (
just test-integration) on an ubuntu 26.04 host. Note thattest_to_base_disk_integration_with_listfails with:FAIL [ 0.326s] integration-tests::integration-tests test_to_base_disk_integration_with_list stdout ─── running 1 test Testing to-base-disk integration with base-disks list Initial base disk count: 12 to-base-disk output: Created base disk: /home/psiegel/.local/share/libvirt/images/bootc-base-edda9015d6f14aa4.qcow2 Final base-disks list: ┌───────────────────────────────────┬──────────┬──────┬──────────────────┬──────────────────────────────────────────────────────────┐ │ NAME ┆ SIZE ┆ REFS ┆ CREATED ┆ IMAGE DIGEST │ ╞═══════════════════════════════════╪══════════╪══════╪══════════════════╪══════════════════════════════════════════════════════════╡ │ bootc-base-7b23c3ceb66bf50c.qcow2 ┆ 1.69 GiB ┆ 0 ┆ 2026-08-23 01:12 ┆ sha256:6673fbbd49b11314700b0e842ed75149a673eb9faf7ec4... │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ bootc-base-edda9015d6f14aa4.qcow2 ┆ 1.55 GiB ┆ 0 ┆ 2026-08-23 01:20 ┆ sha256:6673fbbd49b11314700b0e842ed75149a673eb9faf7ec4... │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ bootc-base-92414e97c3abaecc.qcow2 ┆ 1.55 GiB ┆ 0 ┆ 2026-08-23 01:22 ┆ sha256:6673fbbd49b11314700b0e842ed75149a673eb9faf7ec4... │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ bootc-base-487758b3396b22bb.qcow2 ┆ 1.69 GiB ┆ 0 ┆ 2026-08-23 01:10 ┆ sha256:6673fbbd49b11314700b0e842ed75149a673eb9faf7ec4... │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ bootc-base-7ac29c1405a4366c.qcow2 ┆ 1.69 GiB ┆ 0 ┆ 2026-08-23 01:08 ┆ sha256:6673fbbd49b11314700b0e842ed75149a673eb9faf7ec4... │ └───────────────────────────────────┴──────────┴──────┴──────────────────┴──────────────────────────────────────────────────────────┘ Found 5 base disks test test_to_base_disk_integration_with_list ... FAILED failures: ---- test_to_base_disk_integration_with_list ---- test panicked: Base disk count should increase after creation failures: test_to_base_disk_integration_with_list test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 89 filtered out; finished in 0.32s stderr ─── thread '<unnamed>' (3280798) panicked at crates/integration-tests/src/tests/libvirt_to_base_disk.rs:205:9: Base disk count should increase after creation note: run with `RUST_BACKTRACE=1` environment variable to display a backtraceBut this looks unrelated.
Also tested together with https://github.com/yeetypete/bootc-ubuntu where this fixes a previous hang due to the AppArmor issue.
Assisted-by: AI