Skip to content

install-phone: --verify-only reads and lists the shipped ramdisk too - #648

Merged
derekross merged 2 commits into
derekross:mainfrom
only21mil:build/install-phone-verify-only-ramdisk
Nov 12, 2026
Merged

derekross merged 2 commits into
derekross:mainfrom
only21mil:build/install-phone-verify-only-ramdisk

Conversation

@only21mil

@only21mil only21mil commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Follows the note on #623: --verify-only (#641) stopped before the ramdisk step, so it passed a bundle whose ramdisk cpio can't list. Only a full install of that bundle stopped, after reaching the phone and asking the owner's questions.

Reading the ramdisk (the AVB footer refusal, vendor_ramdisk get, lz4 -dc, cpio -it) now runs before the phone in both runs, in a directory of its own in --work (mktemp -d "$work/verify.XXXXXX") that only that run removes. The image copy, ramdisk/ and their cleanup are still set up after the answers, as on main, so a --verify-only run, or an install refused before the answers, leaves another install's staged files in --work alone. The key's append still follows the questions and reuses that archive, so the flashed bytes don't change; most of the diff is that move (git diff --color-moved). A full install now stops there with the same message, before contacting the phone.

A ramdisk lz4 can't decompress fails in the same step, so it is covered too; reproduced the same way, main passes it and this branch stops with lz4's error.

Before, on main. A local script builds a bundle as tests/install-phone-initramfs does, with a truncated cpio in valid lz4, and copies in that revision's tools/install-phone as install. It runs in a bwrap sandbox with the checkout at /mnt, only fastboot faked (it logs every call). The script strips colour codes and greps the full install's output.

$ logs/repro/verify-only-on-truncated-ramdisk origin/main
$ git rev-parse --short origin/main   # the bundle's install is this revision's tools/install-phone
c065745d
(bundle install == origin/main:tools/install-phone)
$ lz4 -dc <bundle ramdisk> > rd.cpio; cpio -it --quiet < rd.cpio   # the shipped ramdisk itself
lz4 exit=0
cpio: premature end of file
cpio exit=2

$ cd bundle/omamobile-twelve-2026.11.09
$ ./install --unsigned --verify-only
==> Checking the files (bundle mode)
    unsigned bundle (--unsigned)
    bundle checksums match
    manifest.json: Omarchy Mobile 2026.11.09 (developer preview), its plan matches the descriptor
    root image checksum matches
    kernel 7.3.0-rc6-omamobile-gaaaaaaaaaaaa, its modules in the root image
==> The files check out (the phone was not contacted)
exit=0; fastboot calls: 0

$ ./install --unsigned | grep -E '==>|ramdisk|error'   # answers on stdin
==> Checking the files (bundle mode)
==> Checking the phone
==> About the phone's owner
Host name [alice-phone]: Time zone [Etc/UTC]: Full name for git (optional): Email for git (optional): Wi-Fi network name (optional; Enter to skip): SSH public key for root and alice [/mnt/logs/repro/run-origin-main/home/.ssh/id_ed25519.pub]: ==> Preparing a local copy of the root image in /mnt/logs/repro/run-origin-main/work
error: cpio couldn't list vendor_kernel_boot.img's ramdisk: cpio: premature end of file
exit=1; fastboot calls: 2; partitions flashed: 0

After, on this branch:

$ logs/repro/verify-only-on-truncated-ramdisk install-phone-verify-only-own-dir
$ git rev-parse --short install-phone-verify-only-own-dir   # the bundle's install is this revision's tools/install-phone
017d669b
(bundle install == install-phone-verify-only-own-dir:tools/install-phone)
$ lz4 -dc <bundle ramdisk> > rd.cpio; cpio -it --quiet < rd.cpio   # the shipped ramdisk itself
lz4 exit=0
cpio: premature end of file
cpio exit=2

$ cd bundle/omamobile-twelve-2026.11.09
$ ./install --unsigned --verify-only
==> Checking the files (bundle mode)
    unsigned bundle (--unsigned)
    bundle checksums match
    manifest.json: Omarchy Mobile 2026.11.09 (developer preview), its plan matches the descriptor
    root image checksum matches
    kernel 7.3.0-rc6-omamobile-gaaaaaaaaaaaa, its modules in the root image
