Skip to content

ostree-ext: Failed assertion in Chunking::process_mapping #1885

Closed
coreos/rpm-ostree
#5646

Description

@HastD

When rechunking certain images using rpm-ostree compose build-chunked-oci, an assertion in ostree_ext::chunking::Chunking::process_mapping fails, causing a panic. Here are two image builds where this happens:

This only happens with certain images, not with all images, and I'm unsure what exactly triggers it. However, it seems to have something to do with basing the layer plan on a previous build manifest, as this bug was not occurring with the same images when the previous build manifest was not being taken into account. (If someone could figure out a more minimal reproduction of this bug, that would be great.)

Activity

  1. askpng commented on Jan 5, 2026

    @askpng

    Similar issue observed here as well.

  2. daniel-g-carrasco commented on Aug 29, 2026

    @daniel-g-carrasco

    Another data point, with two distinct assertions from the same image.

    rpm-ostree compose build-chunked-oci --bootc --max-layers 127 --format-version 2 with --previous-build, rpm-ostree 2026.2 (Fedora 44, ostree-ext 0.15.3), Fedora-based bootc image of about 19.5 GB rootfs (Bluefin DX derivative, ~2360 packages):

    • prior build = the previous chunked image from the registry: assertion left == right failed, 2290 != 2501 (the after_processing_pkgs_len == before_processing_pkgs_len check in basic_packing_with_prior_build)
    • prior build = the output of the very same run (re-chunking its own result): assertion left == right failed, 1734 != 0 (assert_eq!(self.remainder.content.len(), 0) in Chunking::process_mapping)

    Both reproduce locally on the rootfs, not only in CI. Without --previous-build the same image chunks fine every time; the cost is that consecutive weekly builds share only 69 of 128 layers (about 2.8 GB of 6.2 GB), which is what users see as a near-full re-download on every update. Happy to run a patched build against this image if a fix needs a reproducer.

  3. HastD commented on Aug 29, 2026

    @HastD
    ContributorAuthor

    @daniel-g-carrasco At this point I'd recommend using Chunkah instead of build-chunked-oci for rechunking; Chunkah is actively maintained, runs much faster, and generally seems to give at least as good results (in terms of update sizes) as build-chunked-oci with --previous-build.

  4. daniel-g-carrasco commented on Aug 29, 2026

    @daniel-g-carrasco

    Thanks, that is useful to know. We stayed on build-chunked-oci because it is what the image ships and what Bazzite uses; I will run chunkah on the same image and compare the delta between two consecutive builds against the 69/128 layers we get today, and report the numbers here.

  5. HastD commented on Aug 29, 2026

    @HastD
    ContributorAuthor

    Bazzite is in the process of switching to Chunkah, too: ublue-os/bazzite@d9a7169

  6. daniel-g-carrasco commented on Aug 31, 2026

    @daniel-g-carrasco

    Measured, as promised. Same image, same base, two builds about 21 hours apart (a few commits of ours plus one day of Fedora/COPR churn), chunked both ways:

    chunker layers shared between the two builds bytes shared image size
    rpm-ostree build-chunked-oci (no --previous-build, because of this issue) 84 of 128 4071 MiB of 6234 (65%) 6234 MiB
    chunkah v0.6.0 (--max-layers 127, rpmdb components, no update-interval hints) 106 of 127 4764 MiB of 6377 (74%) 6377 MiB

    So for a daily update chunkah downloads about 1.6 GB against 2.2 GB, with an image 143 MiB larger, out of the box and without per-package interval hints. The chunking step itself took 3 min 14 s against 10 min 0 s on the same GitHub runner. Thanks for the pointer; it is a real option for us while --previous-build is blocked here.

  7. TheMDev commented on Oct 20, 2026

    @TheMDev

    @HastD I was able to create a minimal reproduction. For the reduced reproductions, build the following container and create the two annotated baselines.

    FEDORA='quay.io/fedora/fedora-bootc@sha256:a2789aaa615504ac9dd039a6ac0cc75343ceca89416e38441d739dbffe6557c9'
    GRAPHROOT="$(podman info --format '{{.Store.GraphRoot}}')"
    STORE='containers-storage:[overlay@/run/host-container-storage+/run/rpm-ostree-storage]'
    
    podman build --pull=never -t localhost/chunking-1885-multilib:v1 -f - . <<'CONTAINERFILE'
    FROM quay.io/fedora/fedora-bootc@sha256:a2789aaa615504ac9dd039a6ac0cc75343ceca89416e38441d739dbffe6557c9
    RUN dnf5 -y install glibc.i686 && dnf5 clean all
    RUN bootc container lint
    CONTAINERFILE

    V0: annotated Fedora baseline, with no prior.

    podman run --rm --privileged --pull=never \
      --mount="type=image,src=$FEDORA,target=/rpm-ostree" \
      --mount="type=bind,src=$GRAPHROOT,target=/run/host-container-storage,rw" \
      --mount=type=tmpfs,target=/run/rpm-ostree-storage \
      --entrypoint /usr/bin/rpm-ostree "$FEDORA" \
      compose build-chunked-oci --max-layers 127 --format-version=2 --bootc \
      --rootfs /rpm-ostree --output "${STORE}localhost/chunking-1885:v0"

    V1: annotated Fedora multilib baseline, with no prior.

    podman run --rm --privileged --pull=never \
      --mount=type=image,src=localhost/chunking-1885-multilib:v1,target=/rpm-ostree \
      --mount="type=bind,src=$GRAPHROOT,target=/run/host-container-storage,rw" \
      --mount=type=tmpfs,target=/run/rpm-ostree-storage \
      --entrypoint /usr/bin/rpm-ostree "$FEDORA" \
      compose build-chunked-oci --max-layers 127 --format-version=2 --bootc \
      --rootfs /rpm-ostree --output "${STORE}localhost/chunking-1885:v1"

    Then run the two distinct assertion tests. chunking.rs:704 uses the multilib source with V0 as prior. chunking.rs:423 uses the already chunked V1 image as both source and prior. This demonstrates that even an image with no changes is capable of hitting the chunking.rs:423 bug.

    chunking.rs:704: expected assertion 531 != 534.

    podman run --rm --privileged --pull=never \
      --mount=type=image,src=localhost/chunking-1885-multilib:v1,target=/rpm-ostree \
      --mount="type=bind,src=$GRAPHROOT,target=/run/host-container-storage,rw" \
      --mount=type=tmpfs,target=/run/rpm-ostree-storage \
      --entrypoint /usr/bin/rpm-ostree -e RUST_BACKTRACE=full -e RUST_LOG=debug "$FEDORA" \
      compose build-chunked-oci --max-layers 127 --format-version=2 --bootc \
      --rootfs /rpm-ostree \
      --previous-build "${STORE}localhost/chunking-1885:v0" \
      --output "${STORE}localhost/chunking-1885:failure-704"

    chunking.rs:423: expected assertion 558 != 0.

    podman run --rm --privileged --pull=never \
      --mount=type=image,src=localhost/chunking-1885:v1,target=/rpm-ostree \
      --mount="type=bind,src=$GRAPHROOT,target=/run/host-container-storage,rw" \
      --mount=type=tmpfs,target=/run/rpm-ostree-storage \
      --entrypoint /usr/bin/rpm-ostree -e RUST_BACKTRACE=full -e RUST_LOG=debug "$FEDORA" \
      compose build-chunked-oci --max-layers 127 --format-version=2 --bootc \
      --rootfs /rpm-ostree \
      --previous-build "${STORE}localhost/chunking-1885:v1" \
      --output "${STORE}localhost/chunking-1885:failure-423"

    After a brief look it appears in basic_packing_with_prior_build, the BTreeSet of names collapses multiplicities, causing chunking.rs:704. name_to_component keeps only the first component for each name, so duplicate annotation entries select it twice and leave other objects for the chunking.rs:423 check.

  8. added a commit that references this issue on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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