Skip to content

os: an installed machine can take the next appliance without losing its state (#712) - #1334

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/os712-update
Nov 7, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/os712-update

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

#712, item 2: an installed machine can take the next appliance without losing its state

The last thing an installed 1bit OS could not do that a real OS must: upgrade itself. Until now an "update" was
"write the next image", which takes the save layer — home, services, /etc — with it, and there was no way to go back
if the new appliance did not boot. This adds the two-slot update and measures it end to end.

The design, proven before any product code

An installed machine carries two slots on its data partition and one save layer:

/1bit psubdir=1bit — the appliance the machine was installed with
/1bit-alt psubdir=1bit-alt — created by the first update
the save layer stays where the machine was installed (/1bit/<prefix>save); the other slot reaches it through a relative upup64rsave symlink

A symlink is the whole trick, so it was measured before the script was written (~/wt/i712-alt-slot.py, on the install
gate's own installed disk: second set hard-linked into /1bit-alt, one GRUB entry with psubdir=1bit-alt, the relative
link, a marker written into the layer's upper/root/ before the boot):

pupsfs=UUID=54b4729c-…  psubdir=1bit-alt
12                                            # PUPMODE=12, not 5: the layer was found through the link
/initrd/mnt/dev_save/1bit-alt/upup64rsave/upper
-rw-r--r-- 1 root root 48 /root/from-set-a     # written into /1bit/upup64rsave/upper before this boot

So Puppy's find_save_file (ls -d ${PSUBDIR}/<prefix>save*, [ -d ]) and setup_psave (mkdir -p $SAVE_FN/upper,
then upperdir= it) both follow the link, and both sets share one machine's state instead of forking it.

1bit-update

os/v3/puppy/embed/usr/local/bin/1bit-update:

mode what it does
<release-dir> / <image.img> writes the next appliance into the slot that is not running, then makes it the GRUB default
--rollback flips set default back to the other slot — both sets stay on the disk, nothing is moved
--status which slot is running, what each slot holds, where the save layer is, and which entry GRUB boots

An update checks before it writes and re-reads after: the release must carry the running set's own file names (so the
init will find the same SFS set), a release SHA256SUMS is verified for those files when present, space is checked,
every copied file is cmp'd against its source, and the rewritten grub.cfg is re-read the way GRUB counts entries
before the run says UPDATED. It refuses: a machine that is not installed, a boot line with no psubdir=, an active set
with no save layer (an image older than #1291 — nothing to carry across), a target slot that already owns a layer of its
own (two machines' state cannot be merged by an update), too little space, a damaged release, and it restores its
grub.cfg backup if the entry it wrote is not the entry GRUB would boot.

The gate (os/v3/puppy/update-gate.sh, three boots of one installed disk)

The "next release" is built by the gate from that disk's own SFS plus one file (etc/1bit/set-alt) and a real
SHA256SUMS, so which set is running is a fact read off the running system rather than a date or a size:

(boot 1)  write a marker into the save layer; 1bit-update --status; 1bit-update /data/update-src
(boot 2)  must come up psubdir=1bit-alt, PUPMODE=12, with the new set's marker AND the marker written on boot 1
          then 1bit-update --rollback
(boot 3)  must come up psubdir=1bit, the new set's marker gone, the state unchanged
INFO status       1bit-update: active slot = 1bit … /1bit: 4 SFS … /1bit-alt: absent; save layer: /data/1bit/upup64rsave
                (one layer, shared by both slots) | GRUB: default index 0 of 4 entries
INFO update       created /1bit-alt (the second slot); hashes: 6 file(s) of the set verified against
                /data/update-src/SHA256SUMS; == install … 4 SFS, kernel and initrd in /1bit-alt; save layer ->
                ../1bit/upup64rsave; GRUB: added the /1bit-alt entries; GRUB: entry 4 = /1bit-alt headless, first
                (set default=4); UPDATED
PASS status2      GRUB default is index 4, the updated slot's headless entry
INFO boot-alt     psubdir=1bit-alt PUPMODE=12 rw=/initrd/mnt/dev_save/1bit-alt/upup64rsave/upper
INFO boot-alt     new set's marker: this file exists only in the updated appliance set | previous marker: 712-pre-update
PASS boot-alt     psubdir=1bit-alt, PUPMODE=12, the new set's marker present, and the machine's own state carried over
INFO rollback     rolled back: GRUB now boots /1bit (entry 0). Reboot to use it; the save layer is untouched.
INFO boot-old     psubdir=1bit PUPMODE=12 | set-alt: ls: cannot access '/etc/1bit/set-alt': N | marker: 712-pre-update
PASS boot-old     rolled back to /1bit with PUPMODE=12, the previous appliance intact and the machine's state unchanged
== PASS

Candidate: ~/wt/puppy-out-i712f/1bit-os-puppy.img (85f0e1d5…, SFS 8da0628a…) = c31's shipped SFS + 1bit-install
(#1291) + 07onboard-user (#1302) + 1bit-update (fd7e4959…). The install gate on the same bytes is == PASS too
(~/wt/i712-inst4.log). Four runs before that output, and what each caught — every one in my own code, none in the
design: (1) patch-sfs.sh
refuses an addition through its single-file form (its one-difference check compares the raw Only in <dir>: <name>
line against the target path; the manifest branch is the one with matches_target for that shape) — worked around with
the manifest form, and reported to that tool's owner rather than patched in passing here; (2) my gate's val() built its
sentinel with %-formatting and the sentinel itself contains %s%N from date +%s%N → TypeError; (3) 1bit-update
wrote its checksum scratch file into /tmp/1bit-update/ before that directory existed, and its log was truncated at
start-up, so the failure that followed (cannot mount the ESP) destroyed its own evidence — the directory is created up
front and the log is appended with its tail printed on failure; (4) two more in the script that only running it found —
the ESP's mount guard compared my spelling of /tmp/… with /proc/mounts' resolved /initrd/mnt/tmpfs/tmp/…, so any
earlier --status made the next update fail on "already mounted" (esp_mounted() now compares readlink -f), and awk
gave the first menu entry the empty string as its index (i = n; n++ with n uninitialised), which would have
written set default= with nothing after it on a rollback to /1bit — BEGIN { n = 0; i = 0 } in both programs, and
the gate now exercises the index-0 path.

Files

file change
os/v3/puppy/embed/usr/local/bin/1bit-update new; the two-slot update, rollback and status
os/v3/puppy/update-gate.sh new; the three-boot gate above, including the release it builds
os/v3/puppy/container-build.sh the script in the image's own "must carry this" list
os/v3/puppy/README.md 1bit-update and update-gate.sh rows
docs/os-v3.md "Updating an installed machine": the layout, what an update is and is not (apt updates inside a set), the refusals, and the measurement

refs #712 — item 2 of the acceptance. Item 3 (the server-shaped rest: firewall default, NTP, hostname/static address,
logging without systemd) stays open and named.

…ts state (#712)

Until now an update of an installed 1bit OS was "write the next image", which takes the save
layer - home, services, /etc - with it, and there was no way back if the new appliance did not
boot. An installed machine now carries two slots on its data partition and ONE save layer:

  /1bit       psubdir=1bit       set A
  /1bit-alt   psubdir=1bit-alt   set B, created by the first update

The layer stays where the machine was installed and the other slot reaches it through a relative
`upup64rsave` symlink, so Puppy's find_save_file + setup_psave use the same layer from either
slot: an update changes the OS and not the machine. That mechanism was measured before any product
code (second set + one GRUB entry + the symlink + a file written into the layer's upper dir before
the boot: PUPMODE=12, root layer through the link, the file present).

`1bit-update <release-dir | image.img>` writes the next appliance into the slot that is NOT
running, checks the release first (the running set's own file names; a SHA256SUMS verified for those
files when present; free space), cmp's every copied byte, links the layer, adds that slot's GRUB
entries from the running entry's own UUID-pinned boot line, flips `set default` and re-reads the
config the way GRUB counts entries before it says UPDATED. Refusals: not installed, no psubdir=, an
active set with no save layer, a target slot that already owns a layer, too little space, a damaged
release, and a grub.cfg that does not end up booting the slot it wrote (restored from its backup).
`--rollback` flips the default back; `--status` says which slot runs, what each holds and what
GRUB boots.

update-gate.sh measures it over three boots of one installed disk: the update, a boot on
psubdir=1bit-alt with PUPMODE=12, the new set's own marker file AND the state written before the
update, then --rollback and a boot on /1bit with the previous appliance intact.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#1334 ready for review at a0cc2d5

@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: CHANGES at a0cc2d5064260e75e6c95ea0bffde93bb9806657. The design is sound and the first update works as the gate shows. But a machine can take exactly one update: the second one, the normal next release, is refused, and the gate never runs it.

The defect. save_slot is defined as the slot holding the real layer directory (1bit-update:96-106, [ -d "$s" ] && [ ! -L "$s" ]). The update only ever symlinks the layer into the other slot (:249, ln -sfn "../$save_slot/$savename"), so save_slot stays 1bit forever. After the first update the machine runs from /1bit-alt, so the next update's target is 1bit (:80). The target guard (:235-243) then finds /1bit/upup64rsave as a real directory, which is the machine's own shared layer, and dies:

# a fake data partition laid out as the gate leaves it after boot 2 (/1bit/upup64rsave a real dir,
# /1bit-alt/upup64rsave -> ../1bit/upup64rsave), running the script's own lines 79-83, 96-106 and 235-243 verbatim:
active=1bit-alt target=1bit save_slot=1bit savename=upup64rsave
DIE(rc 2): /1bit already holds a save layer (upup64rsave): two layers cannot be merged by an update - pick the slot by hand if that is really what you want

So the lifecycle is: update 1 works; update 2 is refused unless the user first rolls back to the old appliance. The guard means "another machine's state", but here it is this machine's state.

Also on that path: if the guard were simply skipped, :249 would run ln -sfn ../1bit/upup64rsave /data/1bit/upup64rsave against a real directory. ln would then create a self-referencing upup64rsave/upup64rsave link inside the layer instead of replacing anything. The fix needs both halves.

Fix:

  • when target == save_slot, the layer in the target is the shared one: skip the merge guard for exactly that entry, and do not ln over it (the running slot already reaches it through its own link);
  • add a 4th and 5th boot to update-gate.sh: from psubdir=1bit-alt, run a second 1bit-update with a third marker set. It must come up psubdir=1bit, PUPMODE=12, with the boot-1 marker still present and no upup64rsave/upup64rsave. That is the row that proves an installed machine can keep updating, which is #712 item 2's actual claim.

Checked and fine

  • Write ordering is safe: copy into the inactive slot, cmp every file, sync, and only then back up grub.cfg (.pre-1bit-update) and change set default. A failure while copying leaves GRUB on the running slot.
  • The refusals before writing: not root, not installed (/data/.installed), no psubdir=, an unknown slot name, no save layer (pre-#1291), too little space (+256 MiB slack), a release missing the running set's file names, and a SHA256SUMS that fails for those files.

Nit: with no SHA256SUMS the update proceeds ("sizes are checked, the bytes are not"). The cmp after copying proves a faithful copy of the source, not a good source. Consider requiring an explicit --no-verify for an unhashed release, since this is the path that replaces the bootable appliance.

Not run: the three-boot gate itself, which needs the install gate's VM disk. The defect above is on a path the gate does not exercise.

@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: READY at a0cc2d5064260e75e6c95ea0bffde93bb9806657

I read the updater as the thing it is — a program that can brick an installed machine — and every invariant that matters is enforced in the code, not just documented. bash -n is clean on 1bit-update, update-gate.sh and container-build.sh. I did not run the gate (update-gate.sh needs qemu-system-x86_64, sudo, loop devices and three real boots of an installed target.img, ~600 s each); everything below is the script's own logic, which is where the damage would come from.

The blast radius is bounded by construction:

  • it refuses to be an updater on anything but an installed disk — root, /data mounted, and $DATA/.installed present; a live stick gets "a stick is replaced by writing the next image, it is not updated in place", and a disk whose psubdir= it cannot name gets "this disk was not laid out by 1bit-install". So the failure mode "ran it on the wrong thing" is a refusal, not a partial write;
  • it writes only the slot that is not running, and names that slot from the boot line, never from a guess;
  • the source is checked before anything is written: it must carry the running set's own file names (vmlinuz initrd.gz + the running slot's *.sfs), a SHA256SUMS is verified for exactly those files when present, and free space is required to be set + 256 MiB — with the honest fallback stated in the log when a release carries no sums ("sizes are checked, the bytes are not");
  • another machine's state cannot be clobbered: a target slot that already holds a real save layer is refused ("two layers cannot be merged by an update"), while a stale link is replaced;
  • every copy is cmp'd against the source, then synced, before GRUB is touched.

The GRUB flip is done the careful way, which is the part I most expected to find fragile: it backs up grub.cfg to $cfg.pre-1bit-update, builds the new entries from the running slot's own linux line (skipping the 1bit.serial=1 one), appends only if absent, sets set default=<index>, and then re-reads the file the way GRUB counts entries — the Nth menuentry must be the one whose linux line carries psubdir=<target> — and restores the backup if that read-back fails. A half-applied GRUB edit is the classic way to make a machine unbootable, and this cannot report success with one.

Rollback is a set default flip with nothing moved (--rollback requires the other slot to have a non-empty initrd.gz first, so it cannot "roll back" to an empty slot), and both sets stay on the disk — so even a bad update leaves the previous appliance bootable, which is the property the PR exists to add.

The mechanism was measured before the code was written, and that is in the record: the save-layer symlink was proven on the install gate's own disk (pupsfs=… psubdir=1bit-alt, PUPMODE=12, the layer found through the link, a marker written on boot 1 present on boot 2). PUPMODE=12 rather than 5 is the interesting detail — it is what proves the link is followed rather than a second layer being created, i.e. that the two slots share one machine's state instead of forking it.

What the gate will add when pi-release runs it (update-gate.sh, three boots: update → must come up on 1bit-alt with the boot-1 marker intact → rollback → must come back on 1bit with the new set's marker gone and the boot-1 marker still there) is the end-to-end proof of exactly those invariants. My verdict is about the script being safe to hand to that gate and to an installed machine; if the gate finds a boot problem, this READY is about the code, not the boot.

Nit, one line: the free-space check covers the new set and the checksums but not the ESP, where the four appended menuentry lines go — trivial in size, but the ESP is the one place a write failure is unrecoverable-without-a-rescue-stick, so a df against $esp before mount_esp would close the last "could fail half-way" path. --status and --rollback both unmount the ESP on every exit path I traced, which is right.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

For the merge queue: both verdicts are at a0cc2d50. The READY at 14:24Z reads the target-slot guard as a protection ("another machine's state cannot be clobbered"), and for the first update it is one. The CHANGES at 12:53Z is about the second update. After update 1 the machine runs from /1bit-alt, save_slot stays 1bit (the real layer directory), so the next target=1bit hits that same guard on the machine's own layer and refuses (DIE(rc 2): /1bit already holds a save layer). That was reproduced with the script's own lines on the layout the gate leaves after boot 2, and the gate never runs a second update. Please keep it out of the merge until a fix (exempt target == save_slot, no ln over the real directory) and a boot-4/5 gate row land, or until a reply shows why the second update cannot reach that guard.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

712 - Partially compliant

Compliant requirements:

  • An installed machine can take the next appliance without losing its state
  • An OS-level update path

Non-compliant requirements:

  • A normal user with sudo
  • The server-shaped rest (firewall default, NTP, hostname, optional static address, logging that survives)

Requires further human verification:

  • A normal user with sudo
  • The server-shaped rest (firewall default, NTP, hostname, optional static address, logging that survives)
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Race Condition in VM Management

The update-gate.sh script uses systemd-run to manage the QEMU process, which may introduce a race condition during process cleanup. If the script exits before systemd fully initializes or cleans up the scope, it could leave orphaned QEMU processes or fail to properly clean up resources, potentially leading to resource leaks or failed subsequent runs.

self.proc = subprocess.Popen(["systemd-run", "--user", "--scope", "-q", "-p", "MemoryMax=6G", "--"] + q,
                             stdout=open(os.path.join(work, "qemu-%s.out" % tag), "wb"),
                             stderr=subprocess.STDOUT)
t = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Insecure File Permissions in Log Handling

The script uses : >> "$LOG" 2> /dev/null to ensure the log file exists, but does not explicitly set secure permissions on the log file. If the log file is created with default permissions, it could be readable by non-root users, potentially exposing sensitive information from the update process.

: >> "$LOG" 2> /dev/null || LOG=/dev/null

@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: CHANGES at 81ae64eea149ce7234f11d2c328a7d412493d510. Main merges only since a0cc2d50: no non-merge commit of its own, and the PR's own +/- lines against its merge-base are identical (hash 27cd4a602b66). 1bit-update is byte-for-byte the same, including the target-slot guard at :235-243. So the defect from my CHANGES at a0cc2d50 stands: the second update is refused on the machine's own save layer (save_slot stays 1bit, and from /1bit-alt the guard dies), and the gate never runs a second update. Fix: the target == save_slot exemption, no ln over the real directory, and gate boots 4-5.

@bong-water-water-bong
bong-water-water-bong merged commit 635f9c3 into main Nov 7, 2026
9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/os712-update branch November 7, 2026 16:10
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Post-merge note: this merged at 16:10:21Z at 81ae64ee, three minutes after a VERDICT: CHANGES at that same head (16:07:11Z). The only READY was at the earlier head a0cc2d50. So the defect is on main (635f9c34, os/v3/puppy/embed/usr/local/bin/1bit-update:235-243): an installed machine takes one update, and the second is refused on its own save layer. save_slot stays 1bit, and from /1bit-alt the target guard dies with /1bit already holds a save layer. The gate has no second-update boot, so its green does not cover this. Any machine that takes the next appliance through 1bit-update will refuse the one after it. A follow-up PR from the owning lane needs: a target == save_slot exemption in the guard, no ln -sfn over the real layer directory (:249), and update-gate boots 4-5 (a second update from /1bit-alt back to /1bit, with the boot-1 marker intact). Until it lands, no release should advertise in-place updates as repeatable.

bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
) (#1385)

* os: the shared layer is identified by file, and a release without hashes needs --no-verify (#1376)

Two things on top of the second-update fix, both from review:

* **identity by file, not by name** (pi-os3's correction on #1378). The guard asked whether the target slot holds a
  layer with the same SLOT and the same NAME. That is right for this issue - the layer keeps its name across the slots -
  but it silently accepts a hand-copied or restored upup64rsave, which is a different directory carrying this machine's
  name, and refusing exactly that is what the guard exists for. `[ "$s" -ef "$1/$save_slot/$savename" ]` compares
  device+inode: the same file. New arm in tests/one_bit_update_slots_test.sh for the case a name check passes.
* **the two nits from the #1334 review**: a release with no SHA256SUMS now needs an explicit `--no-verify` (this path
  replaces the appliance the machine boots), and the ESP gets its own free-space check before the grub.cfg rewrite.
  The operator also gets the "holds this machine's save layer ... left in place, no link needed" line.

update-gate.sh runs FOUR boots now: the update, a boot on 1bit-alt, the second update FROM there into the slot that
holds the layer, a boot on 1bit with the second set and no nested link, then a rollback and a boot on the first updated
set. Two releases are built from the disk's own SFS so which set is running is read off the machine, and RESET=1 puts
a used disk back to the post-install state so the gate can be re-run without re-installing.

* os: an image carries its set's hashes, so the image form never needs --no-verify (#1385 review)

Three findings from the review, plus the row it asked for.

1. **Blocking: `--no-verify` had become mandatory for every shipped image.** For `1bit-update <image.img>` the
   source is the image's own /1bit, and nothing in `os/` wrote a SHA256SUMS there, so every weekly image would have
   refused - and the gate could not see it, because it only ever builds release directories and writes their sums
   itself. Fix at the source: **`mkimage.sh` writes `/1bit/SHA256SUMS`** from the bytes it just copied, so the image
   form verifies against the image's own hashes. The refusal message no longer points at the data-partition root either.
2. **A gate row for the image form**, which is where that fix is testable: the gate now builds a real .img in the guest
   (GPT partition labelled 1BIT-DATA holding /1bit + SHA256SUMS) around a THIRD marker set, updates from it on boot 4
   with the user's own command, and boot 5 must show that set running, PUPMODE=12, its marker present and the boot-1
   marker intact. The row asserts the log's `1bit/SHA256SUMS` line, so the HASH SOURCE is what is tested.
3. **The -ef rationale was wrong** and is corrected in the code comment, the test comment and docs/os-v3.md: the name
   form also refused a same-named foreign layer, because it required the slot to match too (the reviewer ran the new arm
   against main's updater and it passed). -ef stays as the clearer statement of intent; the arm stays as a regression
   guard; the false claim is gone.
4. Nit: the ESP free-space check moved BEFORE the copy (it used to refuse a full ESP after ~1.5 GB was already written
   into the other slot).

* os: the image form reads the partition offset sfdisk actually prints (#1385 review follow-up)

The new image-form gate row found that `1bit-update <image.img>` had never worked: its awk took the field `start=`,
stripped the prefix and printed that - but `sfdisk -d` prints `start=` and the sector number as TWO fields, so the
offset came back empty and every image was refused with "has no 1BIT-DATA partition (not a 1bit OS image)" while the
partition was right there. So the review's finding 1 (no SHA256SUMS in images) was the second of two independent blocks
on the image form, and the row it asked for is what caught the first one.

Read the number wherever it is (`start=2048,` or `start= 2048,`), checked against a real sfdisk -d on a GPT image
before re-running the gate.

* os: the image-form gate row builds a real image, and checks it before using it (#1385 review)

The row's first version escaped the printf one level too deep, so the guest's sfdisk received a single mangled line,
the 'image' had no partition table, and `1bit-update` refused it - correctly - while the gate reported the product as
broken (measured in the guest: 'does not contain a recognized partition table'). The row now writes the table with the
escaping printf actually needs, and asserts `sfdisk -d` names 1BIT-DATA before the boot that judges the updater, so a
broken fixture fails as a fixture.

* os: the update gate refuses a reused disk instead of looking broken (#1385 review)

RESET=1 puts the slots and grub.cfg back, but it cannot un-patch the SFS the machine is running - so the next run's
"base" already carries a marker, patch-sfs refuses (correctly), and the gate reports the product as broken for a
fixture problem (measured: 'etc/1bit/set-alt2 ... already has these bytes'). The gate now refuses a disk that still
carries a release directory or the test image, and a patch-sfs failure is reported with the same explanation: this
needs a FRESH install, run install-probe.sh first.

* os: the gate's first menu selection retries like its reboot does (harness, #1385)

The serial-shell selection sent three arrows and one Enter, once, and waited 120 s - inside the range of a loaded
boot (measured: 155 s to userspace, and the shell line present in the transcript while the row reported "no serial
root shell"). It now presses again on a lost Enter and gives the retry 300 s, the same shape the reboot path already
uses.

* os: the gate's test image gets a partition table and then a filesystem, in that order (harness, #1385)

mkfs.ext4 was formatting the image file itself, which erases the GPT sfdisk had just written - so the fixture had no
1BIT-DATA partition, the updater refused it (correctly) and the check row I added caught it: 'the image's partition
table names 1BIT-DATA: 0'. The filesystem now goes into its own file and is dd'ed in at the partition offset, which is
what mkimage.sh does.

* os: one loop device for the image form, taken at the partition offset (#1385 review)

The image path attached the whole image, detached it, and immediately attached it again at an offset - and the second
attach raced the detach, so the mount failed with "cannot mount the data partition in ..." (measured in the gate's
image-form row). sfdisk reads the file directly and needs no loop at all, so the whole-image attach/detach is gone and
there is exactly one loop, opened at the offset. A mount failure now prints the mount's own error instead of a bare
refusal.

Checked on the box without a VM: a 200 MB GPT image with a 1BIT-DATA partition and an ext4 filesystem dd'ed in at
offset 2048 - the same commands, the same awk, losetup -o + ro mount + the set's files readable.

* os: update-gate can run just the image form (#1385 review)

The row the review asked for is the image form, and the five-boot run it lives in needs ~40 quiet minutes - which a
shared box at load 50-73 has not given all night (two chains hit the 2 h timeout). `MODE=image` runs only that claim,
in two boots: build the .img in the guest (GPT + a 1BIT-DATA partition with the set and its SHA256SUMS, checked before
use), update from it, reboot, and assert the set it carried is running on the machine's own save layer with the marker
written before the update intact. The five-boot run stays the full gate for a quiet box.

* os: image mode builds its set before the image that needs it (harness, #1385)

* os: the set's hashes are verified for every file, not just the two without a ./ prefix (#1385 review)

The image-form row found the verification count: 'hashes: 2 file(s) of the set verified' for a set of six, because
`sha256sum ./*.sfs` writes "./name" and the membership test compared it to the bare name - so the SFS were copied but
never hash-checked. The filter strips a leading ./ now, and the gate row asserts the count covers the set, which is the
thing that would have hidden it.

---------

Co-authored-by: bong-water-water-bong <[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