Skip to content

feat: replace legacy rechunker with rpm-ostree compose build-chunked-oci - #4564

Closed
dylanmtaylor wants to merge 3 commits into
ublue-os:mainfrom
dylanmtaylor:rechunker-port
Closed

feat: replace legacy rechunker with rpm-ostree compose build-chunked-oci#4564
dylanmtaylor wants to merge 3 commits into
ublue-os:mainfrom
dylanmtaylor:rechunker-port

Conversation

@dylanmtaylor

@dylanmtaylor dylanmtaylor commented May 4, 2026

Copy link
Copy Markdown
Contributor

Replaces hhd-dev/legacy-rechunk with rpm-ostree's built-in compose build-chunked-oci.

Includes the rechunker-group-fix one-shot systemd unit so users rebasing from legacy rechunker images do not lose /etc/gshadow consistency. Mirrors PR #4633.

The SBOM/changelogs portion of the original split landed via #4635 and is no longer in scope here.

Port of ublue-os/aurora#1476.

Closes #4510
Closes #3917

Copilot AI review requested due to automatic review settings May 4, 2026 09:08
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. area/iso Making installable images kind/enhancement New feature, don't implement without a spec and consensus labels May 4, 2026
@codacy-production

codacy-production Bot commented May 4, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Bluefin’s image “rechunking” flow away from legacy-rechunk and onto rpm-ostree’s native compose build-chunked-oci, and introduces a systemd-based migration safeguard intended to prevent /etc/group//etc/gshadow breakage when rebasing from legacy rechunked images.

Changes:

  • Replace the legacy rechunker-based Justfile pipeline with an rpm-ostree compose build-chunked-oci-based pipeline.
  • Add rechunker-group-fix script + systemd unit and enable it in the base image to mitigate legacy nss-altfiles migration issues.
  • Update CI workflow to run the new rechunk step and (for PRs) export an OCI archive artifact for testing.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
system_files/shared/usr/lib/systemd/system/rechunker-group-fix.service Adds a boot-time oneshot service to reset/regenerate group shadow data during migration.
system_files/shared/usr/bin/rechunker-group-fix Adds helper script to repopulate /etc/gshadow entries based on /etc/group.
Justfile Replaces legacy rechunker steps with rpm-ostree chunked-OCI compose and adds helper targets for rootful loading / OCI export.
build_files/base/17-cleanup.sh Enables the new rechunker-group-fix.service in the built image.
.gitignore Stops ignoring legacy _build outputs and ignores generated .oci archives.
.github/workflows/reusable-build.yml Updates CI to use the new rechunk step and upload OCI archives for PR testing; adds podman workaround for annotation pushing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Justfile Outdated
Comment thread Justfile
Comment thread Justfile Outdated
Comment thread Justfile Outdated
Comment thread Justfile
Comment thread system_files/shared/usr/lib/systemd/system/rechunker-group-fix.service Outdated
Comment thread system_files/shared/usr/lib/systemd/system/rechunker-group-fix.service Outdated

@renner0e renner0e left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly fine, you are just missing every improvement we've made after the first initial PR that introduced the rpm-ostree rechunker

You still need to rewrite your changelogs script to use the contents of the SBOM instead of the label set by the hdd rechunker

@castrojo

castrojo commented May 4, 2026

Copy link
Copy Markdown
Collaborator

I can handle the SBOMs/Changelogs, I've been working on it on other variants. I can work on that on a follow on PR.

@dylanmtaylor

Copy link
Copy Markdown
Contributor Author

I can handle the SBOMs/Changelogs, I've been working on it on other variants. I can work on that on a follow on PR.

I pulled a lot of that work into this PR.

@bsherman

bsherman commented May 7, 2026

Copy link
Copy Markdown
Contributor

I've been look at this closer. I'm really wondering if this is the right time to make the change. Is compose build-chunked-oci the way to go when coreos/chunkah is starting to get into good shape and is almost certainly going to be the next step?

@renner0e

renner0e commented May 7, 2026

Copy link
Copy Markdown
Member

I've been look at this closer. I'm really wondering if this is the right time to make the change. Is compose build-chunked-oci the way to go when coreos/chunkah is starting to get into good shape and is almost certainly going to be the next step?

I think it does make sense as we currently rely on the HDD rechunker to generate our changelogs and this also introduces the workaround needed to get rid of the HDD rechunker, see the service unit.

