You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rpm-ostree/ostree-ext: harden container detection after #5635 #53
Follow-up to coreos/rpm-ostree#5635 (merged). Plain containers with rpm-ostree installed now split the rpmdb, and a leaked container= on a booted host installs into /. Proposed check (gist https://gist.github.com/cgwalters-bot/3cc5c3b0284109ee3e69a406c962cda7): !ostree_booted() && rpmdb at /usr/share/rpm (or /usr/lib/sysimage/rpm) && (running_in_container() || no /run/systemd/system). Open question: in ostree-ext is_ostree_container() (bootc repo) or in rpm-ostree only? Also: cgwalters mentioned converting to /usr/lib/sysimage/rpm, as a separate issue.
Still valid, not done, and blocked on an operator decision: which repository a run may change. No fix has landed since #5635 merged on 24 Sep. The recommended fix is in rpm-ostree only; bootc needs no change.
Evidence. rpm-ostree main (e5f67f1) still has the check #5635 introduced: maybe_container() is running_in_container() || (!running_in_systemd() && !ostree_booted) (client.rs#L273-L276), and it gates libmain, install/uninstall, override, cleanup and the kernel-install wrap. The container flow still hardcodes the rpmdb to /usr/share/rpm (rpmostree-core.cxx#L259), so the two cases the bot measured in the matrix on the PR still hold: a plain fedora:44 container with rpm-ostree gets a second rpmdb and base packages reinstalled over /, and a booted host with a leaked container= installs into / instead of going through the daemon. cgwalters agreed the plain-container case is an important corner, and the bot's reply set it aside as this follow-up. Not re-run here (no podman in this sandbox); the matrix is the reproduction.
Where the fix goes: rpm-ostree, not ostree-ext. ostree-ext already exports ostree_booted() and running_in_container() (container_utils.rs), so maybe_container() can be rewritten in place with no bootc change and no bump of rpm-ostree's git pin on ostree-ext (Cargo.toml#L76). The rpmdb-layout half is rpm knowledge ostree-ext has none of today. bootc's is_ostree_container() is unchanged, still requires the bare-split-xattrs repo config, and its only caller is ostree container commit, which is deprecated in favour of bootc container lint (commit.rs#L105); whether that command fails on chunkah images is untested and not worth a change.
What the fix takes: one small PR. Rewrite maybe_container() as: false if /run/ostree-booted exists; false if /usr/share/rpm does not exist; else running_in_container() || !/run/systemd/system exists (the last keeps BuildKit working, where no container markers are set). Add a unit test next to test_running_in_container that fakes the inputs, and extend ci/test-container.sh (run by just test-container-integration in container-build.yml) with a plain-Fedora negative case: rpm-ostree install must refuse rather than create /usr/share/rpm.
Unclear. The issue's "or /usr/lib/sysimage/rpm" is unsafe as written: plain Fedora has kept its rpmdb there since F36 (RelocateRPMToUsr), so that path does not tell an ostree image from a plain one. Today ostree images have the real db at /usr/share/rpm with sysimage a symlink to it (rpmostree-rpm-util.cxx#L780-L792), so /usr/share/rpm alone is the signal. When rpm-ostree converts to sysimage (open as coreos/rpm-ostree#5455 and #3397) this check needs a different layout marker; that is the separate issue cgwalters mentioned, and it should link back here.
Decision for cgwalters. An implement run cannot do this today: coreos/rpm-ostree and the existing fork cgwalters-forge/rpm-ostree are not in dispatch.toml's repos, only the bootc fork is, and this item sits in the parked epic #333 (P2, target:bootc-dev, which is misleading since the change is in rpm-ostree). Options: (a) add cgwalters-forge/rpm-ostree to the dispatch bounds as a staged-PR fork like bootc and pull this item forward, after which a planning pass writes the plan above against that fork; (b) do the ~10-line change by hand upstream; (c) leave it parked. Not recommended: landing it via the bootc fork by moving the check into ostree-ext, since that is two PRs plus a pin bump for logic rpm-ostree can hold itself.
Activity
cgwalters-bot commentedon Oct 22, 2026
✅ dispatch ended well. Result: #53 (comment)
cgwalters-bot commentedon Oct 22, 2026
Still valid, not done, and blocked on an operator decision: which repository a run may change. No fix has landed since #5635 merged on 24 Sep. The recommended fix is in rpm-ostree only; bootc needs no change.
Evidence. rpm-ostree main (
e5f67f1) still has the check #5635 introduced:maybe_container()isrunning_in_container() || (!running_in_systemd() && !ostree_booted)(client.rs#L273-L276), and it gates libmain, install/uninstall, override, cleanup and the kernel-install wrap. The container flow still hardcodes the rpmdb to/usr/share/rpm(rpmostree-core.cxx#L259), so the two cases the bot measured in the matrix on the PR still hold: a plainfedora:44container with rpm-ostree gets a second rpmdb and base packages reinstalled over/, and a booted host with a leakedcontainer=installs into/instead of going through the daemon. cgwalters agreed the plain-container case is an important corner, and the bot's reply set it aside as this follow-up. Not re-run here (no podman in this sandbox); the matrix is the reproduction.Where the fix goes: rpm-ostree, not ostree-ext. ostree-ext already exports
ostree_booted()andrunning_in_container()(container_utils.rs), somaybe_container()can be rewritten in place with no bootc change and no bump of rpm-ostree's git pin on ostree-ext (Cargo.toml#L76). The rpmdb-layout half is rpm knowledge ostree-ext has none of today. bootc'sis_ostree_container()is unchanged, still requires the bare-split-xattrs repo config, and its only caller isostree container commit, which is deprecated in favour ofbootc container lint(commit.rs#L105); whether that command fails on chunkah images is untested and not worth a change.What the fix takes: one small PR. Rewrite
maybe_container()as: false if/run/ostree-bootedexists; false if/usr/share/rpmdoes not exist; elserunning_in_container() || !/run/systemd/system exists(the last keeps BuildKit working, where no container markers are set). Add a unit test next totest_running_in_containerthat fakes the inputs, and extendci/test-container.sh(run byjust test-container-integrationin container-build.yml) with a plain-Fedora negative case:rpm-ostree installmust refuse rather than create/usr/share/rpm.Unclear. The issue's "or
/usr/lib/sysimage/rpm" is unsafe as written: plain Fedora has kept its rpmdb there since F36 (RelocateRPMToUsr), so that path does not tell an ostree image from a plain one. Today ostree images have the real db at/usr/share/rpmwith sysimage a symlink to it (rpmostree-rpm-util.cxx#L780-L792), so/usr/share/rpmalone is the signal. When rpm-ostree converts to sysimage (open as coreos/rpm-ostree#5455 and #3397) this check needs a different layout marker; that is the separate issue cgwalters mentioned, and it should link back here.Decision for cgwalters. An implement run cannot do this today: coreos/rpm-ostree and the existing fork cgwalters-forge/rpm-ostree are not in dispatch.toml's
repos, only the bootc fork is, and this item sits in the parked epic #333 (P2,target:bootc-dev, which is misleading since the change is in rpm-ostree). Options: (a) addcgwalters-forge/rpm-ostreeto the dispatch bounds as a staged-PR fork like bootc and pull this item forward, after which a planning pass writes the plan above against that fork; (b) do the ~10-line change by hand upstream; (c) leave it parked. Not recommended: landing it via the bootc fork by moving the check into ostree-ext, since that is two PRs plus a pin bump for logic rpm-ostree can hold itself.Generated-by: https://github.com/cgwalters/#llms