Skip to content

Commit 1c7d4b9

Browse files
castrojoCopilot
andauthored
fix: ship rechunker-group-fix service for legacy-rechunk→chunkah migration (#18)
When users bootc switch from ghcr.io/ublue-os/bluefin (legacy-rechunk) to ghcr.io/projectbluefin/bluefin (chunkah/rpm-ostree build-chunked-oci), the first boot fails with a black screen. Root cause: legacy-rechunk's 1_prune.sh moves /etc/group entries into /usr/lib/group for nss-altfiles, but chunkah images don't use nss-altfiles. This desyncs /etc/gshadow from /etc/group, causing systemd-sysusers to fail on first boot: systemd-sysusers[1022]: /etc/gshadow: Group "plocate" already exists. The fix (from ublue-os/aurora, Dec 2025): a oneshot systemd service that rebuilds /etc/gshadow from /etc/group on every boot. The service is idempotent and harmless once gshadow is clean. Files added (verbatim from Aurora): - system_files/shared/usr/bin/rechunker-group-fix - system_files/shared/usr/lib/systemd/system/rechunker-group-fix.service Service enabled in build_files/base/17-cleanup.sh. Without this fix, the first boot into projectbluefin/bluefin after switching from ublue-os/bluefin WILL produce a black screen. Second boot of the same image succeeds, but users will think the image is broken. Fixes: ublue-os/bluefin#3852 See also: - ublue-os/bluefin-lts#918 (renner0e test report) - bootc-dev/bootc#1179 - ublue-os/aurora#1468 - https://github.com/ublue-os/legacy-rechunk/blob/1d2b0c2e/1_prune.sh#L41-L47 Assisted-by: Claude Sonnet 4.6 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ec6a12a commit 1c7d4b9

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

build_files/base/17-cleanup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ systemctl enable rpm-ostree-countme.service
1616
systemctl enable tailscaled.service
1717
systemctl enable ublue-system-setup.service
1818

19+
# see /usr/bin/rechunker-group-fix
20+
# DO NOT REMOVE THIS
21+
systemctl enable rechunker-group-fix.service
22+
1923
systemctl enable flatpak-preinstall.service
2024

2125
# Updater
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# To use this script, you'll want to put this in your systemd service:
4+
# rm /etc/gshadow
5+
# systemd-sysusers
6+
# (run this script)
7+
# systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
8+
# This will populate /etc/group successfully, and then populate /etc/gshadow
9+
# with any missing groups that we nuked when we removed /etc/gshadow
10+
11+
GSHADOW_FILE="/etc/gshadow"
12+
GROUP_FILE="/etc/group"
13+
14+
for f in $(cat $GROUP_FILE); do
15+
cut -f1 -d':' <(echo $f) | xargs -I{} grep ^"{}" $GSHADOW_FILE &>/dev/null || \
16+
echo $(cut -f1 -d':' <(echo $f)):'!*::' >> $GSHADOW_FILE
17+
done
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# We have this script so that people using images with `nss-altfiles` (`/usr/lib/g{roup,shadow}`)
2+
# do not break their systems when rebasing to an image without that
3+
# This usually happens when using https://github.com/hhd-dev/rechunk then rebasing to an image without it.
4+
# Please DO NOT remove this unless this is fully, completely obsolete.
5+
# This is exactly what is making it break: https://github.com/ublue-os/legacy-rechunk/blob/1d2b0c2e99afbdc2eb06788ae28e157a88b03d70/1_prune.sh#L41-L47
6+
# Users WILL experience black screens and systems will NOT boot if this script malfunctions. Please test this properly and always make sure this works
7+
# Relevant issues:
8+
# - https://github.com/bootc-dev/bootc/issues/1179#issuecomment-2708305926
9+
# - https://github.com/ublue-os/main/issues/759
10+
# - https://github.com/ublue-os/bluefin-lts/issues/918
11+
# - https://github.com/ublue-os/image-template/issues/177
12+
# - https://github.com/ublue-os/aurora/issues/1468
13+
# - https://github.com/ublue-os/bluefin/issues/3852
14+
# This got created on Tue, 16 Dec 2025 00:44:58 -0300
15+
[Unit]
16+
Description=Fix groups for Legacy rechunker
17+
ConditionPathExists=/run/ostree-booted
18+
Wants=local-fs.target
19+
After=local-fs.target
20+
Before=systemd-user-sessions.service
21+
# Before=systemd-sysusers.service
22+
23+
[Service]
24+
Type=oneshot
25+
ExecStart=bash -c 'touch /etc/gshadow && chmod 600 /etc/gshadow'
26+
ExecStart=bash -c 'rm /etc/gshadow'
27+
ExecStart=systemd-sysusers
28+
ExecStart=rechunker-group-fix
29+
ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
30+
31+
[Install]
32+
WantedBy=default.target multi-user.target

0 commit comments

Comments
 (0)