(Although I would've preferred to split this up into multiple PRs despite bazzite and Aurora having already figured those things out and the changes being less experimental and more tested now.)

This is a preparation to use other solutions like chunkah in the future if it makes sense.

@bsherman

Copy link
Copy Markdown
Contributor

Looks like the latest changes will fail SBOM generation. Going to throw copilot at this again.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

.github/workflows/reusable-build.yml:346

  • The SBOM being attached is named sbom.json and generated via just gen-sbom, which currently outputs Syft JSON (syft-json), but this workflow labels and discovers it as SPDX (application/vnd.spdx+json). This mismatch will break downstream consumers (e.g., changelog generation via ORAS discovery) and misrepresents the artifact content. Align the SBOM output format and the ORAS --artifact-type/discover filter (either generate SPDX JSON or change the artifact type + consumer parsing to Syft JSON).
          SBOM="sbom_out/${IMAGE_NAME}/sbom.json"
          
          cd "$(dirname "${SBOM}")"
          oras attach \
            --artifact-type application/vnd.spdx+json \
            --annotation filename=$(basename "$SBOM") \
            "${IMAGE}@${DIGEST}" \
            "$(basename ${SBOM})"

          sbom_digest=$(oras discover --format json "${IMAGE}@${DIGEST}" | jq -r '.referrers[] | select(.artifactType == "application/vnd.spdx+json") | .digest')

Comment thread .github/changelogs.py
Comment thread Justfile
Comment thread Justfile
Comment thread Justfile
Comment thread Justfile
@bsherman

Copy link
Copy Markdown
Contributor

@dylanmtaylor A few general suggestions.

First, it's a LOT easier to get confidence on changes and code reviews for smaller chunks of changes. So I'd strongly suggest figuring out if anything can be done in stages. If not possible, my second comment becomes invaluable.

Second, for any change, if it's not covered by tests or able to be validated in a PR build, it's highly valuable to clone/fork and run a build in a distinct location which can fully exercise the workflow. The bigger the change, the more important that becomes. Also, it's a general problem with any changes to workflow steps which only happen on release or "main" builds, like those here for changelogs, rechunk, etc.

@dylanmtaylor

Copy link
Copy Markdown
Contributor Author

@dylanmtaylor A few general suggestions.

First, it's a LOT easier to get confidence on changes and code reviews for smaller chunks of changes. So I'd strongly suggest figuring out if anything can be done in stages. If not possible, my second comment becomes invaluable.

Second, for any change, if it's not covered by tests or able to be validated in a PR build, it's highly valuable to clone/fork and run a build in a distinct location which can fully exercise the workflow. The bigger the change, the more important that becomes. Also, it's a general problem with any changes to workflow steps which only happen on release or "main" builds, like those here for changelogs, rechunk, etc.

Some good recommendations here. I'll try to think about logically splitting this up.

@dylanmtaylor
dylanmtaylor marked this pull request as draft May 16, 2026 01:16
dylanmtaylor added a commit to dylanmtaylor/bluefin that referenced this pull request May 16, 2026
Adds a one-shot systemd unit that regenerates /etc/gshadow on first
boot when migrating from images built with hhd-dev/legacy-rechunk's
nss-altfiles handling. Without this, users rebasing to images that no
longer use the legacy rechunker hit black screens or fail to boot.

The unit is gated by ConditionPathExists=!/var/lib/.rechunker-group-fix-done
so it runs once and never again.

Lands ahead of the rechunker swap so the fix is baked into running
systems before they encounter post-swap images.

Split out of ublue-os#4564 to derisk the change based on feedback by @bsherman.

Refs ublue-os#4510, ublue-os#3917
dylanmtaylor added a commit to dylanmtaylor/bluefin that referenced this pull request May 16, 2026
Adds a one-shot systemd unit that regenerates /etc/gshadow on first
boot when migrating from images built with hhd-dev/legacy-rechunk's
nss-altfiles handling. Without this, users rebasing to images that no
longer use the legacy rechunker hit black screens or fail to boot.

The unit is gated by ConditionPathExists=!/var/lib/.rechunker-group-fix-done
so it runs once and never again.

Lands ahead of the rechunker swap so the fix is baked into running
systems before they encounter post-swap images.

Split out of ublue-os#4564 to derisk the change based on feedback by @bsherman.

Refs ublue-os#4510, ublue-os#3917
dylanmtaylor added a commit to dylanmtaylor/bluefin that referenced this pull request May 16, 2026
Refactors the changelog generation script to fetch package information
from image Software Bill of Materials (SBOMs) instead of custom labels.

This is split out of ublue-os#4564 to derisk the change
dylanmtaylor added a commit to dylanmtaylor/bluefin that referenced this pull request May 16, 2026
Refactors the changelog generation script to fetch package information
from image Software Bill of Materials (SBOMs) instead of custom labels.

This is split out of ublue-os#4564 to derisk the change
dylanmtaylor added a commit to dylanmtaylor/bluefin that referenced this pull request May 22, 2026
Adds a one-shot systemd unit that regenerates /etc/gshadow on first
boot when migrating from images built with hhd-dev/legacy-rechunk's
nss-altfiles handling. Without this, users rebasing to images that no
longer use the legacy rechunker hit black screens or fail to boot.

The unit is gated by ConditionPathExists=!/var/lib/.rechunker-group-fix-done
so it runs once and never again.

Lands ahead of the rechunker swap so the fix is baked into running
systems before they encounter post-swap images.

Split out of ublue-os#4564 to derisk the change based on feedback by @bsherman.

Refs ublue-os#4510, ublue-os#3917
Adds a one-shot systemd unit that regenerates /etc/gshadow on first
boot when migrating from images built with hhd-dev/legacy-rechunk's
nss-altfiles handling. Without this, users rebasing to images that no
longer use the legacy rechunker hit black screens or fail to boot.

The unit is gated by ConditionPathExists=!/var/lib/.rechunker-group-fix-done
so it runs once and never again.

Lands ahead of the rechunker swap so the fix is baked into running
systems before they encounter post-swap images.

Split out of ublue-os#4564 to derisk the change based on feedback by @bsherman.

Refs ublue-os#4510, ublue-os#3917
Switches the rechunk pipeline from hhd-dev/legacy-rechunk to
rpm-ostree's built-in compose build-chunked-oci. Adds incremental
rebuild support via --previous-build when a prior image is available.
Adds load-rootful and export-oci helpers; export-oci is wired into
the CI workflow to upload an OCI archive artifact for PR testing.

Workflow changes: switches to a BTRFS-mounted podman storage,
installs a newer podman from brew to work around a missing layer
annotation push (podman-container-tools/podman#27796), and pushes images twice
to ensure annotations are sent.

Depends on:
- ublue-os#4633 rechunker-group-fix safety net
- the SBOM/changelogs split-out PR (provides the gen-sbom Just
  recipe this workflow calls)

Closes ublue-os#4510, ublue-os#3917

Split out of ublue-os#4564 to derisk the change based on feedback by
@bsherman and @renner0e.
@dylanmtaylor
dylanmtaylor marked this pull request as ready for review May 22, 2026 16:11
@hanthor

hanthor commented May 24, 2026

Copy link
Copy Markdown
Collaborator

🤖 AI-Assisted Pull Request Review

Really nice work porting native compose build-chunked-oci rechunking and handling the NSS altfiles/gshadow migration workaround! This is a solid foundation.

Critical SBOM Format Mismatch Bug:
I noticed a mismatch in the reusable-build.yml workflow and the Justfile:
The workflow attaches sbom.json under the artifact type application/vnd.spdx+json using ORAS:

oras attach \
  --artifact-type application/vnd.spdx+json \
  --annotation filename=$(basename "$SBOM") \
  "${IMAGE}@${DIGEST}" \
  "$(basename ${SBOM})"

However, the command just gen-sbom in the codebase actually generates Syft JSON format (syft-json), which is not valid SPDX JSON. Downstream consumers (such as the release changelog generators or other tools searching for SPDX referrers) will fail when attempting to parse this file as an SPDX document.

Recommendation:
To resolve this, please update the gen-sbom recipe in the Justfile to output SPDX JSON format (e.g. syft ... -o spdx-json if using syft), or adjust the ORAS attachment and consumer logic to align on Syft JSON format.

@castrojo

Copy link
Copy Markdown
Collaborator

Closing old feature PRs here since the images on projectbluefin/bluefin are already ahead. We'll keep updating and fixing issues here until then, thanks!

@castrojo castrojo closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/iso Making installable images kind/enhancement New feature, don't implement without a spec and consensus size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move off of legacy rechunker Move to upstream rechunker

6 participants