Update Error 7 On Twrp


alkeshgamer

Members
Jul 10, 2016
5
11
Hello everyone,

I've been trying to flash the 6.6.30 rom on my Mi4 but everytime I do that I get error 7 on twrp.
I've been using latest TWRP 3.0.2.0 and the same also occurs on sMiui rom also.
But no error comes when I flash any CM based ROM.
So further I went into the updater-script to check the differences and found that miui roms has command
package_extract_dir while there is no such command in CM Roms.(Problem is not caused by the assert commands usually found)
I've been trying to figure the solution but no success.
No one else is getting such problems only me.

Please guide/help me on this.
 

buzdo

Members
Jun 25, 2016
128
40
Hey, I get a similar problem when trying to install stable 7.1.5.0 (kitkat). But only that version, while 7.1.3.0 installs fine. I also compared both updater scripts and found only little differences that shouldn't affect installation. Tried using 7.1.3.0 script with 7.1.5.0 and still got error 7. I'm leaning towards the possibility that there is not enough space in "system" to extract the rom because 7.1.5.0 is much bigger compared to 7.1.3.0.. no idea :)

Maybe your problem is something similar and has something to do with partitions. If you have data backed up and don't have a problem wiping everything I suggest you do advanced wipe in twrp and first try flashing an official china developer MM rom via fastboot with miflash tool so the partitions get rebuilt. Then wipe everythign again and install the 6.6.30.

Another way is to add this line before "flash tz..." in the flash_all.bat script of the developer rom:
Code:
fastboot %* flash partition %~dp0images\gpt_both0.bin
fastboot %* flash tz %~dp0images\tz.mbn
This is a sure way for the partitions to get rebuilt but this could brick your phone if something goes wrong.

And another clean way is to go to emergency mode via "adb reboot edl" command and flash the developer rom that way.
 

alkeshgamer

Members
Jul 10, 2016
5
11
Hey, thanks for the help.
But I am getting the same error after flashing official ROM with fastboot and wiping everything.(Actually I posted this after the official ROM flashing and then wiping)
I'll be backing up everything and wiping the whole phone out, then perform the procedure again.
About that code I'll keep it as a last resort.
Thanks for the help
 

buzdo

Members
Jun 25, 2016
128
40
Install diskinfo app after flashing official rom to see if your partitions are good. In advanced options of diskinfo check more options so it shows stuff like unmounted partitions etc. There should only be one system partition and should be about 1.2gb if they were merged correctly (otherwise it will show two system partitions one of them probably unmounted). Then complete wipe and installation of 6.6.30 should work.

For my problem I mentioned it was exactly what I thought the system didn't have enough space to extract 7.1.5.0 (weird because it's kitkat) so I used last official MM global via fastboot. Also that flash partition line was already in the .bat file so didn't need to add it. Check if the line is present in your official version you flashed. It's still possible your partitions weren't built correctly.

In the end it's also possible that the 6.6.30 has something in update script... Did you check if it tries to flash custom twrp recovery too? One time I got insufficient arguments errors when the script was trying to install it so I deleted out those lines of code. You can flash the recovery separately afterwards anyway.
 

alkeshgamer

Members
Jul 10, 2016
5
11
Currently flashing latest 6.7.7 Official China beta rom via fastboot. And yea that line is already present in it.
I'll install that app and check it afterwards.
Yes both ROMs tries to install the latest twrp image but it does that at then end of ROM installation so that might not be the issue maybe, but still I'll lookout for that.
Thanks for all the help till now, I'll let you know further
 

alkeshgamer

Members
Jul 10, 2016
5
11
OK,
I checked with the app and partition is 1.2gb. Wiped everything but still getting error 7. The exact lines are like-
mount: no partition named "/dev/block/platform/msm_sdcc.1/by-name/userdata"
Target...release-keys
mount: no partition named "/dev/block/platform/msm_sdcc.1/by-name/system"
Failed to extract dir from "system" to "/system"
Updater process ended with ERROR: 7
 

alkeshgamer

Members
Jul 10, 2016
5
11
Hey,
The sMiUi ROM worked nicely now, it's installed and running fine.
Thank you for all your help!!
 

giobooo

Members
Jul 9, 2016
73
30
This is what I do for the Error 7:

1) Wipe all from TWRP including system.
2) Install the rom .zip file
3) Error 7 comes up.
4) Reboot phone and go straight back into twrp
5) Flash the same .zip rom without wiping anything this time.

It should now work.
 
  • Like
Reactions: Gorkis and super10

neogeo

Members
Jun 3, 2016
45
20
FIRST and mandatory:
- if You try to transit from KK or LP system to MM, FIRST must reflash phone twice with this "kind" of ROM DOWNLOAD LINK and then to flash any MM file without any errors!!!
ROM from download link are merging partitions for Marsh Mallow...
Download ROM and copy it to root of phone memory, reboot to TWRP, and do it install. After installation and phone system rising, just do again reboot to TWRP and flash it same roma again... Reboot to system and after that could flash desired MM ROM without error 7 ;)

Enjoy!