Skip to content

os/v3/puppy: a live stick boots its own data partition, by UUID, never the installed disk's - #3295

Merged
bong-water-water-bong merged 1 commit into
mainfrom
os/stick-pins-own-uuid
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
os/stick-pins-own-uuid

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287. Found on the hardware tonight; release-blocking for any stick used on a machine that already runs 1bit OS.

What happened (AI MAX+ 395, 22 Nov): the stick finds its root by label, search --label 1BIT-DATA in grub.cfg and pupsfs=1BIT-DATA on the command line. After installing 1bit OS to the NVMe there are two 1BIT-DATA partitions, and both lookups resolved to the NVMe first. A freshly written stick (its bytes verified against the image) booted the installed system's SFS and save layer; only /data came from the stick:

/etc/rc.d/PUPSTATE  PUPSFS='nvme0n1p2,ext4,/1bit/puppy_upup64r_26.04.sfs'
                    PUPSAVE='nvme0n1p2,ext4,/1bit/upup64rsave'

So the stick's own fixes never ran, and an install started from that boot would have copied the old system back onto the disk.

Change:

  • mkimage.sh: chooses the data partition's UUID (ONEBIT_STICK_DATA_UUID overrides), passes it to mkfs.ext4 -U, and pins it in grub (search --fs-uuid) and on the command line (pupsfs=UUID=… 1bit.data=UUID=…), the form 1bit-install already writes for an installed disk. The 1BIT-DATA label stays for tools that look for it.
  • 1bit-install.sh: the grub.cfg rewrite also matches a UUID-pinned stick (label patterns kept for older sticks) and replaces the stick's UUID with the installed disk's; its existing post-checks are unchanged.

bash -n clean on both; the installer's sed checked on a UUID-pinned sample. The hardware proof (stick boots itself on a machine with 1bit OS installed, then installs) follows on the rebuilt stick.

🤖 Generated with Claude Code

…r the installed disk's (engine#3287)

The stick found its root by label: grub 'search --label 1BIT-DATA' and pupsfs=1BIT-DATA. A machine that already
runs an installed 1bit OS has a second 1BIT-DATA partition, and on the AI MAX+ 395 (22 Nov) both resolved to the
NVMe first: a freshly written stick booted the INSTALLED system's SFS and save layer with only /data on the stick
(/etc/rc.d/PUPSTATE: PUPSFS='nvme0n1p2,ext4,/1bit/puppy_upup64r_26.04.sfs', PUPSAVE on nvme0n1p2), so the stick's
own fixes never ran and an install from that boot would have copied the old system back.

mkimage.sh now chooses the data partition's UUID (ONEBIT_STICK_DATA_UUID overrides), formats with it and pins
it in grub's search and as pupsfs=UUID= 1bit.data=UUID= - the form 1bit-install already writes for an
installed disk. 1bit-install's rewrite also accepts a UUID-pinned stick grub.cfg (the label patterns stay for
older sticks) and replaces the stick's UUID with the installed disk's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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:

  • The stick's data partition is now pinned by UUID, preventing conflicts with installed systems.
  • The boot process now uses UUID-based partition identification, resolving the issue where the live stick would boot from an installed system's partition.

Non-compliant requirements:

  • Models download into RAM on the live stick.
  • The stick's data partition is not grown on first boot.
  • Boot waits on unrelated USB storage.
  • Stale release-check rows.
  • payload-runpath.
  • xhci-capture.
  • The cut must use the freshly rolled payload.
  • The pre-write probe must be able to stop the write.
  • Keep the shipped image.
  • NPU chat with tools offered.
  • chat-npu-queue-plain.
  • Qwen3-1.7B on the NPU.

Requires further human verification:

  • The fix for the data partition pinning by UUID is verified on hardware.
  • The impact of the change on the boot process and installation workflow needs further validation.
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Regex Pattern Vulnerability

The regex pattern used in sed to match UUIDs in grub.cfg may be too permissive and could lead to unintended replacements if the UUID format changes or if there are other UUID-like strings in the file. This could cause incorrect boot configuration.

-e "s|search --no-floppy --fs-uuid [0-9a-fA-F-]* --set=root|search --no-floppy --fs-uuid $datauuid --set=root|" \
-e "s|pupsfs=1BIT-DATA|pupsfs=UUID=$datauuid 1bit.data=UUID=$datauuid|g" \
-e "s|pupsfs=UUID=[0-9a-fA-F-]* 1bit.data=UUID=[0-9a-fA-F-]*|pupsfs=UUID=$datauuid 1bit.data=UUID=$datauuid|g" \
UUID Generation

The UUID generation uses Python's uuid.uuid4() which is cryptographically secure, but it's important to ensure that the environment in which mkimage.sh runs has access to sufficient entropy for secure UUID generation, especially on embedded systems or during early boot stages.

datauuid=${ONEBIT_STICK_DATA_UUID:-$(python3 -c 'import uuid; print(uuid.uuid4())')}

@bong-water-water-bong
bong-water-water-bong merged commit c0a7e88 into main Nov 22, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the os/stick-pins-own-uuid branch November 22, 2026 08:24
bong-water-water-bong added a commit that referenced this pull request Nov 23, 2026
…made, read from the /data device (engine#3287) (#3339)

#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: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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