error: cpio couldn't list vendor_kernel_boot.img's ramdisk: cpio: premature end of file
exit=1; fastboot calls: 0

$ ./install --unsigned | grep -E '==>|ramdisk|error'   # answers on stdin
==> Checking the files (bundle mode)
error: cpio couldn't list vendor_kernel_boot.img's ramdisk: cpio: premature end of file
exit=1; fastboot calls: 0; partitions flashed: 0

The case from the review on this PR: an install waiting at "Type the phone's codename" with its images staged in --work, and a second run on the same --work. A second local script stages root.simg and ramdisk/vendor_kernel_boot.img there and lists what is left; below are its lines for --verify-only, picked by grep with trailing spaces trimmed, on this PR's previous head and on this branch. Refused installs (another --serial, a phone on slot b, a refused answer) behave the same.

f8897ffb
work directory before each run: ./ramdisk ./ramdisk/vendor_kernel_boot.img ./root.simg
$ ./install --unsigned --verify-only   # a files-only check
exit=0; fastboot calls: 0
work directory after it:

017d669b
work directory before each run: ./ramdisk ./ramdisk/vendor_kernel_boot.img ./root.simg
$ ./install --unsigned --verify-only   # a files-only check
exit=0; fastboot calls: 0
work directory after it: ./ramdisk ./ramdisk/vendor_kernel_boot.img ./root.simg

Regression test (a stand-in, not the reproduction): tests/install-phone-initramfs runs --verify-only against its failing lz4 -dc and cpio -it stand-ins, an AVB-signed ramdisk image and a non-vendor-boot image, checking the message and that fastboot is never called. Each case fails alone with main's tool. A second case stages those two files in --work, runs --verify-only and an install refused for another --serial, and checks both files remain and nothing else is left; each fails alone with the previous head's tool. The byte comparison passes under caller umask 077, 022 and 002.

Device and build

  • Phone: none: laptop tool and its test only
  • Kernel release (uname -r): n/a
  • Packages changed, with versions: none

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes (520 ok, 0 not ok)
  • tests/packages: no package touched
  • Each changed package has its version bumped, and the new version is in the commit subject (no package changed)
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

  • I ran this on my own phone, booted into this build: no, the change is in the laptop-side installer and its test
  • Runbook steps passed (plan, step, result): n/a
  • What I did not test: a phone or real fastboot; a signed bundle (the runs use --unsigned); the guided installer, which isn't on main yet
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1): flash() and its allowlist are unchanged
tools/phone-smoke report

Not applicable: install-phone runs on the laptop (CONTRIBUTING.md §6.5).

Generated with Claude Opus 5.5 in T3 Code Nightly

--verify-only stopped before the ramdisk was read, so a bundle whose
ramdisk lz4 decodes but cpio can't list passed it ("The files check
out"), and only the full install of the same bundle stopped, after the
phone and the owner's questions. The maintainer named this on derekross#623.

Reading the ramdisk (the AVB footer refusal, vendor_ramdisk get,
lz4 -dc, cpio -it) now runs before the phone is contacted, for both
runs, in the work directory, which is set up there with its cleanup.
The key's append still comes after the questions and reuses that
listing and archive, so what a full install flashes is unchanged; most
of the diff is that move.

Tested: a bundle with a truncated cpio in valid lz4, run as
./install --unsigned --verify-only, exits 0 on main and stops with
cpio's reason and no fastboot call here. tests/install-phone-initramfs's
new --verify-only cases each fail with main's tool, and its byte
comparison passes under caller umask 077, 022 and 002;
tests/install-phone, tests/all and tools/pr-check pass. Not run on a
phone or with the guided installer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thanks, @only21mil. This is exactly the follow-up I named on #623, and moving the read ahead of the phone is better than what I asked for: a bundle with a bad ramdisk now stops a full install before the first fastboot call, not after the owner has answered every question.

I checked it on today's main. tools/pr-check, tests/install-phone and tests/install-phone-initramfs pass on the head, the flashed image is still the hook's byte for byte, and with main's tool under your test the first --verify-only case fails. It merges cleanly with #646, and both suites pass on the two combined.

One change, please. Until now --verify-only wrote nothing: on main it exits before the work directory is even named. With the move, it sets up the work directory and the cleanup trap, so on exit it removes root.img, root.simg and ramdisk/ from ~/.cache/omamobile-install, and the read itself starts with rm -rf "$ramdisk_dir". I tried it: with a root.simg and a ramdisk/vendor_kernel_boot.img planted in a --work directory, ./install --unsigned --verify-only --work <dir> leaves the directory empty on your head, and leaves both files on main.

