Skip to content

build-chunked-oci crashes if target image used as baseline and xattrs for non-rpm contents has changed #5545

@renner0e

Description

@renner0e

Describe the bug

rechunk crashes if a rechunked image is used as baseline, only difference is setting xattr, thus assigning layers to files

https://coreos.github.io/rpm-ostree/build-chunked-oci/#assigning-files-to-specific-layers

Reproduction steps

  1. build image foo

  2. rechunk image foo, turns into foo-chunked

  3. build image foo again, with setfattr

  4. rechunk image foo again, already existing image foo-chunked is baseline

FROM quay.io/fedora/fedora-bootc:latest

RUN dnf install -y dnf5-plugins
RUN dnf5 config-manager setopt updates-debuginfo.enabled=1
RUN dnf -y install rpm-ostree-debuginfo

## add this section on the 2nd rechunk run
#RUN dd if=/dev/random of=/usr/share/blob bs=1M count=10 status=progress
#
#RUN setfattr -n user.component -v "blob" /usr/share/blob

everything below as root:

podman build -t localhost/test:latest .

will not crash, no existing (rechunked) target image

podman run --rm --privileged -v /var/lib/containers:/var/lib/containers quay.io/fedora/fedora-bootc:latest /usr/libexec/bootc-base-imagectl rechunk localhost/test:latest localhost/test-chunked:latest

uncomment the lines in the Containerfile/make any changes to the unrechunked localhost/test image, build again and then also rechunk again (preferably with the image that has the debug symbols)

podman run --rm --privileged --env=RUST_BACKTRACE=full -v /var/lib/containers:/var/lib/containers localhost/test:latest /usr/libexec/bootc-base-imagectl rechunk localhost/test:latest localhost/test-chunked:latest

Expected behavior

rechunk without errors

Actual behavior

it fails with:

