Flash Partition Error


5ulo

Members
May 25, 2012
135
15
28
#1
Hi there. Till yesterday I was on latest sMIUI KK for my Mi2. Few times I have tried MIUI V6 but it was always terrible. Yesterday I read a lot about MIUI V7 and I was surprised all was good. So I flashed latest CN v6 via fastboot (because I needed new partition table - merged storage) and then I flashed CN v7. After that I updated my phone to latest xiaomi.eu multi rom aries. Today I spent a lot of time to make all set up like I want.. no backup restore, just clean phone with apps and new settings. All was good until one hour back. Suddenly out of nowhere message pops up "google play service has stopped". So I rebooted. After reboot I can't boot to MIUI anymore. All I get is wissible on the video under.
It won't stop, it is neverending story.. click click click.. no report, nothing..
Then I connected the phone via usb cable with my Arch Linux and using adb I saw that there is some permission error. I booted to fastboot and checked some logs:

logcat (3MB) > miui7-logcat.txt
bugreport (9,3MB) > miui7-bugreport.txt

Yep.. permission error and something with partition. I managed to reflash via fastboot latest CN MIUI V7 and it ended with this error

Code:
soc-id: 109
sending 'partition' (33 KB)...
OKAY [  0.003s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.006s
Flash partition error
Notice that code 109 - Missmatching image and device. Tried a lot of sources and filenames were right and yes, my phone is Mi2 almost 4 years :)
aries_images_5.7.26_20150723.0000.6_5.0_cn_a48f37cd10.tgz
aries_images_5.8.20_20150723.0000.6_5.0_cn_11fe586a4a.tgz

And now I am stuck here.. can't flash any CN rom, can't boot to MIUI.. nothing.. phone bricked because of some crappy bug in MIUI V7.
Any suggestions what went wrong and how can i manage this situation?
Thanks for any advice
 
Last edited:

5ulo