That matters when an install is already waiting at "Type the phone's codename" with its images staged there, and someone checks the download once more from a second terminal. The first run then flashes boot_b, init_boot_b and vendor_boot_b and stops on the missing vendor_kernel_boot file. Slot A is untouched and a rerun fixes it, but a files-only check shouldn't be able to cause it.

Could a --verify-only run read the ramdisk in its own directory (mktemp -d "$work/verify.XXXXXX", say) and remove only that on exit, leaving root.img, root.simg and the shared ramdisk/ alone? A test that plants two files in --work, runs --verify-only and finds them still there would pin it.

On order: #563 and #616 both conflict with this one because of the moved block, so I'll merge this first and they rebase.

Moving the ramdisk read ahead of the phone also moved the work
directory's setup and cleanup trap there, so a --verify-only run, or an
install refused before the owner's answers (another phone's --serial, a
phone running from slot b, an answer it refuses), removed root.img,
root.simg and ramdisk/ from --work on exit. If another install was
waiting at "Type the phone's codename" with its images staged there, it
then flashed boot_b, init_boot_b and vendor_boot_b and stopped on the
missing vendor_kernel_boot image. On main neither run touched --work.

The read now happens in mktemp -d "$work/verify.XXXXXX", which only its
own run removes. The shared files, ramdisk/ and their cleanup are set up
where main sets them up, after the answers, and the key's append reads
the shipped archive from the read's directory. The flashed images and
the paths the plan prints are unchanged.

