Skip to content

fix: propagate boot image flash failures - #1588

Open
rawer886 wants to merge 3 commits into
bmax121:mainfrom
rawer886:codex/fix-flash-error-handling
Open

fix: propagate boot image flash failures#1588
rawer886 wants to merge 3 commits into
bmax121:mainfrom
rawer886:codex/fix-flash-error-handling

Conversation

@rawer886

@rawer886 rawer886 commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • propagate boot image unpack, patch, repack, write, sync, and verification failures
  • preserve flash_image exit codes in direct install, installer, and unpatch flows
  • verify uncompressed images after writing before reporting success
  • prevent unpatch cleanup commands from hiding boot image restore failures
  • distinguish a successful boot image restore from a later APatch file cleanup failure

Background

Direct Install could report Successfully Flashed even when dd failed to write the boot partition. flash_image discarded dd stderr and returned success after sync. Several callers also read $? after another command had already replaced the original result.

The issue was reproduced with a boot partition write returning I/O error and SCSI Data Protect; the boot partition hash remained unchanged, while the same patched image flashed and booted successfully through fastboot.

Changes

  • return distinct failures for insufficient partition size, read-only targets, write/sync failures, and post-write verification failures
  • retain the original exit status immediately after unpack, patch, unpatch, repack, and flash commands
  • verify the written prefix of uncompressed images with the packaged BusyBox cmp -n implementation
  • stop the unpatch flow before cleanup when boot image restoration fails
  • run cleanup only after the boot image is restored, while still attempting both cleanup operations and reporting any failure
  • keep the reboot-required state when the boot image was restored even if subsequent cleanup fails

Validation

  • sh -n passed for all changed scripts
  • git diff --check passed
  • :app:compileDebugKotlin passed
  • :app:assembleDebug passed
  • :app:testDebugUnitTest passed (NO-SOURCE)
  • packaged BusyBox 1.36.1.1-topjohnwu was verified on the affected beryl device to support cmp -s -n; equal and different prefixes returned 0 and 1 respectively
  • device-side failure injection under the packaged BusyBox ash verified that unpack, patch, unpatch, and repack failures preserve their original non-zero exit codes
  • device-side cleanup injection verified that both cleanup operations are attempted and the combined command remains failed when either operation fails

Fixes #1585

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.

Direct Install reports success when boot partition write fails

1 participant