Members
May 25, 2012
135
15
28
#2
I can't login to adb shell
Code:
enjoy@arch ~ $ sudo adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
System directory seems like empty
Code:
enjoy@arch ~ $ sudo adb ls /system
000041ed 00000000 00000000 .
000041ed 00000000 55dcdcce ..
I can't find any solution how to restore phone to some usable state (adb, fastboot).. Flashing via fastboot gives me
Code:
soc-id: 109
sending 'partition' (33 KB)...
OKAY [  0.003s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.006s
Flash partition error
fastboot files are fine (tried all possible sources for aries)Is there anyone who can help me or show me the right direction how to restore the messed partition layout? If you need some outputs from my phone just let me know. Thanks for any advice
 
Feb 2, 2015
2
0
11
#3
tried to revert back to v5 with fastboot?

download last fastboot pack here (remove * ):
h**p://bigota.d.miui.com/JLB49.0/aries_images_JLB49.0_4.1_cn_5b246a7ed4.tgz

try the method indicated here to reset partitions (remove * ) :
h**p://en.miui.com/forum.php?mod=redirect&goto=findpost&ptid=119212&pid=2717839

as this post says, try to edit the flash_all.sh with adding the 3rd line (partition re-flash) and retry fastboot with miflash

good luck!
 

5ulo

Members
May 25, 2012
135
15
28
#4
No luck here :(

Code:
enjoy@arch ~/Downloads/Xiaomi/aries_images_JLB49.0_4.1_cn $ sudo sh flash_all.sh
soc-id: 109
sending 'partition' (33 KB)...
OKAY [  0.005s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.008s
Flash partition
this is how I edited the flash_all.sh

Code:
fastboot $* getvar soc-id 2>&1 | grep "^soc-id: *109$"
if [ $? -ne 0 ] ; then echo "Missmatching image and device"; exit 1; fi
fastboot $* flash partition "`dirname $0`/images/gpt_both0.bin"
if [ $? -ne 0 ] ; then echo "Flash partition"; exit 1; fi
fastboot $* flash tz "`dirname $0`/images/tz.mbn"
if [ $? -ne 0 ] ; then echo "Flash tz error"; exit 1; fi
..
..
..
The same in Windows (tried two times)

Code:
[00000CC0]CreateManagedObject(1261): Unspecified error(0x80131604)
[00000CC0]GetFactoryObject(1305): Unspecified error(0x80131604)
[00000CC0]CreateManagedObject(1261): Unspecified error(0x80131604)
[00000CC0]GetFactoryObject(1305): Unspecified error(0x80131604)
[00000CC0]GetFactoryObject(1326): The specified service does not exist.(0x800704db)
[00000CC0]GetSearchPath(1381): The specified service does not exist.(0x800704db)
[000006A4]cd4bce10   0.00   execute C:\Xiaomi\aries_images_JLB49.0_4.1_cn\flash_all.bat
[000006A4]cd4bce10   0.16   
[000006A4]cd4bce10   0.16   $fastboot -s cd4bce10 getvar soc-id  2>&1  | findstr /r /c:"^soc-id: *109"  || echo Missmatching image and device
[000006A4]cd4bce10   0.48   soc-id: 109
[000006A4]cd4bce10   0.48   
[000006A4]cd4bce10   0.48   $fastboot -s cd4bce10 getvar soc-id  2>&1  | findstr /r /c:"^soc-id: *109"  || exit /B 1
[000006A4]cd4bce10   0.50   soc-id: 109
[000006A4]cd4bce10   0.52   
[000006A4]cd4bce10   0.52   $fastboot -s cd4bce10 flash partition "C:\Xiaomi\aries_images_JLB49.0_4.1_cn\images\gpt_both0.bin"  ||
[000006A4]cd4bce10   0.58   sending 'partition' (33 KB)...
[000006A4]cd4bce10   0.59   OKAY [  0.004s]
[000006A4]cd4bce10   0.59   writing 'partition'...
[000006A4]cd4bce10   0.59   FAILED (remote: failed to write partition)
[000006A4]CScriptReport::DoWork(413): Unspecified error(0x80004005)
[000006A4]GetFactoryObject(1326): The specified service does not exist.(0x800704db)
[000006A4]SaveFlashResult(1347): The specified service does not exist.(0x800704db)
[00000CC0]GetFactoryObject(1326): The specified service does not exist.(0x800704db)
[00000CC0]GetSearchPath(1381): The specified service does not exist.(0x800704db)
[00000A18]cd4bce10   0.00   execute C:\Xiaomi\aries_images_JLB49.0_4.1_cn\flash_all.bat
[00000A18]cd4bce10   0.02   
[00000A18]cd4bce10   0.02   $fastboot -s cd4bce10 getvar soc-id  2>&1  | findstr /r /c:"^soc-id: *109"  || echo Missmatching image and device
[00000A18]cd4bce10   0.03   soc-id: 109
[00000A18]cd4bce10   0.03   
[00000A18]cd4bce10   0.03   $fastboot -s cd4bce10 getvar soc-id  2>&1  | findstr /r /c:"^soc-id: *109"  || exit /B 1
[00000A18]cd4bce10   0.05   soc-id: 109
[00000A18]cd4bce10   0.05   
[00000A18]cd4bce10   0.05   $fastboot -s cd4bce10 flash partition "C:\Xiaomi\aries_images_JLB49.0_4.1_cn\images\gpt_both0.bin"  ||
[00000A18]cd4bce10   0.06   sending 'partition' (33 KB)...
[00000A18]cd4bce10   0.06   OKAY [  0.005s]
[00000A18]cd4bce10   0.06   writing 'partition'...
[00000A18]cd4bce10   0.06   FAILED (remote: failed to write partition)
[00000A18]CScriptReport::DoWork(413): Unspecified error(0x80004005)
[00000A18]GetFactoryObject(1326): The specified service does not exist.(0x800704db)
[00000A18]SaveFlashResult(1347): The specified service does not exist.(0x800704db)
 
Last edited:

5ulo

Members
May 25, 2012
135
15
28
#5
Is there any other option how to repartition the phone without adb shell? I read about sideload here http://en.miui.com/thread-70873-1-1.html but this is not my case. I don't have any symptoms mentioned there. Charging led is active, I can boot into MIUI with errors but no UI, I can turn it off with the miui power menu after pressing power button (turn off, restart, flight mode..) and the phone is detected via adb/fastboot, also detected in linux file manager as Mi2 but can't be mounted at this time.
 

5ulo

Members
May 25, 2012
135
15
28
#7
No I haven't. That script was for Mi2S 32GB. Mine is Mi2 16GB
And the second reason is I cant reach adb shell

Code:
enjoy@arch ~ $ sudo adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
 
Jun 28, 2014
204
76
52
#8
No I haven't. That script was for Mi2S 32GB. Mine is Mi2 16GB
And the second reason is I cant reach adb shell

Code:
enjoy@arch ~ $ sudo adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
If you're talking about the repartition script is for both 16 and 32 gb version.I use it with my 16 gb mi2s.As for adb have you tried from a windows pc?You can try this http://xiaomi.eu/community/threads/script-fix-partition-table-for-android-4-4.22947/page-8#post-213944
 
Last edited:

5ulo

Members
May 25, 2012
135
15
28
#9
Ok so in shor..
I can adb shell!!!!
I can't parted, sideload nor dload (dload reboots my phone to unusable miui - check video in first post).
I don't have CWM or TWRP and I am not able to install them because of
Code:
enjoy@arch ~/Downloads/Xiaomi $ sudo fastboot flash recovery recovery.img
[sudo] password for enjoy: 
sending 'recovery' (9118 KB)...
OKAY [  0.293s]
writing 'recovery'...
FAILED (remote: flash write failure)
finished. total time: 0.294s
I googled and found that I have to fastboot erase cache and ??? erase recovery ??? I was so desperate and erase recovery and tried to falsh recovery again (CWM) without any luck.
So I can't parted/sideolad/dload because I can't flash CWM which is needed. This is neverending story.
Oh .. and I tried M1cha's partition script and guess what.. first step tells "1) boot into CWM" ... lol I can't :D I improvized:
Code:
1. adb shell mkdir /tmp
2. adb push repartition.sh /tmp
3. adb shell chmod 0777 /tmp/repartition.sh
4. adb shell /tmp/repartition.sh
4th step ended by error
Code:
/system/bin/sh: /tmp/repartition.sh: not found
I'm so tired :(