fix: keep systemd-firstboot running headless (detach stdio from console) - #279
Open
guysoft wants to merge 1 commit into
Open
fix: keep systemd-firstboot running headless (detach stdio from console)#279guysoft wants to merge 1 commit into
guysoft wants to merge 1 commit into
Conversation
On Raspberry Pi 5 (Debian trixie, kernel 6.12.47) the firstboot wizard child blocks opening /dev/console: sysinit.target stalls, SSH/LightDM never start, and every console writer blocks — the boot appears frozen (reproduced on hardware; the same image completes first boot under QEMU). Verified fix on Pi 5 hardware: ship a drop-in detaching the unit's stdio from the console. Prompts then read EOF and the wizard exits immediately (exit 0, verified offline), while the unit still runs — machine-id per-install regeneration, credential import and first-boot-complete.target are all preserved (no masking). BASE_FIRSTBOOT_NONINTERACTIVE=no restores console stdio for distros that ship a display/keyboard wizard. Evidence: hang reproduced with the pristine wizard (forked child, no SIGCHLD, 16min), fixed boot reaches graphical.target with the drop-in.
guysoft
force-pushed
the
fix-firstboot-mask
branch
from
September 8, 2026 09:52
d12f7f6 to
acdcb65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Raspberry Pi 5 (Debian trixie, kernel 6.12.47) a flashed image with an
uninitialized machine-id freezes on first boot:
systemd-firstboot.servicestarts its wizard, the child opens
/dev/consoleand the boot stalls —sysinit.targetis held back forever, SSH/LightDM never start, and everyconsole writer blocks (the boot looks completely frozen).
Reproduced on hardware with the pristine RC image: the wizard forks
(
Forked systemd-firstboot as 893), never exits,sysinit.target: starting held back, waiting for: systemd-firstboot.service, for 16+ minutes.The same image completes its whole first boot under QEMU (wizard finishes
in milliseconds), so the hang is specific to the real console path on
hardware. CI never catches this because
distro_testing/scripts/prepare-image.shmarks first boot as done for QEMU.
Fix (no masking — the unit still runs)
Ship a drop-in that detaches the wizard's stdio from the console:
with the image's own
systemd-firstbootagainst the mounted image).import, and
first-boot-complete.targetare all preserved — futureupstream first-boot logic keeps working (nothing masked).
vconsole.conf KEYMAP / localtime fallbacks + passwordless-root credential),
so the wizard has nothing to ask even with a keyboard attached.
BASE_FIRSTBOOT_NONINTERACTIVE=no(new config knob) restores console stdiofor distros that want an interactive wizard.
Hardware verification (Pi 5 rig, EEPROM menu → SD boot)
headless.confdrop-in)/welcome/→ HTTP 200, LightDM active, welcome screen on HDMI,graphical.targetqueuedScreenshots + serial logs: pirig
debug/2026-09-08*,/tmp/final-test.log(poll log:
welcome=200from the first boot, no freezes).Notes
Pi 5) deserves an upstream report — this PR only makes CustomPiOS images
headless-safe by default.
/dev/nullsymlink) was replacedby this drop-in; the mask commit is dropped from the branch.