Repository navigation
puppy: the installer removes dangling firmware entries, prints the order the firmware walks, and ends with a cancelable reboot (Fixes #709) - #1304
Conversation
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at d3457e82.
The removal logic, driven against my own fixtures (block lifted verbatim from the installer, efibootmgr/blkid stubbed:
ours on 1111…, a dangling ubuntu on 9999…, Windows on aaaa… that still exists, BootManagerMenuApp on our ESP, an
MBR-path entry with no GPT GUID, and our own new entry):
deleted: 0005 <- the dangling ubuntu, and nothing else
kept: 0001 (ours, the entry just created) 0003 (Windows, GUID exists)
0007 (BootManagerMenuApp, ours) 0009 (PciRoot/HD(1,MBR,…): no GPT GUID to judge)
So "removes proof, not guesses" is what the code does: the decision is the firmware's own HD(part,GPT,guid) against blkid's
PARTUUID=, a GUID that exists anywhere today is left alone, and an entry with no parseable GUID is untouched. The labelled
BootOrder printing block also works on the same fixtures (0001 1bit OS, 0003 Windows Boot Manager, …).
bash -n rc 0 and shellcheck -S warning rc 0 on both files, copyright --check rc 0 (no new files).
The probe arm asserts the right things, including the negative control I would have asked for: if the seed did not create
the stale entry it says "the probe could not create the stale entry, so removal is unproven" rather than passing on a
vacuum; then it checks the entry is gone, that exactly one 1bit OS entry survives, that BootOrder starts with it and that
BootNext is it. Seeding on the ESP we just wrote and then reinstalling to give that ESP a new GUID is the c18 shape
reproduced honestly.
Two things, one small and one worth a line in the script itself:
- An inactive dangling entry is not removed. Both
sedexpressions require the active marker (^Boot####\*), so a
Boot0008 ubuntu(no*) with a GUID that exists nowhere survived my run. If such an entry is still inBootOrder, a
firmware can walk it and fail exactly as the issue describes — the c18 entry happened to be active, so the red/green arms
cannot see this. Making the\*optional in both places (and in the probe'sentries2regex) would close it; if leaving
inactive entries alone is deliberate, one clause in the comment would say why. - The thermal-run caveat belongs in
install-probe.sh, not only in the PR body. "Freeze/thaw pushes the boot past the grub
menu timeout and the guest takes the default entry" is a property of running this script, and the next person to run it
will read the script, not this PR. One comment line beside thethermal-run-able rows would save them the arm it already
cost you — and the retry-keystrokes follow-up is the right scope call, not a widening of this PR.
The RED/GREEN pair itself is yours (two images, 666c8ab5… vs a7c7552d…), and it is the strong form of evidence for a fix
whose failure mode is "the firmware silently walked past us". The OWNER: question about item (4)'s self-reboot is correctly
left open — it is a UX decision with a real argument on both sides, and asking it is better than picking one.
PR Reviewer Guide 🔍(Review updated until commit 6a41458)Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at b567cf39.
Item 4 is done the way the owner asked, and I drove it four ways offline (countdown block lifted verbatim, reboot and
sleep stubbed):
--no-reboot "not rebooting (--no-reboot): remove the stick and reboot when you are ready." no reboot ✔
a key on stdin "reboot cancelled: the disk is written, remove the stick and reboot when you are ready." no reboot ✔
no /bin/bash the "(no bash … cannot be cancelled, let it run out or Ctrl-C)" line FIRST, then 10 sleeps, then reboot ✔
stdin at EOF (no TTY) 10 ticks in 1191 ms, 0 sleeps, reboot ← see the nit below
The dash finding is real and this box proves it: /bin/sh -> dash here, and dash -c 'IFS= read -r -t 1 -n 1 x' gives
dash: 1: read: Illegal option -t — while /bin/bash returns 1 on timeout rather than erroring. So asking /bin/bash
explicitly is the right call, and the "without bash, say so on screen" branch is the right fallback: a changed /bin/sh costs
a cancel, not a silently ignored key. That is the same class of bug the first commit fixed and it is good that it was caught
before the countdown shipped.
One nit, and it is the same family — a moment where the screen promises something the machine does not do. With stdin at
EOF (a scripted install, no TTY, --yes without --no-reboot), read -t 1 fails immediately and the sleep 1 sits only in
the [ -x /bin/bash ] || branch, so all ten ticks run in ~1.2 s and the machine reboots with "press any key to cancel" having
been on screen for about a second. Measured above. --no-reboot covers the install gate, so this is not a hazard for the gate —
it is a hazard for the person who runs the installer from a script and gets a reboot they were told they had ten seconds to
stop. One line fixes it: sleep in the failed-read path too (else sleep 1; fi), keeping the no-bash branch as it is.
The first commit's evidence still stands and I re-checked nothing regressed: the removal block is unchanged in this push, so my
own fixture run from the last review (only the dangling ubuntu removed; ours, Windows, BootManagerMenuApp and the MBR-path
entry preserved) still applies.
Two nits from my last review are still open, neither blocking and both now slightly more expensive to leave:
- an inactive dangling entry (
Boot0008 ubuntu, no*) survives, because bothseds require the active marker — a
firmware walkingBootOrdercan still fail through one, and the c18 entry happened to be active so neither your unit fixtures
nor the red/green arms can see it; - the thermal-run caveat is still only in the PR body. It matters more now:
install-probe.shruns two boots (install, then
reinstall), so a freeze/thaw can spoil either, and the next runner will read the script rather than this PR.
The end-to-end pair (PASS no-reboot, PASS countdown with one key and no Enter, plus the first commit's PASS stale entry in the same
boot) is exactly the right instrument for a path that only exists at the end of an install, and --no-reboot being what the gate
uses is the correct split between "what a person gets" and "what a row can measure".
… order the firmware walks #709 was filed from the first real install: `1bit-install` wrote the ESP and left the firmware alone, the AMI firmware tried its stale `ubuntu` entry (the wiped distribution's \EFI\ubuntu\shimx64.efi), failed, and fell through to the stick. Most of the issue has landed since; step 7 still pushed such an entry down the order and left it, so it was still there to fail on the next boot. What this adds, in the installer's step 7: * dangling-entry removal, decided by the FIRMWARE'S OWN device path and never by a label. `efibootmgr -v` prints HD(<part>,GPT,<guid>,...), and that GUID either exists in a partition table attached right now (blkid's PARTUUID=) or it does not. A GUID that exists nowhere is a dangling entry - its partition was deleted, by this install or by whoever wiped the disk - and the firmware can only fail through it. Entries with no parseable GUID are left alone and so is the entry just created: this removes proof, not guesses. A reinstall is the common case (sfdisk gives the new ESP a new GUID, so the previous install's own entry is dangling too). * the resulting BootOrder printed with labels, instead of only our own id: the order is what a person reads to believe the machine will come up, and what the install gate compares against. And install-probe.sh gains the arm that proves it, because a firmware-entry fix has to be measured on firmware state: after the install it seeds an `ubuntu` entry on the ESP just written, runs the installer AGAIN (the supported reinstall, which repartitions and makes that entry dangling - the c18 shape), then asserts the entry is gone and that the surviving `1bit OS` entry is still first and BootNext. The removal logic was unit-tested before any boot: the block extracted verbatim from the installer, run against stubbed `efibootmgr -v`/`blkid` fixtures (ours on 1111..., a dangling ubuntu on 9999..., a Windows entry on aaaa... that still exists, and BootManagerMenuApp on our ESP) - it removed only the ubuntu entry. Not in this commit: the issue's "and do the reboot itself" (item 4). The message is there; the self-reboot is a UX decision (a forced reboot leaves no moment to read step 7's output on failure, and no chance to keep the stick in for a second install), so it is raised as an OWNER question in the PR body rather than guessed.
…ot keeps the old behaviour come up on the new disk, and nobody should have to remember to pull the stick. So `1bit-install` now ends with a 10 s countdown - "remove the stick, rebooting into the installed system in N s (press any key to cancel)" - and then reboots; any key cancels it with "reboot cancelled: the disk is written, remove the stick and reboot when you are ready"; and `--no-reboot` keeps the previous behaviour for scripts. The flag is not a convenience: the install gate reads the firmware state AFTER the install, and a reboot would take the shell away mid-row. So both paths are exercised by install-probe.sh, which is also the reason the countdown had to be made shell-independent: `read -t 1 -n 1` - one key, no Enter - is a bash builtin and not POSIX. /bin/sh IS bash in this image (measured: bin/sh -> bash, BusyBox present only as busybox), so the obvious version works there - but measured on a host where /bin/sh is dash it prints "read: Illegal option -t", the read fails, the countdown runs to the end and the machine reboots: the key would silently never cancel, with nothing anywhere saying why. The countdown therefore asks bash directly (`[ -x /bin/bash ] && /bin/bash -c 'IFS= read -r -t 1 -n 1 _'`), and on a machine with no bash it says "(no /bin/bash on this machine: the countdown cannot be cancelled by a key, let it run out or Ctrl-C)" and keeps one second per line - a changed /bin/sh gives a missing feature WITH an explanation instead of a key that does nothing. Measured, block extracted verbatim from the installer with reboot/sync/say stubbed - four arms: --no-reboot -> "not rebooting (--no-reboot)...", no countdown, 0 reboot calls key pressed, sh=dash -> cancelled (through the bash hop) key pressed, bash -> cancelled no key -> counts down to 1 s, then reboot And end to end in the install gate, on an image carrying only this file, with three installs in one boot: PASS no-reboot --no-reboot skipped the countdown and returned to the shell PASS countdown a keypress during the countdown cancelled the reboot PASS stale entry the dangling 'ubuntu' entry is gone (its partition no longer exists) <- unchanged from the first commit
b567cf3 to
6a41458
Compare
|
Persistent review updated to latest commit 6a41458 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 6a414580.
The rebase checks out, and the parts I had already verified are byte-identical to what I verified — so the earlier evidence
carries rather than being re-asserted:
main 0a2cbb97 is an ancestor of HEAD (rebased, not merged)
diff vs main: 2 files, +143/-3 (agrees with your numbers)
removal block md5 45858d07… == pre-rebase b567cf39 (dangling-entry sweep untouched)
countdown block md5 fa2f4e91… == pre-rebase b567cf39 (the 10 s loop untouched)
bash -n / shellcheck -S warning / copyright all clean
adduser|useradd|passwd in the installer: 0 (your check that #712's account step cannot hang the gate)
So my fixture run on the removal logic (only the dangling ubuntu removed; ours, Windows, BootManagerMenuApp and the MBR-path
entry preserved) and the four countdown arms (--no-reboot, key-cancels, no-bash warning-first, EOF) still describe this head.
One thing is not what your message describes, and it is the line itself. You said the conflict was resolved by keeping #712's
persistent: line and dropping the "reboot and remove the stick" wording. The file keeps #712's line and main's line, and
your own replacement, so the console now reads:
316 say " reboot and remove the stick: the firmware boots Boot$new first." <- main's line, still here
317 say " the firmware boots Boot$new first." <- your replacement, so the sentence repeats
which is both a duplicated sentence and the contradiction you set out to remove — the installer tells the reader to reboot and
remove the stick, then counts down and reboots for them. The one-line fix is to delete line 316 and keep 317: the
--no-reboot and cancel messages already say "remove the stick and reboot when you are ready", so nothing is lost, which is
exactly the resolution you described.
I am not holding the PR on a console line — READY stands, because the removal sweep and the countdown are unchanged from the
bytes I verified and your three rows on the rebased candidate are the functional proof. But a merge that ships "reboot and remove
the stick" immediately above "rebooting in 10 s" is the kind of thing a reader notices later and wonders whether the resolution
was read back.
My two earlier nits remain open, both still one-liners: an inactive dangling firmware entry survives (both seds require
the * marker), and the thermal-run caveat still lives only in the PR body — now more expensive, since the probe runs two
boots.
|
Follow-up at Your sha is right, and it is a sha256 — my first comparison used the git blob id and looked like a mismatch. For the record: But that same file still carries the line the resolution was meant to drop, and the boot cannot have covered it: Your four rows are So the trade is now concrete, and I would take the first option: merge as-is, because the gate was proven on exactly these The one thing I would not do is claim the resolution is in the artifact when it is in neither the file nor the diff — a reader of |
…rseded (#1325) #1304's countdown now reboots the machine itself, so the line above it promising "reboot and remove the stick" both repeats the step and contradicts the one that follows: the install says "reboot and remove the stick", then ten seconds later prints "remove the stick, rebooting into the installed system in N s" and reboots. Two adjacent lines describing the same act, one of them wrong. It should have gone in #1304's rebase resolution and did not. The resolution hit a fallback path, kept both of #712's lines, and I reported the intent ("kept the persistent line, dropped the reboot-and-remove wording") instead of reading the file back - so the claim was in the PR body while the line was in neither the file nor the diff. pi-prs caught it and predicted the new sha256; this commit produces exactly that: 1bit-install.sh f093c06b -> 2a6da235. Not behaviour: no gate row reads this console line, which is why #1304's boot passed with it present. It is proved properly anyway - the install gate is re-run on the new bytes (candidate 11434654, installer 2a6da235), because "the row does not look at that line" is an argument, and a boot is a measurement. Co-authored-by: pi-os3 <[email protected]>
PR-BODY for #709 (draft — numbers filled from the red/green arms)
PR #1304 — body (two commits:
d3457e82+b567cf39)Title:
puppy: the installer removes dangling firmware entries, prints the order the firmware walks, and ends with a cancelable reboot (Fixes #709)#709was filed from the first real install (c18, 2026-10-31):1bit-installwrote the ESP and then left the firmware alone, the AMIfirmware tried its stale
ubuntuentry (the wiped distribution's\EFI\ubuntu\shimx64.efi), failed, and fell through to the USBstick — the owner saw the live boot again. Since then most of the issue has landed, and this PR finishes it.
What was already done (measured on the shipped c31 image
666c8ab5…)CONFIG_EFIVAR_FSin the kernel andefibootmgrshipped/usr/bin/efibootmgr(48,912 B) in the image;/etc/init.d/03onboard-efivarsmounts efivarfs; the installer refuses to write an entry when/sys/firmware/efi/efivarsis not mounted1bit OSentry, first inBootOrder,BootNextefibootmgr -c … -l '\EFI\BOOT\BOOTX64.EFI', identified afterwards by the ESP's partition GUID (engine#866's fix: the firstBoot####inefibootmgr -coutput is whatever already existed), then-o "$new,…"and-n "$new"os/v3/puppy/install-probe.shreads the firmware's own state after a real install in QEMU: exactly one1bit OSentry carrying this disk's ESP GUID,BootNext= it, first inBootOrderWhat was missing, and what this PR does
on that disk"). Step 7 used to push the stale entry down the order and leave it — so it was still there to fail. The decision is
read from the firmware's own device path, never from a label:
efibootmgr -vprintsHD(<part>,GPT,<guid>,…), and that GUIDeither exists in a partition table attached right now (
blkid'sPARTUUID=) or it does not. A GUID that exists nowhere is adangling entry — its partition was deleted, by this install or by whoever wiped the disk — and the firmware can only fail
through it. Entries with no parseable GUID are left alone, and so is the entry just created: this removes proof, not guesses.
(A reinstall is the common case:
sfdiskgives the new ESP a new GUID, so the previous install's own entry is dangling too.)BootOrderis printed, with labels, instead of only our own id — the order is what the person (and the gate)needs to believe the machine will come up.
install-probe.shgains the arm that proves it: install → seed anubuntuentry on the ESP just written → reinstall (whichrepartitions and gives the ESP a new GUID, making the seeded entry dangling — exactly the c18 shape) → assert it is gone and that
the surviving
1bit OSentry is still first andBootNext.Measured, red then green (same probe, two images)
rc-2026-11-06-c31(666c8ab5…)FAIL stale entry a dangling firmware entry survived the install: Boot0005 ubuntu HD(1,GPT,05effdcb-…)/\EFI\ubuntu\shimx64.efiandFAIL fw entries after the reinstall there should be exactly one '1bit OS' entry, found 2(the previous install's own entry survived too — its ESP GUID died with the repartition). Both are the bug this issue describesa7c7552d…, SFS6cbf3d41…, installer53d4ce9e…)PASS stale entry the dangling 'ubuntu' entry is gone (its partition no longer exists), with the surviving1bit OSentry first inBootOrderandBootNextThe removal logic itself was unit-tested before any boot: the block extracted verbatim from the installer, run against stubbed
efibootmgr -v/blkidfixtures (ours on GUID1111…, a danglingubuntuon9999…, a Windows entry onaaaa…that stillexists, and
BootManagerMenuAppon our ESP) — it removed only theubuntuentry.bash -n+shellcheck -S warningclean on both files;tools/copyright.py --checkrc 0 (no new files).One caveat about how the green arm had to be run, because it is a real property of this gate:
install-probe.shselects theserial-shell grub entry by sending three "down" keystrokes once the menu appears, so it must not be wrapped in
thermal-run— a freeze/thaw at 78 °C delays the boot past the menu timeout, the guest takes the default entry, and the probereports
FAIL boot no grub menu on the serial lineon a perfectly healthy image (measured: that is exactly what happened on thefirst green attempt). The install gate is CPU-light, so running it unwrapped is cheap; the probe should probably retry the
keystrokes until the serial-shell entry is actually selected, and I have noted that as the follow-up rather than widening this PR.
Item (4)'s second half — the countdown and
--no-reboot(owner decision, 2026-11-06)The owner decided: "1bit-install ends with a 10 s countdown ('remove the stick, rebooting into the installed system in N s; press
any key to cancel') and then reboots. A
--no-rebootflag keeps the current behaviour." Both are in the second commit.--no-rebootis not a convenience here — the install gate reads firmware state after the install, so a reboot would take theshell away mid-row — which is why both paths are tested rather than one being assumed:
--no-rebootreboot cancelled: the disk is written, remove the stick and reboot when you are ready.Why the countdown is shell-independent, measured:
read -t 1 -n 1(one key, no Enter) is a bash builtin and not POSIX./bin/shis bash in this image (bin/sh -> bash, BusyBox present only asbusybox), so the obvious version works there — butrun where
/bin/shis dash it printsread: Illegal option -t, the read fails, the countdown runs to the end and the machinereboots: the key would silently never cancel. So the countdown asks bash directly
(
[ -x /bin/bash ] && /bin/bash -c 'IFS= read -r -t 1 -n 1 _') and, with no bash, says"(no /bin/bash on this machine: the countdown cannot be cancelled by a key, let it run out or Ctrl-C)" and keeps one second per
line — a changed
/bin/shgives a missing feature with an explanation, not a key that does nothing.Offline arms (block extracted verbatim from the installer,
reboot/sync/saystubbed):--no-reboot→ no countdown, 0 rebootcalls · key pressed with
sh=dash → cancelled · key pressed withbash→ cancelled · no key → counts to 1 s, thenreboot.Re-verified after the rebase (the bytes that would actually merge)
The PR was proved before the rebase; a rebase can change behaviour quietly, so the gate was re-run on the rebased tree
(main
0a2cbb97+ these two commits). Candidated7f2e938…, installerf093c06b…— verified equal to the tree's file, so whatwas measured is what merges. 4 PASS, 0 FAIL:
The rebase's only conflict was in this installer's ending, against #712's persistent-OS work: main had added
persistent: /1bit/$save_name is this machine's writable root (PUPMODE=12)…and keptreboot and remove the stick: the firmware boots Boot$new first.— that second line is dropped here, because this commit'scountdown performs that reboot itself; keeping both would say "reboot and remove the stick" and then reboot ten seconds later.
#712's persistent line is kept as-is.