Repository navigation
os/v3/puppy: every reboot leaves its kernel log tail in EFI pstore, and the next boot files it (engine#3287) - #3306
Conversation
…nd the next boot files it (engine#3287) The c35 installer's reboot froze the AI MAX+ 395 and left nothing to read: the stick boot it ran from logged its `shutdown` snap at 11:37:29Z with a tail identical to three good reboots, and efi_pstore (loaded, registered at 4.2 s) held no record, because without printk.always_kmsg_dump it records only oopses and panics. - mkimage.sh: printk.always_kmsg_dump=1 on every entry (REFUSED without it). kernel_restart() then dumps the log tail after "reboot: Restarting system", into NVRAM, which survives the power-cycle a freeze needs. - 1bit-logs pstore [dir]: copies /sys/fs/pstore records into <boot>/pstore/, deletes each only after cmp, and writes a markers verdict: the kernel's own reset line (firmware hang after it), a crash, or no record (never reached the reset). The daemon runs it once per boot. - tests/pstore_harvest_test.sh (9 rows, no root). Co-Authored-By: Claude Opus 5.5 <[email protected]>
117f454 to
f93ba5b
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
…rs - it now takes the new release's own line The other slot's GRUB `linux` line was built from the RUNNING slot's line with only psubdir= replaced (os/v3/puppy/embed/usr/local/bin/1bit-update:774-777 before this change). So every kernel parameter a release added, dropped or changed after the machine was installed was lost by update. Measured on the issue's installed v2026.48 (updated from c35): /proc/cmdline carried no printk.always_kmsg_dump=1, although mkimage.sh puts it on every image's line and refuses an image without it (os/v3/puppy/mkimage.sh:146,214) - that boot therefore left no pstore record for #3306. An install carries the parameters of the release it was installed from for the machine's whole life. The release now carries its own headless parameters beside the set it ships, and the update builds the other slot's entries from THAT line, putting back only the keys that name this machine: - os/v3/puppy/mkimage.sh:152: ONE variable builds the image's `linux` lines and the release's own line; :244 writes it to /1bit/cmdline on the set the data partition ships (not in SHA256SUMS - it is a line of text an update reads, not a bootable file it installs), so the image's grub.cfg and the file cannot disagree. A release directory made from that /1bit carries it too. - 1bit-update:490 boot_param / :496 release_headless / :506 slot_params read it - bare parameters or a whole `linux <kernel> <params>` line, CRLF and #/blank lines included - and merge: the release's parameters as they are, with this machine's `pupsfs=UUID=`, `1bit.data=UUID=` and `psubdir=<target>` taken from the running entry, and `pfix=copy` -> `pfix=nocopy` for an installed disk, exactly the set 1bit-install.sh rewrites (os/v3/puppy/1bit-install.sh:206-211). A release that names a UUID pin the running line cannot fill in is refused by name: the image's own UUID would point the new slot at the release stick's partition. - 1bit-update:836-912 writes the slot's headless AND serial entries from that line. An entry that already exists is rewritten in place and keeps its own kernel path; a missing one is appended, so a slot written by 1bit-install stops booting the installed release's parameters after an update and no entry accumulates. The image's desktop and install-to-disk entries are its own boot modes and are not touched. The written line is read back and compared with what this run wrote before `set default` moves (:912); a mismatch restores grub.cfg. - A release cut before this (no /1bit/cmdline) is updated exactly as before, and the update warns that a parameter this release changed does not arrive. Evidence (ryzen, configured Release tree; no device, no VM, no reboot): 1. CONTROL - origin/main's 1bit-update (sha256 9b38558c2da05e41...) with THIS branch's test file (new test, old code): $ git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > ~/.cache/scratch-3374/oldroot-3374/.../1bit-update $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh <that script> ... FAIL the /1bit-alt boot line carries the NEW release's added parameter (printk.always_kmsg_dump=1; the installed line had none) FAIL the /1bit-alt serial root shell entry carries it too FAIL the update says where the /1bit-alt line came from FAIL GRUB's default is /1bit and its line carries the parameter release B CHANGED (log_buf_len=64M, not 32M) FAIL with this machine's UUID pin (not release B's) and release B's added parameter FAIL the /1bit serial entry got the changed value too FAIL the /1bit line is not the one 1bit-install wrote any more FAIL the update says it rewrote the existing entries control_rc=1, 26 ok / 8 FAIL the line the old script wrote: linux /1bit-alt/vmlinuz pmedia=atahd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt nvme.quirks=1e49:1081:dmapool_align_512 log_buf_len=32M (no printk.always_kmsg_dump=1; release A's cmdline had it) 2. BRANCH - same test, same command, the tree's script: $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh /1bit-alt headless entry: linux /1bit-alt/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt log_buf_len=32M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0 /1bit headless entry: linux /1bit/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit log_buf_len=64M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0 (release B CHANGED 32M->64M) ok the /1bit desktop entry keeps the installed line (1bit-update writes a slot's headless and serial entries only) ok the existing entries were rewritten in place: still 6 menu entries, none duplicated fix_rc=0, 34 ok / 0 FAIL The fixture ESP is the image's real FOUR-entry menu (headless, desktop, install-to-disk, serial), so the serial line rewritten is entry 3 - not the entry next to the headless one - and the two modes 1bit-update does not own are asserted byte-identical to what 1bit-install left. 3. UNIT ROWS (tests/one_bit_update_slots_test.sh, sourced functions, no root): branch: 33 ok, exit 0. control (same rows, origin/main's script in a stub root): 23 ok / 10 FAIL, exit 1 - slot_params/release_headless do not exist there. 4. ctest, the two rows this change touches: 55 one_bit_update_slots Passed; 89 update_e2e_loop Passed (as root, with ONEBIT_E2E_TMP pointing inside ~/.cache so no scratch lands in /tmp or /var/tmp). 5. scripts/pre-pr-checks.sh --tree-only --base origin/main: pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only) (the 2 skips are hip_f16_audit and kernel_id_selftest: no gpu-kernels tree on this box.) Refs #3374. The host-side criterion is met; one real update followed by a boot on an installed machine (/proc/cmdline has the parameter, and the next boot files the pstore record) still needs hardware and a reboot, and was not run here.
…rs - it now takes the new release's own line (#3465) The other slot's GRUB `linux` line was built from the RUNNING slot's line with only psubdir= replaced (os/v3/puppy/embed/usr/local/bin/1bit-update:774-777 before this change). So every kernel parameter a release added, dropped or changed after the machine was installed was lost by update. Measured on the issue's installed v2026.48 (updated from c35): /proc/cmdline carried no printk.always_kmsg_dump=1, although mkimage.sh puts it on every image's line and refuses an image without it (os/v3/puppy/mkimage.sh:146,214) - that boot therefore left no pstore record for #3306. An install carries the parameters of the release it was installed from for the machine's whole life. The release now carries its own headless parameters beside the set it ships, and the update builds the other slot's entries from THAT line, putting back only the keys that name this machine: - os/v3/puppy/mkimage.sh:152: ONE variable builds the image's `linux` lines and the release's own line; :244 writes it to /1bit/cmdline on the set the data partition ships (not in SHA256SUMS - it is a line of text an update reads, not a bootable file it installs), so the image's grub.cfg and the file cannot disagree. A release directory made from that /1bit carries it too. - 1bit-update:490 boot_param / :496 release_headless / :506 slot_params read it - bare parameters or a whole `linux <kernel> <params>` line, CRLF and #/blank lines included - and merge: the release's parameters as they are, with this machine's `pupsfs=UUID=`, `1bit.data=UUID=` and `psubdir=<target>` taken from the running entry, and `pfix=copy` -> `pfix=nocopy` for an installed disk, exactly the set 1bit-install.sh rewrites (os/v3/puppy/1bit-install.sh:206-211). A release that names a UUID pin the running line cannot fill in is refused by name: the image's own UUID would point the new slot at the release stick's partition. - 1bit-update:836-912 writes the slot's headless AND serial entries from that line. An entry that already exists is rewritten in place and keeps its own kernel path; a missing one is appended, so a slot written by 1bit-install stops booting the installed release's parameters after an update and no entry accumulates. The image's desktop and install-to-disk entries are its own boot modes and are not touched. The written line is read back and compared with what this run wrote before `set default` moves (:912); a mismatch restores grub.cfg. - A release cut before this (no /1bit/cmdline) is updated exactly as before, and the update warns that a parameter this release changed does not arrive. Evidence (ryzen, configured Release tree; no device, no VM, no reboot): 1. CONTROL - origin/main's 1bit-update (sha256 9b38558c2da05e41...) with THIS branch's test file (new test, old code): $ git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > ~/.cache/scratch-3374/oldroot-3374/.../1bit-update $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh <that script> ... FAIL the /1bit-alt boot line carries the NEW release's added parameter (printk.always_kmsg_dump=1; the installed line had none) FAIL the /1bit-alt serial root shell entry carries it too FAIL the update says where the /1bit-alt line came from FAIL GRUB's default is /1bit and its line carries the parameter release B CHANGED (log_buf_len=64M, not 32M) FAIL with this machine's UUID pin (not release B's) and release B's added parameter FAIL the /1bit serial entry got the changed value too FAIL the /1bit line is not the one 1bit-install wrote any more FAIL the update says it rewrote the existing entries control_rc=1, 26 ok / 8 FAIL the line the old script wrote: linux /1bit-alt/vmlinuz pmedia=atahd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt nvme.quirks=1e49:1081:dmapool_align_512 log_buf_len=32M (no printk.always_kmsg_dump=1; release A's cmdline had it) 2. BRANCH - same test, same command, the tree's script: $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh /1bit-alt headless entry: linux /1bit-alt/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt log_buf_len=32M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0 /1bit headless entry: linux /1bit/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit log_buf_len=64M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0 (release B CHANGED 32M->64M) ok the /1bit desktop entry keeps the installed line (1bit-update writes a slot's headless and serial entries only) ok the existing entries were rewritten in place: still 6 menu entries, none duplicated fix_rc=0, 34 ok / 0 FAIL The fixture ESP is the image's real FOUR-entry menu (headless, desktop, install-to-disk, serial), so the serial line rewritten is entry 3 - not the entry next to the headless one - and the two modes 1bit-update does not own are asserted byte-identical to what 1bit-install left. 3. UNIT ROWS (tests/one_bit_update_slots_test.sh, sourced functions, no root): branch: 33 ok, exit 0. control (same rows, origin/main's script in a stub root): 23 ok / 10 FAIL, exit 1 - slot_params/release_headless do not exist there. 4. ctest, the two rows this change touches: 55 one_bit_update_slots Passed; 89 update_e2e_loop Passed (as root, with ONEBIT_E2E_TMP pointing inside ~/.cache so no scratch lands in /tmp or /var/tmp). 5. scripts/pre-pr-checks.sh --tree-only --base origin/main: pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only) (the 2 skips are hip_f16_audit and kernel_id_selftest: no gpu-kernels tree on this box.) Refs #3374. The host-side criterion is met; one real update followed by a boot on an installed machine (/proc/cmdline has the parameter, and the next boot files the pstore record) still needs hardware and a reboot, and was not run here. Co-authored-by: bong-water-water-bong <[email protected]>
Part of #3287 (the c35 installer's reboot froze the box and left no log).
What the box showed (read-only, AI MAX+ 395, c35 installed, 22 Nov):
/dev/sda2logs/20261122T113620-70c2a31d) wrote itsshutdownmarker at 11:37:29Z. Its messages/dmesg tail (sshd TERM, bluetoothd exit,deregistering interface driver snd-usb-audio) is the same as three reboots that came back (stick 10:31Z, stick 14:23Z, NVMe 14:18Z). Everything on/datacomes from userspace, so the freeze happened after our last save and nothing there can say where.pstore: Registered efi_pstore as persistent store backendat 4.19 s) and the store is empty. Withoutprintk.always_kmsg_dumpit records only oopses and panics. In the 7.4 source, efi_pstore leavesmax_reasonundefined, so with the parameter on,kernel_restart()callskmsg_dump(KMSG_DUMP_SHUTDOWN)right afterreboot: Restarting system.Change
mkimage.sh: addsprintk.always_kmsg_dump=1to every grub entry. The build is refused without it, like the other boot-line guards. The installer copies the stick's grub.cfg, so installed disks get it too.1bit-logs pstore [dir]: copies each/sys/fs/pstorerecord into<boot>/pstore/and deletes it only aftercmppasses. Deleting a record frees its EFI variable, so NVRAM does not fill up. It writes one line tomarkers:The daemon runs it once per boot, after the mount wait.
tests/pstore_harvest_test.sh: 9 checks on fake records (ONEBIT_PSTORE), no root needed. Registered as ctestpstore_harvest.Measured
sh tests/pstore_harvest_test.sh: 9/9 ok on ryzen.1bit-logs pstore /data/dev/cl-release/booton the box mounted pstore and wrotepstore: no record from the previous shutdown. That is correct, because the parameter was off for that boot.scripts/pre-pr-checks.sh --base origin/main: 16 green, 3 skipped (no gpu-kernels tree / submodules), andcmake_configure_checkcould not tell (configure did not finish within 300 s on ryzen).🤖 Generated with Claude Code