Tested: tests/install-phone-initramfs gains a case that stages root.simg
and ramdisk/vendor_kernel_boot.img in --work, then runs --verify-only
and an install refused for another --serial; both files must remain and
nothing else may be left. It fails on the previous head's tool, each
case on its own, and fails again with the read's trap removed, with the
cleanup set up before the phone, or with the read's directory left out
of the cleanup. tests/install-phone and tests/install-phone-initramfs
pass, the latter under caller umask 077, 022 and 002 (the flashed images
are the hook's byte for byte). No phone was used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@only21mil

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

Done in 017d669. The ramdisk is now read in mktemp -d "$work/verify.XXXXXX", which only its own run removes. root.img, root.simg, ramdisk/ and their cleanup are set up after the owner's answers again, where main sets them up, and the key's append reads the shipped archive from the read's directory, so the flashed images and the paths in the plan don't change. With your planted root.simg and ramdisk/vendor_kernel_boot.img, ./install --unsigned --verify-only --work <dir> now leaves both files and nothing else. tests/install-phone-initramfs pins that, plus an install refused for another --serial, and each case fails with the previous head's tool.

The same move had made a full install that is refused before the answers (another --serial, a phone running from slot b, an answer it refuses) empty --work too, and those now leave it as main did.

@derekross

Copy link
Copy Markdown
Owner

Thanks, @only21mil. That is the change I asked for, and it's done the careful way: the read has its own verify.XXXXXX directory that only its run removes, and the shared files and their cleanup are back after the answers, where main has them. Thank you also for spotting that a refused install emptied --work the same way, which I hadn't asked about.

I checked the new head merged onto today's main. tools/pr-check, tests/install-phone and tests/install-phone-initramfs pass, the last under umask 022 and 077, so the flashed image is still the hook's byte for byte. Your new case holds up under mutation: with the previous head's tool it fails at "leaves another install's root.simg and ramdisk/ in --work", with the read's trap removed at "leaves nothing of its own in --work", and with the read's directory left out of the cleanup at "the work directory is emptied".

Two small things for some later change, not this one. A run killed outright leaves its verify.XXXXXX behind and nothing sweeps old ones. And --verify-only now creates the work directory if it's missing, so on a home that can't be written it stops at mktemp rather than with a message of ours.

Merging.

@derekross
derekross merged commit 73f7979 into derekross:main Nov 12, 2026
2 checks passed
@only21mil

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

#682 handles the leftover directory. Each run holds a shared flock on the work directory until it exits and marks its own verify.XXXXXX once it holds the lock; a run that gets the lock exclusively removes the marked leftovers. It never removes an unmarked directory, so leftovers from the installer before this change stay. While any process of a killed run still holds the descriptor, nothing is swept; the first pair in its body shows the prompt's child doing that. The lock is python3's fcntl, so no new dependency, and it assumes a flock that really excludes on every host sharing the work directory.

#681 adds the message: the installer stops with can't create or write to the work directory <dir> (give one you can write to with --work DIR), and mkdir's or mktemp's own line still prints above it.

derekross added a commit that referenced this pull request Nov 12, 2026
…43) (#687)

The candidate lessons of four review rounds were never added: 251 of
them, in the rounds' review files. Each round's were read against all of
the existing lessons, merged where two reviews said the same thing, and
cut to the ones that are a check that caught something real or a
correction of a mistake of ours: 118 lessons and 8 corrections.

  round 49: L-658 to L-693
  round 50: L-694 to L-724
  round 51: L-725 to L-751
  round 52: L-752 to L-775

Five near-duplicates between rounds were dropped at the merge (a second
correction about #567's rollback index, a second floating-dialog
screenshot rule, a second #648 scratch-directory rule, a third merge
condition for kernel #224, a second "in review" wording check).

Round 52's include what the round's review of the maintainer's own merges
found, and three things from the day itself: the Omarchy 4.5 pin moved on
an update test from a phone prepared in a way users' phones were not
(C-42, with the lesson on what delivers a fix to each phone); a test
build of reboot-to run with --help, which restarted the phone; and this
file having outgrown one read. One lesson is new here: date's %3N is not
a millisecond clock on uutils (L-765).

The lesson files are rebalanced: 17 files, the largest 26 kB.
tests/review-lessons passes, and all 692 earlier entries are unchanged.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
derekross pushed a commit that referenced this pull request Nov 12, 2026
…tten (#681)

Since #648 the shipped ramdisk is read in a directory of its own in --work before the phone is contacted, so --verify-only creates the work directory; on a home that can't be written the run stopped at mkdir's or mktemp's own error, which with uutils coreutils doesn't name the path. It now stops with the installer's message, naming the directory and --work DIR, before the phone. tests/install-phone-initramfs covers a --work that can't be created and one that can't be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…erekross#648)

`--verify-only` stopped before the ramdisk step, so a bundle whose ramdisk lz4 or cpio can't read passed it and only a full install stopped, after the phone and the owner's questions. The read (the AVB footer refusal, `vendor_ramdisk get`, `lz4 -dc`, `cpio -it`) now runs before the phone in both runs, in a `verify.XXXXXX` directory of its own in `--work` that only that run removes, so another install's staged files there are left alone; the key's append still follows the answers and the flashed images are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…43) (derekross#687)

The candidate lessons of four review rounds were never added: 251 of
them, in the rounds' review files. Each round's were read against all of
the existing lessons, merged where two reviews said the same thing, and
cut to the ones that are a check that caught something real or a
correction of a mistake of ours: 118 lessons and 8 corrections.

  round 49: L-658 to L-693
  round 50: L-694 to L-724
  round 51: L-725 to L-751
  round 52: L-752 to L-775

Five near-duplicates between rounds were dropped at the merge (a second
correction about derekross#567's rollback index, a second floating-dialog
screenshot rule, a second derekross#648 scratch-directory rule, a third merge
condition for kernel derekross#224, a second "in review" wording check).

Round 52's include what the round's review of the maintainer's own merges
found, and three things from the day itself: the Omarchy 4.5 pin moved on
an update test from a phone prepared in a way users' phones were not
(C-42, with the lesson on what delivers a fix to each phone); a test
build of reboot-to run with --help, which restarted the phone; and this
file having outgrown one read. One lesson is new here: date's %3N is not
a millisecond clock on uutils (L-765).

The lesson files are rebalanced: 17 files, the largest 26 kB.
tests/review-lessons passes, and all 692 earlier entries are unchanged.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…tten (derekross#681)

Since derekross#648 the shipped ramdisk is read in a directory of its own in --work before the phone is contacted, so --verify-only creates the work directory; on a home that can't be written the run stopped at mkdir's or mktemp's own error, which with uutils coreutils doesn't name the path. It now stops with the installer's message, naming the directory and --work DIR, before the phone. tests/install-phone-initramfs covers a --work that can't be created and one that can't be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants