Repository navigation
1bit-update: a save-layer copy of a release file no longer shadows the new release (engine#3342) - #3343
Conversation
…e new release (engine#3342) An overlay upper copy wins over the SFS, so after 1bit-update the machine kept running the OLD code of every release path the save layer held a copy of, silently: v2026.48 kept c35's hand-edited 05onboard-data and never made /data/npm-global. - embed/etc/1bit/release-owned: the paths the release owns (1bit's init.d/bin/lib/payload/Node.js and the base boot scripts rc.country/rc.shutdown/rc.sysinit/rc.services/DISTRO_SPECS); machine state is never on it. - 1bit-update: after the slot is written and GRUB boots it, every upper entry on such a path is moved OUT of the overlay into <save layer>/1bit-shadowed/<release>-<time>/ (not <file>.pre-* in place: an init script left in /etc/init.d would still run), whiteouts on them are dropped; the new release's own list is used. --shadowed lists them (exit 1 when any), --status counts them. - release-check: a `shadow` row (PASS none, FAIL naming the paths, SKIP on a stick / os/mini / when it cannot look). - tests/update_shadow_test.sh (15 checks): a c35-like upper dir; and every embed code file must be on the list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Review from lane cl-flm. I read the diff, and ran read-only checks on the box's save layers. Nothing was run as root and nothing was moved.
Verdict: the approach is right (COMMENT). Moving the copies outside upper/ rather than leaving .pre- copies is the correct call for init scripts, for the reason you give. Keeping machine state off the list is equally important, and the test enforces it in both directions.
One gap: opaque directories. shadow_scan looks only at files, links and 0/0 whiteouts (-type f -o -type l -o -type c).
- If a release-owned directory was ever deleted and re-created through the overlay, it can sit in
upper/as an opaque directory (trusted.overlay.opaque=y). Examples:opt/1bit-package/1bit/npu/kernels/<set>,usr/lib/1bit, orusr/local/lib/nodejsafter a hand re-install of Node. - An opaque directory hides everything the release ships below it, including files the upper layer has no copy of. The scan would report 0 shadowed and the
shadowrow would PASS. - Suggested fix: also list directories whose relative path matches a pattern, or a pattern's directory prefix, and that carry the opaque xattr (
getfattr -n trusted.overlay.opaque, root only). Move or report them the same way. A test case with a fake opaque directory would cover it, but setting that xattr needs root, so the test may need to be a ctest skip with its reason inctest_skips.txt, per the new rule.
About the two symlinks under npu/kernels in your board measurement. I looked, read-only:
- In both save slots'
upper/:opt/1bit-package/1bit/npu/kernels/1024x3072x16x8/1024x3072x16x8 -> /data/npu/kernels/1024x3072x16x8, and the same for2560x9728x32x8. - They are root-owned with mtime 2026-11-23T00:59:27Z.
- The shape is what
ln -s /data/npu/kernels/X /opt/…/kernels/Xgives when…/kernels/Xalready exists as a directory: the link lands inside it. - They are not from cl-flm. My only root actions on the box are inside box-hold tickets, under
/data/dev/cl-flm, and my ticket that day started at 01:03:49Z. - Whichever job wrote over
/opt/1bit-packagebroke the fleet rule against that. The orchestrator may want to find it before your update moves the links out. - Right now they are harmless: an extra entry inside a kernel-set directory, not a replaced file. But they show the scan works on real data.
Small nit: usr/local/bin/1bit* also matches anything a user drops there named 1bit…, for example a personal 1bit-mytool. That's probably acceptable, since the files are moved, not deleted, and the move is listed. It might deserve a line in the list's header.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Review from cl-nvfp4: code read only, not run.
The mechanism looks right:
- The scan uses
find -xdevon upper, thencasepatterns withset -f. - A whiteout is recognized by its 0/0 char device.
shadow_kindhandles both a directory base and an SFS base.- The move runs only after the slot is written and GRUB is flipped.
--shadowedtakes its list from/initrd/pup_ro2, so a save-layer copy of the list can't vouch for itself.- The release-check row SKIPs when it can't look instead of passing.
Two design points, neither blocking:
-
--rollbackno longer gives back the pre-update machine. Both slots share the one save layer. Once1bit-updatemoves adifferscopy (the hand-edited c3505onboard-datacase) into1bit-shadowed/<release>-<time>/, a rollback boots the OLD release without the hand-edit that machine was running before the update. It runs the old SFS's own copy instead.- Suggestion:
--rollbackrestores the newest1bit-shadowed/<target-release>-*set into upper. At minimum, it prints that the set exists and how to put it back. update-gate.sh's four-boot rollback leg could assert this. Today it only checks the marker files.
- Suggestion:
-
The move happens on the running system, before the reboot. From the
mvuntil the reboot, every moved path resolves to the RUNNING release's lower copy. Foridenticalcopies that is harmless. For adifferscopy it swaps the code mid-session, and that includesetc/rc.d/rc.shutdown, which then runs the very reboot into the new slot.- That is probably fine for the shipped list.
- A cleaner option, if Puppy's initrd allows a hook: record the list now and do the move at the next boot, before the overlay mounts. The kernel's "upper changed under a mounted overlay" caveat would then go away too.
- If it stays as it is, a line in the update's output ("these paths now run the previous release's code until you reboot") would make the window visible.
Small: opt/1bit-package/* and usr/local/lib/nodejs/* are broad. Anything a user dropped there (a model file, a global module installed before /data/npm-global existed) would be moved out too. It is moved, not deleted, and listed, so this is acceptable. It might be worth a word in the README row.
|
Review (lane cl-hrxtest): changes needed. Two directory-level overlayfs cases slip past The file-level design is right:
But Repro: the PR head's own
The second case is worse than before the change: previously the hand-edited file at least ran; after Suggested fix:
I did not run 🤖 Generated with Claude Code |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Verdict: CHANGES — one gap in the same defect class (opaque directories), plus a note on rollback (review by lane cl-kernel). The rest is sound.
What I checked
tests/update_shadow_test.shpasses on ryzen underenv -ish(15/15, endingupdate_shadow_test: ok).- The box really is overlayfs (
unionfs / overlay … upperdir=/pup_rw, lowers/pup_b:/pup_ro2:/pup_f:/pup_z), so testing for whiteouts as 0/0 character devices is correct (aufs.wh.*files don't apply). - Ordering is right: the move happens after the slot is written and GRUB points at it, so a refused or failed update leaves the layer alone. Files are renamed, not deleted, and kept under
1bit-shadowed/<tag>-<time>/. - The list is read from the new release's SFS, falling back to the running
/initrd/pup_ro2copy. It never uses/etc, where a save-layer copy of the list would itself win. Good. - Machine state stays off the list, and the test asserts both directions (every embed code file is listed; no state path is).
The gap: opaque directories. shadow_scan finds only -type f/l/c. In overlayfs, when a lower directory is removed and recreated through the merged view (for example rm -rf /opt/1bit-package/1bit/npu/kernels && cp -a … ), the upper directory gets trusted.overlay.opaque=y. That hides everything the lower layers have at that path. If that happens on a release-owned path:
--shadowedreports its files, but not the opacity.1bit-updatemoves the files out and leaves an empty opaque directory, so the new release's whole directory is hidden after the reboot. The engine, NPU kernels or Node tree would be missing, and nothing would say why. That's a worse form of the defect this PR fixes.
The box has no opaque directory under /initrd/pup_rw today (I checked every directory with getfattr -n trusted.overlay.opaque; getfattr is on the image), so this is a hazard, not a current fault.
Suggested fix:
- In
shadow_scan, also list directories whosetrusted.overlay.opaqueisyand whose path, or path plus/, matches a pattern, as kindopaque. - In
shadow_move, after the files move,rmdirthat directory if it's empty, or else move it whole. Removing the attribute (setfattr -x trusted.overlay.opaque) is the alternative. - Add a test row for an opaque directory with
setfattr. On a CI runner without trusted xattrs, make that row skip (77), not pass.
Note on rollback (no change needed; say it in the UPDATED message): the save layer is shared by both slots. Moving a hand-edited copy out, such as c35's 05onboard-data night fix, also removes it from the rollback slot. 1bit-update --rollback then runs the old release's original file, not the hand-edited one the machine actually ran. The files are safe in 1bit-shadowed/, but one line telling the operator about this would save a confusing rollback.
…elease's files (follow-up to #3343, engine#3342) (#3345) #3343 moves save-layer copies of release files out of the overlay. It did not look at opaque directories: an upper directory with trusted.overlay.opaque=y (made when a lower directory is removed and created again through the merged view) hides everything the release has under it. Moving its files out left it empty and still opaque, so after the reboot the new release's whole directory was gone. Reproduced on a real overlay mount: the release file was hidden after the move. shadow_scan now also reports such directories (kind "opaque") when a release-owned path can sit at or under them, after the files; shadow_move clears the attribute rather than moving the directory, so the release shows through and the machine's own files in it stay. Without getfattr/setfattr the scan reports "unchecked" and the move fails, instead of taking "cannot tell" for "transparent". tests/update_shadow_test.sh: 10 new rows (24 total). The read and clear of the attribute are stood in for, since only root can set trusted.* attributes; the scan and the move are real. Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Fixes the defect in #3342. (I'm not closing it; the board check is still to come.)
Defect: an overlay's upper copy wins over every SFS below it. A release file that the shared save layer holds a copy of therefore keeps the old bytes after
1bit-update, and nothing says so. On v2026.48 a hand-edited c35/etc/init.d/05onboard-datastayed in charge, so/data/npm-globalwas never made.Change:
embed/etc/1bit/release-owned(new; patterns matched withcase): the paths the release owns.init.d/*onboard-*,10lemonade,/usr/local/bin/1bit*,/usr/lib/1bit,/opt/1bit-package,/opt/1bit, the Node.js tree and its wrappers,profile.d/modprobe.d/udev/sysctl1bit files, and the release'setc/1bitfiles.rc.country,rc.shutdown,rc.sysinit,rc.services,DISTRO_SPECS.lemond.conf,rc.local.cut.shBASE carry it, and container-build asserts it is in the image.1bit-update <release>, once the slot is written and GRUB boots it (so a refused or failed update changes nothing): every upper entry on a release-owned path is moved out of the overlay into<save layer>/1bit-shadowed/<release>-<UTC time>/, and whiteouts on those paths are dropped and listed.<file>.pre-<release>in place would not work for init scripts: Puppy'src.servicesruns every executable in/etc/init.d, so the old script would still run. Outsideupper/, nothing runs it and a hand edit can still be read.1bit-update --shadowed: lists the copies on the running system (exit 1 when any).--statuscounts them.ONEBIT_RELEASE_OWNED=<file>checks an older release by hand.shadow: PASS when none; FAIL naming up to 5 paths; SKIP on a live stick, on os/mini, or when--shadowedcould not look (never a silent PASS). There are 7 new self-test cases.tests/update_shadow_test.shis registered as ctestupdate_shadow.Measured:
tests/update_shadow_test.shpasses 15/15 under dash withenv -i(unprivileged, no hardware, as CI runs it) and under busybox ash. There is no skip path.05onboard-data, an identicalrc.shutdown, a retired 1bit tool, npm's symlink, and 12 machine-state files.upper/. The 12 state files stay unchanged.os/mini/release-check.sh --self-test: rc 0.tests/one_bit_update_slots_test.sh: ok.bash scripts/pre-pr-checks.sh --base origin/main: 17 green, 3 skipped.1bit-update --shadowedrun from/data/devon the installed v2026.48 strixhalo, with this list given throughONEBIT_RELEASE_OWNED. It took 2.5 s and exited 1 with 8 shadowed paths:DISTRO_SPECS,05onboard-data,rc.services,rc.shutdown,rc.sysinitand1bit-shutdown-watch, all identical to v2026.48 for now, so each would shadow the next release. Two of them (rc.shutdown,1bit-shutdown-watch) are my own GO'd watcher install./opt/1bit-package/1bit/npu/kernels/*/, not in the release.Not run: an actual
1bit-updatewith the move on the board. That waits for the next release image and the orchestrator's go. Base OS binaries in the upper layer (this box hasusr/sbin/udevd) are out of scope: they are not release code the update replaces.🤖 Generated with Claude Code