Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Honor 10 Lite] Cannot flash any GSI image in system via fastboot #1732

Closed
Inui-senpai opened this issue Feb 24, 2021 · 19 comments
Closed

[Honor 10 Lite] Cannot flash any GSI image in system via fastboot #1732

Inui-senpai opened this issue Feb 24, 2021 · 19 comments

Comments

@Inui-senpai
Copy link

Hello. I recently unlocked the bootloader on my own device (its model is HRY-LX1) and tried to flash AOSP 11 image but to no avail. I get this error in fastboot during writing stage: FAILED (remote: 'sparse flash write failure')

Stock system version is EMUI 9.1.0.290 (Android 9.0). System partition type is A/B (according to Treble Info app).

@phhusson
Copy link
Owner

phhusson commented Feb 24, 2021 via email

@Inui-senpai
Copy link
Author

Inui-senpai commented Feb 24, 2021

Yes, issue is that GSIs are bigger than your system partition. You should be able to flash system-roar-arm64-vanilla.img

Tried with "system-roar-arm64-ab-vanilla.img" image. It's strange that fastboot didn't report "max download size" in bytes (or it should not?). And no, same error:

C:\adb>fastboot flash system system.img
Sending sparse 'system' 1/4 (458752 KB)            OKAY [ 10.129s]
Writing 'system'                                   FAILED (remote: 'sparse flash write failure')
fastboot: error: Command failed

If it helps, "FAILED" string appeared practically immediately. But I can erase system partition through fastboot successfully.

@phhusson
Copy link
Owner

phhusson commented Feb 24, 2021 via email

@Inui-senpai
Copy link
Author

I checked twice before downloading and unpacking it from archive. It is. I just renamed it. 🤔
I also tried unpacking and flashing it from another drive (in order to exclude any file integrity errors), without renaming this time.

C:\adb>fastboot flash system system-roar-arm64-ab-vanilla.img
Sending sparse 'system' 1/4 (458752 KB)            OKAY [ 10.135s]
Writing 'system'                                   FAILED (remote: 'sparse flash write failure')
fastboot: error: Command failed

C:\adb>fastboot flash system D:\Downloads\system-roar-arm64-ab-vanilla.img
Sending sparse 'system' 1/4 (458752 KB)            OKAY [ 10.141s]
Writing 'system'                                   FAILED (remote: 'sparse flash write failure')
fastboot: error: Command failed

And if you still don't believe me, here's the screenshot of the properties of image in downloaded archive and unpacked image. The sizes in bytes are the same.
Snap5322

@phhusson
Copy link
Owner

phhusson commented Feb 24, 2021 via email

@Inui-senpai
Copy link
Author

Not sure how I should check it. I flashed TWRP and rebooted in it through adb reboot recovery, but custom recovery initially doesn't want to mount some partitions and shows "Invalid argument" error.
I can mount /system manually by typing in TWRP Terminal: mount -t erofs -r /dev/block/bootdevice/by-name/system /system and check its content by typing ls /system. Then I tried some other commands, for the sake of interest.
Here's the photos of my actions in Terminal:
IMG_20210225_184501
IMG_20210225_184526
IMG_20210225_184633
IMG_20210225_184720
If it helps, I can say stock system image's size I flashed after erasing its partition. 1,33 GB (1 429 608 596 bytes).
Snap5325

@speedson79
Copy link

Hey...did u erase the system before trying to flash a other system.img
fastboot erase system
fastboot flash system system(xxxxxxx).img

C:\adb>fastboot flash system system.img
target reported max download size of 471859200 bytes
sending sparse 'system' (460796 KB)...
OKAY [ 14.642s]
writing 'system'...
OKAY [ 2.989s]
sending sparse 'system' (455360 KB)...
OKAY [ 14.400s]
writing 'system'...
OKAY [ 2.984s]
sending sparse 'system' (460796 KB)...
OKAY [ 14.592s]
writing 'system'...
OKAY [ 3.072s]
sending sparse 'system' (450768 KB)...
OKAY [ 14.259s]
writing 'system'...
OKAY [ 2.971s]
finished. total time: 69.917s

Is the Device authorized in fastboot????

C:\adb>fastboot devices
XXXXXXXXXXXXXXXX fastboot
(Serial-Number)

But you can also try to flash costum Recovery like TWRP

fastboot flash recovery_ramdisk TWRP_XXXXXXXXXXXXXXXXXX.img

then press PWR until the Device Shutdown
then press PWR and Vol+ and keep it holding untile the Huawei Logo is seen in the Display

in TWRP you can Format DATA and Delete Cache Dalvik Data and System
reboot into TWRP
Put the system.img into internal Storage
flash the system.img into system-image!!!

follow the needet steps for your Device

if all is done...reboot

good luck

solong
speedson

@Inui-senpai
Copy link
Author