podman run --rm --privileged --env=RUST_BACKTRACE=full -v /var/lib/containers:/var/lib/containers localhost/test:latest /usr/libexec/bootc-base-imagectl rechunk localhost/test:latest localhost/test-chunked:latest
Found existing chunked image at target, will use as baseline
Generating commit...
Building package mapping...done
37153 objects in 532 packages (318 source)
Found 1 user component(s):
- blob (1 files)
rpm size: 1927480264
Earliest changed package: shim-x64-15.8-3.x86_64 at 2024-03-19 20:21:09 UTC
Duplicates: 2711
Multiple owners: 5
Generating container image
thread 'tokio-runtime-worker' panicked at /builddir/build/BUILD/rpm-ostree-2025.12-build/rpm-ostree-2025.12/vendor/ostree-ext/src/chunking.rs:686:5:
assertion failed: modified_build.len() <= bin_size.get() as usize
stack backtrace:
0:     0x5587dc7e3102 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1f4a5ae7ceed3e40
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
1:     0x5587dc810a8f - core::fmt::write::h56ac8ebf800b2978
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/core/src/fmt/rt.rs:173:76
2:     0x5587dc7de033 - std::io::Write::write_fmt::h850292d82d52c853
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/io/mod.rs:639:11
3:     0x5587dc7e2f52 - std::sys::backtrace::BacktraceLock::print::h99c7445cd0b68df7
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/sys/backtrace.rs:42:9
4:     0x5587dc7e4f15 - std::panicking::default_hook::{{closure}}::h1aeb5f2f6858ad51
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/panicking.rs:300:27
5:     0x5587dc7e4d36 - std::panicking::default_hook::h3f81440fb75f3b95
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/panicking.rs:327:9
6:     0x5587dc7e58a5 - std::panicking::rust_panic_with_hook::h430582a4bb2b51ce
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/panicking.rs:833:13
7:     0x5587dc7e5626 - std::panicking::begin_panic_handler::{{closure}}::h8543743421135932
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/panicking.rs:699:13
8:     0x5587dc7e3609 - std::sys::backtrace::__rust_end_short_backtrace::h5603794272afafcb
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/sys/backtrace.rs:174:18
9:     0x5587dc7e52ed - __rustc[8ad5584da3d9db71]::rust_begin_unwind
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/panicking.rs:697:5
10:     0x5587dbe820a0 - core::panicking::panic_fmt::h82ac1f541be3977c
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/core/src/panicking.rs:75:14
11:     0x5587dbe8212c - core::panicking::panic::h9d736d7b695ef73f
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/core/src/panicking.rs:145:5
12:     0x5587dc5946c6 - ostree_ext::chunking::basic_packing::hd68abb00696b5c10
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/chunking.rs:686:5
13:     0x5587dc58f087 - ostree_ext::chunking::Chunking::process_mapping::hc858e994f0116b9e
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/chunking.rs:384:27
14:     0x5587dc58da3d - ostree_ext::chunking::Chunking::from_mapping::h9e1240046131bf6b
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/chunking.rs:312:11
15:     0x5587dc5bac35 - ostree_ext::container::encapsulate::build_oci::{{closure}}::h92c697f50fc1b590
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/container/encapsulate.rs:246:13
16:     0x5587dc5b7e91 - ostree_ext::container::encapsulate::build_oci::h7bc05fe23cc8ba7e
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/container/encapsulate.rs:190:1
17:     0x5587dc0a5856 - ostree_ext::container::encapsulate::build_impl::{{closure}}::{{closure}}::h6c79ccdac52a2c74
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/container/encapsulate.rs:372:9
18:     0x5587dc16dde1 - tokio::runtime::handle::Handle::block_on::he4e41f8f9ef8de28
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/ostree-ext/src/container/encapsulate.rs:340:1
19:     0x5587dc2079a0 - rpmostree_rust::container::container_encapsulate::h29e8fc6a0c592fc7
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rust/src/container.rs:637:25
20:     0x5587dc27a255 - rpmostreecxx$cxxbridge1$container_encapsulate
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rust/src/lib.rs:181:12
21:     0x5587dbfdab1f - _ZN12rpmostreecxx21container_encapsulateEN4rust10cxxbridge13VecINS1_6StringEEE
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rpmostree-cxxrs.cxx:3772:79
22:     0x5587dbfdab1f - rpmostree_compose_builtin_container_encapsulate
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/src/app/rpmostree-compose-builtin-tree.cxx:1890:3
23:     0x5587dbf63021 - rpmostree_handle_subcommand
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/src/app/libmain.cxx:443:33
24:     0x5587dbf6756c - _ZN12rpmostreecxx14rpmostree_mainEN4rust10cxxbridge15SliceIKNS1_3StrEEE
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/src/app/libmain.cxx:551:20
25:     0x5587dbf606c2 - operator()
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rpmostree-cxxrs.cxx:3085:56
26:     0x5587dbf606c2 - trycatch<rpmostreecxx::rpmostreecxx$cxxbridge1$rpmostree_main(rust::cxxbridge1::Slice<const rust::cxxbridge1::Str>, int32_t*)::<lambda()>, rust::cxxbridge1::detail::Fail>
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rpmostree-cxxrs.cxx:1317:10
27:     0x5587dbf606c2 - rpmostreecxx$cxxbridge1$rpmostree_main
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rpmostree-cxxrs.cxx:3083:32
28:     0x5587dc271cdc - rpmostree_rust::ffi::rpmostree_main::h2d6ec5de9a293595
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rust/src/lib.rs:855:12
29:     0x5587dbf1e5ef - tokio::runtime::task::raw::poll::hedfc96e4bf5c6e1b
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/rust/src/main.rs:48:25
30:     0x5587dc78a970 - std::sys::backtrace::__rust_begin_short_backtrace::h7c424af713f51c51
at /usr/src/debug/rpm-ostree-2025.12-1.fc43.x86_64/vendor/tokio/src/runtime/task/raw.rs:255:18
31:     0x5587dc78c746 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc74e6eb1ba377732
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/std/src/thread/mod.rs:559:17
32:     0x5587dc7e934f - std::sys::pal::unix::thread::Thread::new::thread_start::h0c18800d26b6356a
at /builddir/build/BUILD/rust-1.90.0-build/rustc-1.90.0-src/library/alloc/src/boxed.rs:1971:9
33:     0x7ffaca764464 - start_thread
34:     0x7ffaca7e75ac - __clone3
35:                0x0 - <unknown>
error: Failed to run compose container-encapsulate: ExitStatus(unix_wait_status(134))
Error executing command: Command '['rpm-ostree', 'experimental', 'compose', 'build-chunked-oci', '--bootc', '--format-version=1', '--from=localhost/test:latest', '--output=containers-storage:localhost/test-chunked:latest']' returned non-zero exit status 1.

System details

rpm-ostree --version
rpm-ostree:
Version: '2025.12'
Git: b8547377b9891229a9712d551f83342ddfcb642d
Features:
- rust
- compose
- container
- fedora-integration

Additional information

If you don't assign the extra layer via setfattr it will just work as expected

podman 5.7.1, Fedora 43

rpm -qi podman
Name        : podman
Epoch       : 5
Version     : 5.7.1
Release     : 1.fc43
Architecture: x86_64
Install Date: Mo 22 Dez 2025 03:17:05 CET
Group       : Unspecified
Size        : 50119519
License     : Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
Signature   :
RSA/SHA256, Mi 10 Dez 2025 19:40:45 CET, Key ID 829b606631645531
Source RPM  : podman-5.7.1-1.fc43.src.rpm
Build Date  : Mi 10 Dez 2025 19:25:25 CET
Build Host  : buildhw-x86-03.rdu3.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://podman.io/
Bug URL     : https://bugz.fedoraproject.org/podman
Summary     : Manage Pods, Containers and Container Images

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions