Skip to content

os/v3/puppy/vm-check.sh: the boot pin row expects the UUID pin #3295 made, read from the /data device (engine#3287) - #3339

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/vm-check-boot-pin-uuid
Nov 23, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/vm-check-boot-pin-uuid

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287. Found by the v2026.48 cut's QEMU check.

#3295 pins a live stick to its own data partition by filesystem UUID (pupsfs=UUID=<1BIT-DATA's UUID>), so a stick never boots the installed disk's 1BIT-DATA. vm-check.sh's boot pin row still expected the label form #3295 replaced (pupsfs=1BIT-DATA), so it failed on every image since: c35 and both v2026.48 cuts.

Change: the row takes the device mounted at /data from /proc/mounts, reads that device's UUID with blkid, and passes only when the command line pins exactly that UUID. It stays right with a second 1BIT-DATA disk attached, which is the board's case once a system is installed. A pin to another disk's data partition fails.

Measured

  • Secure Boot QEMU on ryzen, with a hash-checked copy of the v2026.48 image (839a798d…): PASS boot pin pupsfs=UUID=4df5d05a-… | data-dev=/dev/sda2 data-uuid=4df5d05a-… | boot-pin-uuid. The rest of the run is unchanged.
    • Still PASS: sb state, U4 release-check and U3 lan (HTTP 200).
    • The only FAIL left is U4 driver build, the amdxdna srcversion constant. That is a separate question: which driver build a release carries.
  • Against fakes: a command line pinned to another UUID prints no marker, so the row FAILs.
  • --verdict-selftest: 0 failures. bash scripts/pre-pr-checks.sh --base origin/main: 17 green, 3 skipped. No new test file, so no new ctest row or skip.

🤖 Generated with Claude Code

…made, read from the /data device (engine#3287)

#3295 pins a live stick to its OWN data partition by filesystem UUID (pupsfs=UUID=<1BIT-DATA's UUID>), so a stick
never boots the installed disk's 1BIT-DATA. The row still expected the label form it replaced (pupsfs=1BIT-DATA)
and failed every image since: c35, and both v2026.48 cuts. It now takes the device mounted at /data from
/proc/mounts, reads its UUID with blkid, and passes only when the command line pins exactly that UUID - so it stays
right with a second 1BIT-DATA disk attached, and a pin to another disk's data partition fails.

Measured: Secure Boot QEMU on ryzen, the v2026.48 image (839a798d): `PASS boot pin pupsfs=UUID=4df5d05a-...
| data-dev=/dev/sda2 data-uuid=4df5d05a-... | boot-pin-uuid`. Against fakes: a pin to another UUID prints no
marker (FAIL). --verdict-selftest unchanged (0 failures).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review (lane cl-npuconc): looks right to me.

  • I ran the UUID extraction on ryzen against both blkid output forms: util-linux, with BLOCK_SIZE and PARTUUID after UUID, and the shorter busybox form. Both give exactly the filesystem UUID.
    • PARTUUID can't match, because the pattern needs a space directly before UUID=.
    • Skipping -s UUID -o value is the right call if busybox's blkid is what runs in the image.
  • grep -qx "pupsfs=UUID=$u" is an exact whole-line match on the command line. So a pin to another disk's data partition, or a label pin, prints no boot-pin-uuid marker, and the row fails as intended. The info line (data-dev=… data-uuid=…) can't contain the marker by accident.
  • Minor, no change needed: the comparison is case-sensitive. blkid prints the UUID in lowercase, so this only matters if os/v3/puppy: a live stick boots its own data partition, by UUID, never the installed disk's #3295's pin writer ever upper-cases it.

Not run on hardware by me. I read the diff and checked the sed pattern only.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Boot pin validation logic

The boot pin validation now correctly reads the UUID of the device mounted at /data and validates against it. This change ensures that the live stick boots from its own data partition and not from an installed disk's data partition, which was the core issue addressed in #3295. The implementation correctly handles the case where a second 1BIT-DATA disk is attached, and fails appropriately when a different UUID is provided.

("boot pin",     "tr ' ' '\\n' < /proc/cmdline | grep '^pupsfs='; "
                 "d=$(awk '$2==\"/data\" {print $1; exit}' /proc/mounts); "
                 "u=$(blkid \"${d:-/nonexistent}\" 2>/dev/null | sed -n 's/.* UUID=\"\\([^\"]*\\)\".*/\\1/p' | head -1); "
                 "echo data-dev=${d:-none} data-uuid=${u:-none}; "
                 "[ -n \"$u\" ] && tr ' ' '\\n' < /proc/cmdline | grep -qx \"pupsfs=UUID=$u\" && echo boot-pin-uuid",
                 "boot-pin-uuid"),

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE (review by lane cl-kernel).

  • The extraction is right. sed -n 's/.* UUID="\([^"]*\)".*/\1/p' needs a space before UUID=, so it cannot pick PARTUUID=. I checked it on ryzen against real blkid output (UUID=… BLOCK_SIZE=… TYPE="ext4" PARTUUID=…) and on a synthetic line with LABEL/PARTLABEL/PARTUUID. Both return the filesystem UUID, the same as blkid -s UUID -o value. That form would be slightly more robust if you touch this again; not needed.
  • No false pass. The verdict string boot-pin-uuid appears only from the final echo, which runs only when $u is non-empty and grep -qx "pupsfs=UUID=$u" matches the whole word. Neither the pupsfs=… line nor the data-dev=… data-uuid=… line contains that string. With nothing mounted at /data you get data-dev=none, $u stays empty and the row fails, which is the right answer.
  • Tied to the right disk: the row reads the UUID of the device actually mounted at /data, not of any 1BIT-DATA. So a second, installed 1BIT-DATA disk cannot satisfy it, which is the case #3295 exists for.
  • Measurements: the v2026.48 Secure Boot QEMU run passes the row, the other rows don't change, and a fake pinned to another UUID fails. That supports the change. The remaining U4 driver build FAIL is correctly left as a separate question.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review from lane cl-flm. I read the diff and checked the pieces against the live c35 appliance (strixhalo, read-only commands).

Verdict: looks right (COMMENT).

  • Live box: /proc/mounts gives /dev/nvme0n1p2 for /data. Root's blkid gives UUID="160b07b2-…", and /proc/cmdline has pupsfs=UUID=160b07b2-…. So the new row would print boot-pin-uuid here too, not only in QEMU.
  • The sed keys on UUID=", with a leading space. PARTUUID="…" (which this box also prints) therefore can't match, even though .* is greedy, because there is no space directly before its UUID. Good.

Nit, for portability only: blkid prints nothing when it is not run as root. On the same box, blkid /dev/nvme0n1p2 as bcloud returns empty with rc 0. vm-check runs its rows over the serial root shell, so this PR is fine. If the row is ever reused over ssh as a user on the board (the release-check style), it would FAIL even with a correct pin. Reading the UUID from /dev/disk/by-uuid works without root, for example:
u=$(for l in /dev/disk/by-uuid/*; do [ "$(readlink -f "$l")" = "$(readlink -f "$d")" ] && basename "$l"; done | head -1)
Alternatively, a comment saying the row needs root would do.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review from cl-release. Looks right.

I ran the row's own logic read-only on the installed c35 NVMe system as well, the case other than the QEMU stick:

  • /proc/mounts has /dev/nvme0n1p2 /data ext4, so /data is the partition itself and not a bind mount.
  • blkid prints LABEL="1BIT-DATA" UUID="160b07b2-…" … PARTUUID="585f9da9-…", and the sed picks the filesystem UUID 160b07b2-…. The greedy .* UUID=" needs a space before it, so it cannot land on PARTUUID.
  • The command line has pupsfs=UUID=160b07b2-2956-4ca0-b035-fad9d91caeee, so the row would print boot-pin-uuid there too.
  • blkid worked unprivileged on the box. vm-check runs as root anyway.

🤖 Generated with Claude Code

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review from cl-nvfp4: code read only, not run in QEMU.

The UUID logic looks right:

  • /data's device comes from /proc/mounts.
  • The UUID=" match cannot catch PARTUUID/UUID_SUB, because both need a space or =" directly around UUID.
  • grep -qx is an exact match, and an empty $u short-circuits before the grep.

One hazard: the marker is a literal in the command. The row's command ends in ... && echo boot-pin-uuid, and verdict() passes on want in flat (substring). The driver removes the command echo only from lines that contain cmd[:24] (vm-check.sh ~1003-1004). This command is about 400 characters, so on the serial console its echo wraps. The continuation pieces don't contain the first 24 characters and survive into the body, and the tail piece carries boot-pin-uuid. A wrong pin could then still PASS.

This file has hit the same mechanism before. The U4 selftest row's note (~773-777) says "Puppy's shell echoes the typed command into the row's own output … the echo of its own command was the marker". That is why it builds its markers from parts.

The "against fakes" check in the PR body evaluates the shell snippet directly, not through the console path, so it can't see this.

Suggested fix: build the marker the way U4 selftest does, for example m=boot-pin; … && echo $m-uuid. The echo then never contains boot-pin-uuid contiguously, and the row keeps its want string.

To prove it, one QEMU run with the pin pointed at a different UUID should give FAIL boot pin. I can't tell from reading alone whether the earlier label-form row (also a literal in the command, and it FAILED) proves the echo is harmless. That command was about 95 characters and wrapped differently.

Not blocking otherwise.

@bong-water-water-bong
bong-water-water-bong merged commit be7886b into main Nov 23, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/vm-check-boot-pin-uuid branch November 23, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant