Skip to content

install-phone: stop at a failing decompress of the shipped ramdisk - #596

Merged
derekross merged 1 commit into
derekross:mainfrom
only21mil:build/install-phone-lz4-decompress-failure
Nov 10, 2026
Merged

derekross merged 1 commit into
derekross:mainfrom
only21mil:build/install-phone-lz4-decompress-failure

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

What and why

Follows the maintainer's suggestion on #576: the failing-step test in tests/install-phone-initramfs failed install, cpio's pack and lz4's compress, but not the decompress of the ramdisk the bundle ships (lz4 -dc).

A stand-in that fails only that call showed two things:

  • the key check (lz4 -dc … | cpio -it | grep -c … || true) hid the failure and counted the ramdisk as holding no SSH keys;
  • the append ({ lz4 -dc … && cat extra.cpio; } | lz4 -l …) failed under pipefail, so the install already stopped before the plan and before any flash, but its message said "lz4 couldn't recompress …".

The ramdisk is now decompressed once, as its own step with its own message ("lz4 couldn't decompress vendor_kernel_boot.img's ramdisk", with lz4's own reason on stderr), and the key check and the append read that file. lz4 gets the same stream as before (the shipped archive, then the key's cpio), so the image is still the hook's byte for byte. The change stays inline, because the bundle ships install alone (L-497).

The test adds lz4 -dc to the failing steps. Before the fix it failed on the message; with the new die replaced by || true the install carries on and the test fails at "refuses" (L-419). tests/install-phone-initramfs passes with the install under umask 077 (the test's), 022 and 002, against android-tools' mkbootimg.

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 (500 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 real bundle installed on a phone
  • 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, and the new failure stops before the plan is shown
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

The maintainer's follow-up on derekross#576: the failing-step test fails install,
cpio's pack and lz4's compress, but not the decompress of the ramdisk the
bundle ships (lz4 -dc). A stand-in that fails only that call showed what
happens:

- the key check (lz4 -dc | cpio -it | grep -c ... || true) swallowed the
  failure and counted the ramdisk as holding no keys;
- the append's { lz4 -dc ... && cat extra.cpio; } | lz4 -l failed under
  pipefail, so the install did stop before anything was flashed, but its
  message blamed the recompress ("lz4 couldn't recompress ...").

The ramdisk is now decompressed once, by its own step with its own
message ("lz4 couldn't decompress vendor_kernel_boot.img's ramdisk"), and
the key check and the append read that file. lz4 gets the same stream as
before (the shipped archive, then the key's cpio), so the image is the
hook's byte for byte: the byte comparison passes with install under umask
077 (the test's), 022 and 002.

tests/install-phone-initramfs adds lz4 -dc to the failing steps: before
this change it failed on the message; with the new die replaced by
"|| true" the install carries on and the test fails at "refuses".

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

Copy link
Copy Markdown
Owner

Thank you for following this up from #576. Decompressing once and letting both the key check and the append read that file is the right shape, and the message now names the step that failed. I ran both of your failing-first cases here: main's tool with your test fails on the message, and with the new die turned into || true the test fails at "refuses". That second case is worth having: without the die, the append would have gone on with an empty archive. The write path and the allowlist are untouched and the stop comes before the plan, so nothing changes about what reaches the phone. Merging.

One thought for a follow-up if you feel like it, no need to hold this: the listing a line below is still cpio -it ... 2>/dev/null | grep -c ... || true, so an archive that lz4 decodes but cpio can't list is still read as "holds no keys". With the archive in a file now, that step could get its own message in the same way.

@derekross
derekross merged commit 7183b69 into derekross:main Nov 10, 2026
2 checks passed
@only21mil

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

The listing is its own step in #623. It reproduced on main: in a bundle whose ramdisk is a truncated cpio inside valid lz4, ./install appended the key to the broken archive and flashed. Now it stops before the plan with "cpio couldn't list vendor_kernel_boot.img's ramdisk: cpio: premature end of file". Only cpio's last stderr line goes into the message, because on bytes that aren't an archive GNU cpio prints a line for each offset it tries before giving its reason. The failing-step test adds cpio -it; it fails against main's tool and with the new die turned into || true.

robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…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.
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