Repository navigation
install-phone: append the owner's key to slot B's initramfs, as the boot hook does - #576
Conversation
…oot hook does On a fresh release install the first omamobile-boot-update run rewrote vendor_kernel_boot_b with root's authorized_keys appended to the initramfs. Until then the rescue SSH in the initramfs had no owner key (exactly when it is needed: a root that doesn't mount), and the bundle did not boot the bytes the hook writes later (RELEASES §11 step 4). install-phone now does to a copy of the ramdisk image (vendor_kernel_boot, or vendor_boot without one) what lib/omamobile-boot-images does: a cpio holding the key, made with the builder's commands under pacman's umask (022), after the shipped archive in one lz4 stream. A small inline Python then sets the new ramdisk size in the copy's v4 vendor boot header and ramdisk table, where mkbootimg puts it. The code is inline because a bundle ships install-phone alone (L-497). The copy is what gets flashed; the bundle's own image and the write path (slot B and userdata only, the allowlist, the typed codename) are unchanged. A ramdisk that already holds SSH keys (a development initramfs) is flashed as built. An image the key makes too large for its partition, a ramdisk image under an AVB footer, or one that isn't a single-ramdisk v4 vendor boot image stops the install before any write. install-phone now needs lz4, cpio and python3 on the laptop. tests/install-phone-initramfs runs the hook's own build (omamobile-boot- update build on a stand-in phone root) with and without the owner's key, installs a bundle of the keyless set with the bundle's install against a fake fastboot, and checks that every flashed image is the hook's byte for byte, for a gs201 and a gs101 layout; the hook's dry run on a slot B holding them then writes nothing (on the bundle's own images it rewrites vendor_kernel_boot, as in derekross#564). It also covers each refusal (each one mutation-checked). It fails on main and skips without mkbootimg. tests/install-phone's ramdisk images are now real v4 vendor boot images. CI installs lz4 explicitly. Fixes derekross#564 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Opus 5.5 replying on behalf of Victor. Could you re-run the checks here? The only run on this head (42674238918) failed at 18:27 UTC with no jobs started, during GitHub's Actions incident that day (mitigated at 18:43 UTC), so none of the tests ran. A contributor on a fork can't re-run it from this side. Locally on this head |
|
Thank you, Victor. This is exactly the fix I hoped for in #564, and the test is I checked it against the real 2026.11.08 cheetah bundle. Your Two small things before I merge:
On my side: CI's run for this head ended as "failure" without starting a job, A merge note: |
… lz4 and cpio This addresses the review on derekross#576. The append ran in ( ... ) || die only for umask 022, and bash turns errexit off in a subshell whose status is tested, so a failing install or cpio carried on and only the last lz4 pipeline decided: a cpio that failed gave the shipped ramdisk recompressed without the key, flashed with "the owner's key appended". The steps now run at the top level, each with its own die: staging the key, cpio packing it, lz4 recompressing. Dropping the umask alone would change the bytes on some laptops: GNU install -d makes the parent root/ 0755 under any umask, but uutils' install (coreutils 0.8.0 here, Ubuntu's default) gives it the umask's mode, so under 077 or 002 vendor_kernel_boot no longer matched the hook's. root/ is now made 0755 explicitly, the mode pacman's umask gives the hook's. tests/install-phone-initramfs runs every install under umask 077 and checks that a stand-in install, cpio or lz4 that exits 1 stops it with the step's message before anything is flashed (it fails on 8d5571e's installer at the first injected install failure; each die removed in turn fails it). The gs201 fixture now uses 2 KiB pages as the Pixel 7 Pro does (VENDOR_PAGESIZE=0x800, as every descriptor in device/), and the gs101 one 4 KiB, so both page sizes stay covered. The test passes with the caller's umask at 022, 077 and 002, and fails under 077 and 002, and from a 022 caller, without the explicit root/ mode. The bundle's README.txt lists lz4 and cpio with the other tools the install needs, and install-phone's "not found" hint names their packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Opus 5.5 replying on behalf of Victor. Both points are fixed in a3b6793, plus the page-size note.
The gs201 fixture now uses 2 KiB pages, as |
…id-tools tests/all keeps every suite (main's, plus tests/install-phone-initramfs), and tools/install-phone keeps main's comment above --help. checks.yml adds android-tools, so the new test finds mkbootimg and runs on CI instead of skipping. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thank you, Victor. Both points are fixed, and the uutils finding is a good catch I wouldn't have found on this laptop. What I checked on a3b6793:
The branch conflicts with main now, in the two places I said I would resolve ( Two small things for a later PR if you feel like it, neither holding this one: a stand-in for a failing
|
|
Note 🤖 Opus 5.5 replying on behalf of Victor. The |
) Follow-up to #576: the shipped ramdisk is decompressed once, and a decompress that fails stops the install there, before the plan is shown and before any fastboot write. The key check and the append both read that one copy.
…oot hook does (derekross#576) A fresh install's initramfs rescue SSH had no owner key until the first run of omamobile-boot-update's hook, which then rewrote vendor_kernel_boot (derekross#564). tools/install-phone now appends the owner's authorized_keys to the initramfs in its local copy of slot B's image, with the hook's own steps, so the installed image is byte for byte what the hook builds from the same package: checked on the 2026.11.08 cheetah image under umask 077, 022 and 002. Each step stops the install on failure. The write path is unchanged: only slot B's images and userdata. The bundle's README lists lz4 and cpio, and CI installs android-tools so tests/install-phone-initramfs runs there. Fixes derekross#564.
…erekross#596) Follow-up to derekross#576: the shipped ramdisk is decompressed once, and a decompress that fails stops the install there, before the plan is shown and before any fastboot write. The key check and the append both read that one copy.
What and why
Fixes #564. On a fresh release install the first
omamobile-boot-updaterun rewrotevendor_kernel_boot_bwith root'sauthorized_keysappended to the initramfs. Until then the initramfs's rescue SSH (dropbear, before switch_root) had no owner key, which matters exactly when the root doesn't mount, and the bundle didn't boot the bytes the hook writes later (RELEASES §11 step 4).tools/install-phonenow gives a copy of the ramdisk image (vendor_kernel_boot, orvendor_bootwithout one) whatlib/omamobile-boot-imagesappends, using the builder's own commands, with the directory modes pacman's umask (022) gives the hook, each step stopping the install with its own message if it fails: a cpio holding the key, after the shipped archive, in one lz4 stream. A small inline Python then writes the new ramdisk size into the copy's v4 vendor boot header and ramdisk table, where mkbootimg puts it. Everything is inline because the bundle ships install-phone alone asinstall, withouttools/lib(L-497).authorized_keys(a development initramfs) is flashed as built.lz4,cpioandpython3on the laptop (INSTALL.md, the bundle's README.txt and the "not found" hint updated). CI installslz4explicitly.--helpprints its header from the file (the same line as in tools: print every tool's --help from its header with one helper #559), since the header grows here; the old range cut off--reinstalland--unsigned.Test:
tests/install-phone-initramfsruns the hook's ownomamobile-boot-update buildon a stand-in phone root with and without the owner's key. It installs a bundle of the keyless set with the bundle'sinstallagainst a fake fastboot, and checks every flashed image is the hook's byte for byte, for a gs201 layout (vendor_kernel_boot, 2 KiB pages as on the Pixel 7 Pro) and a gs101 layout (vendor_boot, 4 KiB pages, for the header arithmetic). The hook'swrite --dry-runon a slot B holding them then writes nothing; on the bundle's own images it plans thevendor_kernel_bootrewrite #564 reported. It also checks each refusal, and that a failinginstall,cpioorlz4step stops the install before anything is flashed; each check was mutation-tested. Every install runs under umask 077. It fails on main and needs mkbootimg (android-tools, ortools/fetch-toolchain's copy). CI has no mkbootimg yet, so it shows# skipthere untilandroid-toolsis inchecks.yml.Limits:
INITRAMFS_MODULES(raven) the hook's cpio also carries those modules, so its first run still rewrites the image (RELEASES §5.2 says so).manifest.jsonwould flash the bundle's image without the key.install -d(the phone's) makes parent directories 0755 under any umask, but uutils' (Ubuntu's default) follows the umask, so install-phone setsroot/'s mode itself. The hook built with uutils at a umask other than 022 would give different bytes.Overlap: #563 (install-phone: development boot-update policy and serial pin) edits
tools/install-phone,tests/install-phoneanddocs/RELEASES.mdtoo. This PR keeps its change in its own section and test file, and its hunks don't touch #563's lines. #559 changes the same--helpline to the same text and adds a comment line above it, so whichever lands second needs a small resolution there. The suite list intests/allconflicts with other open PRs that add a suite; the resolution keeps both entries.Device and build
uname -r): n/aChecks (no phone needed)
tools/pr-check origin/mainpassestests/allpasses (486 ok, 0 not ok;tests/install-phone-initramfsran here with mkbootimg installed: 8 ok, also under umask 077 and 002)tests/packages: no package touchedversionbumped, and the new version is in the commit subject (no package changed)Co-Authored-By:orAssisted-by:trailer, never aSigned-off-by:On the phone
userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)tools/phone-smokereportNot applicable: install-phone runs on the laptop.
Generated with Claude Opus 5.5 in T3 Code Nightly