chenxiaolong / avbroot

Sign (and root) Android A/B OTAs with custom keys while preserving Android Verified Boot
GNU General Public License v3.0
525 stars 42 forks source link

Invalid command resize-logical-partition:system_a:1373093888 #252

Closed lefuglyduck closed 9 months ago

lefuglyduck commented 9 months ago

After flashing both partitions with the factory grapheneOS images. I can only get to this step. ~/Desktop/avbroot/extracted$ for image in *.img; do partition=$(basename "${image}") partition=${partition%.img} fastboot flash "${partition}" "${image}" done Sending 'boot_a' (65536 KB) OKAY [ 1.847s] Writing 'boot_a' OKAY [ 0.245s] Finished. Total time: 2.096s Sending 'init_boot_a' (8192 KB) OKAY [ 0.246s] Writing 'init_boot_a' OKAY [ 0.033s] Finished. Total time: 0.283s Resizing 'system_a' FAILED (remote: 'Invalid command resize-logical-partition:system_a:1373093888') fastboot: error: Command failed Sending 'vbmeta_a' (8 KB) OKAY [ 0.001s] Writing 'vbmeta_a' OKAY [ 0.037s] Finished. Total time: 0.039s Sending 'vendor_boot_a' (65536 KB) OKAY [ 1.876s] Writing 'vendor_boot_a' OKAY [ 0.238s] Finished. Total time: 2.116s

Luckily I have the other partition so no issues.

pascallj commented 9 months ago

Have you tried GrapheneOS without using avbroot before to see if it actually works? This doesn't seem like a problem caused by avbroot to me.

Also what fastboot version are you using? Have you tried the standalone version as described in the GrapheneOS CLI Install guide?

chenxiaolong commented 9 months ago

Oops, I overlooked this when updating the documentation after avbroot started patching system.img.

The problem is that recent Android versions have 2 fastboot modes:

So the procedure should be:

  1. Reboot to bootloader for regular fastboot
  2. Flash all of the extracted partitions besides system.img
  3. Reboot to fastbootd with fastboot reboot-fastboot
  4. Flash system.img

I need to find a good way to document that in the README without turning this step into a big script.

dementeb commented 9 months ago

Wow, it definitely should be in README ;)

3 day of attempts... "I wll always read issues"

lefuglyduck commented 9 months ago

So the procedure should be:

1. Reboot to bootloader for regular fastboot

2. Flash all of the extracted partitions besides `system.img`

3. Reboot to fastbootd with `fastboot reboot-fastboot`

4. Flash `system.img`

I need to find a good way to document that in the README without turning this step into a big script.

I seen your commit, but I don't see this step anywhere in readme.md.

I see you added this step though:

ANDROID_PRODUCT_OUT=extracted fastboot flashall

Is this supposed to be equivalent to steps above?

chenxiaolong commented 9 months ago

The instructions in the new commit (https://github.com/chenxiaolong/avbroot/pull/253/files?short_path=b335630#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5) are an easier way to accomplish the same thing. I haven't merged the changes yet because although I'm pretty confident it'll work, I haven't had the time to factory reset my device and test it myself.

danielphan2003 commented 9 months ago

Where is the android-info.txt that fastboot flashall requires?

chenxiaolong commented 9 months ago

Where is the android-info.txt that fastboot flashall requires?

~An empty android-info.txt should work. I'll update #253 after work today to have avbroot extract generate it.~

EDIT: Hmm, no, looks like more stuff is needed. I'll have to investigate.

danielphan2003 commented 9 months ago

For now you can extract android-info.txt from the factory image:

image

chenxiaolong commented 9 months ago

You might also need super_empty.img from there too.

chenxiaolong commented 9 months ago

For now, I've updated README.md in 80549346eaf1abcb42a705bfdf744d1606b859cf to describe the manual steps I've suggested above.

Once I figure out exactly what is needed to get the fastboot flashall method working, we'll switch over to that. I'll keep discussion about the flashall method in #253.