Skip to content

Commit acf0ed6

Browse files
committed
composefs,centos-9: Enable rhel9 cargo feature for kernel 5.14 loopback fallback
CentOS Stream 9 ships kernel 5.14, which cannot mount an erofs image directly from a file descriptor. composefs-rs provides a `rhel9` feature in composefs-ctl (and forwarded through bootc-initramfs-setup) that works around this by loopifying the image file into a /dev/loopN block device before mounting it. Without this feature enabled at build time, bootc install on centos-9 with the composefs backend fails with ENOTBLK ('Block device required', errno 15) when the initramfs setup code tries to mount the composefs/erofs image. Wire up the feature in two places: - Makefile: extend CARGO_FEATURES_DEFAULT to also emit `rhel9` when building on a RHEL-like OS with VERSION_ID=9. - bootc.spec: add a `rhel9` bcond gated on `%{?rhel} == 9` and pass it to all three cargo build invocations and to %make_install. With the build fix in place, remove the ci.yml exclude that was suppressing centos-9 + composefs testing in test-integration. Closes: #1812 Assisted-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 24ee5ea commit acf0ed6

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ jobs:
236236
seal_state: ["sealed", "unsealed"]
237237

238238
exclude:
239-
# https://github.com/bootc-dev/bootc/issues/1812
240-
- test_os: centos-9
241-
variant: composefs
242239
- seal_state: "sealed"
243240
boot_type: bls
244241
- seal_state: "sealed"

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ prefix ?= /usr
2929
# We may in the future also want to include Fedora+derivatives as
3030
# the code is really tiny.
3131
# (Note we should also make installation of the units conditional on the rhsm feature)
32-
CARGO_FEATURES_DEFAULT ?= $(shell . /usr/lib/os-release; if echo "$$ID_LIKE" |grep -qF rhel; then echo rhsm; fi)
32+
#
33+
# Enable the rhel9 feature on RHEL/CentOS Stream 9, which runs kernel 5.14.
34+
# That kernel cannot mount an erofs image directly from a file descriptor;
35+
# composefs-ctl's rhel9 feature activates a loopback-device fallback instead.
36+
CARGO_FEATURES_DEFAULT ?= $(shell . /usr/lib/os-release; \
37+
features=""; \
38+
if echo "$$ID_LIKE" | grep -qF rhel; then features="$$features rhsm"; fi; \
39+
if echo "$$ID_LIKE" | grep -qF rhel && [ "$$VERSION_ID" = "9" ]; then features="$$features rhel9"; fi; \
40+
echo $$features)
3341
# You can set this to override all cargo features, including the defaults
3442
CARGO_FEATURES ?= $(CARGO_FEATURES_DEFAULT)
3543

contrib/packaging/bootc.spec

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
%bcond_with rhsm
1313
%endif
1414

15+
# kernel 5.14 (RHEL/CentOS 9) cannot mount an erofs image directly from a file
16+
# descriptor; composefs-ctl's rhel9 feature enables a loopback-device fallback.
17+
%if 0%{?rhel} == 9
18+
%bcond_without rhel9
19+
%else
20+
%bcond_with rhel9
21+
%endif
22+
1523
%global rust_minor %(rustc --version | cut -f2 -d" " | cut -f2 -d".")
1624

1725
# https://github.com/bootc-dev/bootc/issues/1640
@@ -132,13 +140,16 @@ make manpages
132140
# Build all binaries
133141
%if 0%{?container_build}
134142
# Container build: use cargo directly with cached dependencies to avoid RPM macro overhead
135-
cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} --bins
143+
cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} %{?with_rhel9:--features rhel9} --bins
136144
%else
137145
# Non-container build: use RPM macros for proper dependency tracking
138146
%if %new_cargo_macros
139-
%cargo_build %{?with_rhsm:-f rhsm} -- --bins
147+
# Note: %%cargo_build's own -f option only accepts a single value, so a
148+
# second -f would silently clobber the first; pass extra features as
149+
# plain --features args after -- instead, which cargo unions correctly.
150+
%cargo_build -- %{?with_rhsm:--features rhsm} %{?with_rhel9:--features rhel9} --bins
140151
%else
141-
%cargo_build %{?with_rhsm:--features rhsm} -- --bins
152+
%cargo_build %{?with_rhsm:--features rhsm} %{?with_rhel9:--features rhel9} -- --bins
142153
%endif
143154
%endif
144155

@@ -152,7 +163,7 @@ sed -i -e '/https:\/\//d' cargo-vendor.txt
152163

153164
%install
154165
# Pass CARGO_FEATURES explicitly to prevent auto-detection rebuild in install environment
155-
%make_install INSTALL="install -p -c" CARGO_FEATURES="%{?with_rhsm:rhsm}"
166+
%make_install INSTALL="install -p -c" CARGO_FEATURES="%{?with_rhsm:rhsm} %{?with_rhel9:rhel9}"
156167
%if %{with ostree_ext}
157168
make install-ostree-hooks DESTDIR=%{?buildroot}
158169
%endif

0 commit comments

Comments
 (0)