did u erase the system before trying to flash a other system.img

Yes, same error.

Is the Device authorized in fastboot????

C:\adb>fastboot devices
H8HNW19C03000518        fastboot

But you can also try to flash costum Recovery like TWRP

Yes, I can flash a custom recovery, and I already did it. But I can reboot into it only through adb in loaded system, because Power+Volume Up launches eRecovery.

in TWRP you can Format DATA and Delete Cache Dalvik Data and System

I formatted /data, /cache and /system, then tried to flash system-roar-arm64-ab-vanilla.img. TWRP reported about successfully completed operation, but there is no any files in /system (according to Terminal and File Manager in TWRP). And reboot attempt, unfortunately, lead to bootloop.

@Inui-senpai
Copy link
Author

What's the size of your system parition?

If I got that right, according to recovery.log generated by TWRP, my system partition's size is 1504 MB.

/system_image | /dev/block/mmcblk0p66 | Size: 1504MB
   Flags: Can_Be_Backed_Up IsPresent Can_Flash_Img 
   Primary_Block_Device: /dev/block/mmcblk0p66
   Display_Name: System Image
   Storage_Name: System Image
   Backup_Path: /system_image
   Backup_Name: system_image
   Backup_Display_Name: System Image
   Storage_Path: /system_image
   Current_File_System: emmc
   Fstab_File_System: emmc
   Backup_Method: dd

@Inui-senpai
Copy link
Author

Hm... no, it seems like my system partition's size is same as stock system image: 1,33 GB. I tried to flash OpenKirin's AEX image, which size is 1,30 GB (variant without gapps), and it flashed successfully.

C:\adb>fastboot flash system D:\Downloads\openkirin_aex_10_20200413_NG.img
Sending sparse 'system' 1/3 (460796 KB)            OKAY [ 15.512s]
Writing 'system'                                   OKAY [  5.023s]
Sending sparse 'system' 2/3 (451637 KB)            OKAY [ 15.022s]
Writing 'system'                                   OKAY [  5.699s]
Sending sparse 'system' 3/3 (459913 KB)            OKAY [ 15.039s]
Writing 'system'                                   OKAY [  5.798s]
Finished. Total time: 63.280s

@KatoTempest
Copy link

on a mtk device I had a similar problem, maybe this fastboot command will help "fastboot -u flash system name_of_system.img"

@Inui-senpai
Copy link
Author

maybe this fastboot command will help "fastboot -u flash system name_of_system.img"

Tried with -u flag, but fastboot reported unknown option -- u. I'm using platform-tools version 31.0.0-7110759.

@Inui-senpai
Copy link
Author

I guess I should resize my system partition. In older firmware versions (EMUI 9.0) it has been 2,11 GB.

@KatoTempest
Copy link

I just observed that you have twrp, can't you flash the gsi from there?
or you could change the size of the system from there in the resize option that is in wipe

@Inui-senpai
Copy link
Author

I just observed that you have twrp, can't you flash the gsi from there?

I tried to flash downloaded GSI image through TWRP in several ways:

  1. Without formatting system partition ("as is"): image flashed successfully, but after that I can't boot into system, phone just reboots after "Your device is booting now..." caption appeared.
  2. With formatting system partition, but without mount attempt: same result as in 1.
  3. With formatting system partition, mounting it manually via Terminal before this operation (because TWRP mistakenly tried to mount it as EXT4 partition): again, same result as in 1.
  4. With recovery reboot after formatting, according to 3: same result as in 1, again.

or you could change the size of the system from there in the resize option that is in wipe

I thought so, too, but TWRP shows zeros in Size, Free and Used parameters of this partition. Although I can try to change its size, I doubt it will work. But if I mount this partition manually, I won't be able to do anything with it, because TWRP will be thinking this partition is formatted as "auto", and the zeros will remain in place.

@Inui-senpai
Copy link
Author

So... I tried to format System Root partition in TWRP, then went to Wipe - Advanced Wipe - check System Root and press on Repair or Change File System, and TWRP reported its size is 1456 MB. Recently uploaded AOSP 11 GSI image "system-roar-arm64-ab-vanilla.img" weighs approximately 1504 MB and it can't fit in System Root's size not through fastboot nor TWRP's flashing images mechanism.

IMG_20210307_192613

Can I somehow decrease downloaded GSI image's size?

@Inui-senpai
Copy link
Author

I decreased image size manually, repacking it through Universal Kitchen for Android. Thank you so much for responding, guys. I think I'll create a new issue, if something gone wrong.

@jimmy34556
Copy link

How did you decrease image size, I have the same issue

@dzwdev
Copy link

dzwdev commented Feb 20, 2024

i hope that you tell us how did you decrease the size of the partition
i'm having the same problem with huawei p10

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

No branches or pull requests

6 participants