[Q] Flashing custom built rom with fastboot - G2 and Desire Z Q&A, Help & Troubleshooting

Hello there!
This perhaps would belong to the development forum, but there's a 10 post limit and I'm a newbie here.
I started my android ROM development with a very "easy" project, trying to port KitKat to Desire Z. I have the AOSP sources, and then I added device/htc/ and vendor/ stuff from Andromadus github, and modified everything until the thing actually compiled without errors.
I now have out/target/product/vision/ with these .img files:
-rw-r--r-- 1 tsuikki tsuikki 3739648 marra 20 00:05 boot.img
-rw-rw-r-- 1 tsuikki tsuikki 326286 marra 20 00:04 ramdisk.img
-rw-rw-r-- 1 tsuikki tsuikki 889437 marra 20 00:05 ramdisk-recovery.img
-rw-r--r-- 1 tsuikki tsuikki 4302848 marra 20 00:05 recovery.img
-rw-r--r-- 1 tsuikki tsuikki 273913828 marra 20 00:07 system.img
-rw-r--r-- 1 tsuikki tsuikki 24281656 marra 20 00:04 userdata.img
I flashed these with "fastboot -w flashall", which might have been a mistake, because it unnecessarily flashed recovery also? Anyway, it almost bricked the phone. Only the bootloader was working, I couldn't enter recovery or boot to android.
"adb devices" would show the device, but any operation fails with:
"- exec '/system/bin/sh' failed: No such file or directory (2) -"
I guess this indicates that /system is faulty? Is it possible that fastboot somehow flashed the images to wrong addresses, because every single one seemed to go broken?
I then downloaded "recovery-clockwork-5.0.2.7-vision.img" and flashed with "fastboot flash recovery".. Then I could boot into recovery and restore my backup, so the phone is working again. Phew!
Clockworkmod recovery also complained something "can't mount /cache" which again would indicate that entire filesystem was broken?
I didn't really expect my Kitkat to work right out of the box, but I think I'm missing something obvious on how these images should be flashed..

Related

[Q] Fastboot ``cannot load system.img''

I was flashing my yakjuxw over to yakju, when fastboot started failing to load system.img.
I have tried 4.0.2 and 4.0.1. Every image except for system.img works.
Code:
[[email protected] yakju-itl41f]# fastboot flash system system.img
error: cannot load 'system.img'
And it doesn't work using the zip either;
Code:
[[email protected] yakju-itl41f]# fastboot update *.zip
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 325426112 bytes
error: update package missing system.img
I am running Archlinux.
Somewhere in the ./flash-all.sh script my ``sdcard'' was wiped, so I've lost my nandroid(s), but I can boot CWM from my PC. Help?
Open the zip file in a explorer-window somewhere and locate the system.img file and then try the first one over again.
None of these files are magic and they are pretty easy to explore to find the components you are looking for.
Are you sure you've unpacked things correctly?
What does the output from "ls -la" run in the the same folder say?
josteink said:
Open the zip file in a explorer-window somewhere and locate the system.img file and then try the first one over again.
None of these files are magic and they are pretty easy to explore to find the components you are looking for.
Are you sure you've unpacked things correctly?
What does the output from "ls -la" run in the the same folder say?
Click to expand...
Click to collapse
I unpacked the zip, so all the images in it are in this folder, but here's the output:
Code:
[[email protected] yakju-itl41f]# ls -la
total 663156
drwxr-x--- 2 david users 4096 Jan 18 20:17 .
drwxr-xr-x 4 david users 4096 Jan 18 20:07 ..
-rw-r----- 1 david users 93 Nov 21 18:20 android-info.txt
-rw-r--r-- 1 david users 4151296 Jan 1 2009 boot.img
-rw-r----- 1 david users 2363392 Nov 24 09:44 bootloader-maguro-primekj10.img
-rwxr-x--- 1 david users 831 Nov 24 09:44 flash-all.sh
-rw-r----- 1 david users 189165717 Nov 24 09:44 image-yakju-itl41f.zip
-rw-r----- 1 david users 12583168 Nov 24 09:44 radio-maguro-i9250xxkk1.img
-rw-r--r-- 1 david users 4491264 Jan 1 2009 recovery.img
-rwxrwxrwx 1 david users 325426112 Jan 1 2009 system.img
-rw------- 1 david users 140856312 Nov 22 11:09 userdata.img
Did you actually ever unlock fast boot? Just guessing here, at this point.
Sent from my Galaxy Nexus using Tapatalk
redownload stock images?
just an update, this is solved. The solution was found in rebooting my pc, which is something I, as a Linux user, seldom do, and my laptop cannot be trusted to boot due to its buggy BIOS.
Sent from my Galaxy Nexus
Korntoff said:
just an update, this is solved. The solution was found in rebooting my pc, which is something I, as a Linux user, seldom do, and my laptop cannot be trusted to boot due to its buggy BIOS.
Sent from my Galaxy Nexus
Click to expand...
Click to collapse
Ridiculously old thread, I realize, so I feel kinda bad bumping it, but it's an early result on Google when searching for this problem, so I'll update a bit.
Rebooting will work, but isn't necessary, and is inconvenient. You just need to kill fastboot, it's hung with another process.
In linux, open up a terminal.
Code:
ps ax|grep fastboot
Note the PID(s)
Code:
kill -9 <PID1> <PID2>...<PIDn>
Another reason for this error is if you have device encryption enabled. In order to restore factory image, you first need to format /data to remove encryption.
I have no idea why this causes the error "cannot load system.img", but it definitely does.
Cerinthus said:
Ridiculously old thread, I realize, so I feel kinda bad bumping it,
In linux, open up a terminal...
Click to expand...
Click to collapse
Thanks for posting this.
In windows, I used task manager to find the ADB process and killed it, and then it worked fine.
groopk said:
Thanks for posting this.
In windows, I used task manager to find the ADB process and killed it, and then it worked fine.
Click to expand...
Click to collapse
To do this without searching thought task manager , just type "adb kill server " and then " adb start server" :thumbup:
Sent from my SCH-I605 using Tapatalk
quite an old thread again, but replying anyway.
The "failed to allocate ***** bytes" message means that it failed on memory of your computer, not on the storage of your phone.
Code:
fastboot.c
...
void *unzip_file(zipfile_t zip, const char *name, unsigned *sz)
{
...
*sz = get_zipentry_size(entry);
datasz = *sz * 1.001;
data = malloc(datasz);
if(data == 0) {
fprintf(stderr, "failed to allocate %d bytes\n", *sz);
return 0;
}
...
If it turns out that your machine has too small memory(unfortunately, which was also my case), you could unzip the file containing img files and flash system, boot and recovery images one by one. It's just the same.
great help
On the verge of flashing lolipop on my beloved n5, I got stuck with that stupid errror.
Thanks for the helpfull post.
downgrade to 4.4.4
just downgrade to 4.4.4 and then flash android 5.... mine worked....
FreakyTux said:
quite an old thread again, but replying anyway.
The "failed to allocate ***** bytes" message means that it failed on memory of your computer, not on the storage of your phone.
Code:
fastboot.c
...
void *unzip_file(zipfile_t zip, const char *name, unsigned *sz)
{
...
*sz = get_zipentry_size(entry);
datasz = *sz * 1.001;
data = malloc(datasz);
if(data == 0) {
fprintf(stderr, "failed to allocate %d bytes\n", *sz);
return 0;
}
...
If it turns out that your machine has too small memory(unfortunately, which was also my case), you could unzip the file containing img files and flash system, boot and recovery images one by one. It's just the same.
Click to expand...
Click to collapse
This was it! Thanks for posting!
Update ADB. That worked for me
same problem
i tried everything above but nothing works ..... can anyone help me out here
Alternate Way that always works..!!
1. Install TWRP recovery.
2. Mount USB Storage
3. Copy the system.img to phone storage
4. Select Install and then Select Install Image
5. Select the system.img file
6. Select partition as system
7. Confirm install
Done..
Korntoff said:
I was flashing my yakjuxw over to yakju, when fastboot started failing to load system.img.
I have tried 4.0.2 and 4.0.1. Every image except for system.img works.
Code:
[[email protected] yakju-itl41f]# fastboot flash system system.img
error: cannot load 'system.img'
And it doesn't work using the zip either;
Code:
[[email protected] yakju-itl41f]# fastboot update *.zip
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 325426112 bytes
error: update package missing system.img
I am running Archlinux.
Somewhere in the ./flash-all.sh script my ``sdcard'' was wiped, so I've lost my nandroid(s), but I can boot CWM from my PC. Help?
Click to expand...
Click to collapse
rakesh.aggarwal said:
1. Install TWRP recovery.
2. Mount USB Storage
3. Copy the system.img to phone storage
4. Select Install and then Select Install Image
5. Select the system.img file
6. Select partition as system
7. Confirm install
Done..
Click to expand...
Click to collapse
with lots of thanks and much love!! fixed my device yeeyyyy!!!!

Back to Stock (4.1.2 image) and re-root project - Help needed

Hello again.
After having ROMed and MODing to my liking, I decided to go back to stock since the 4.1.2 is up for my GN version (maguro).No other partition has been flashed (radio, kernel, etc).
My goal is to get into a stock state using 4.1.2 images and be unrooted.
I am thinking of booting into fastboot then:
fastboot flash all yakju-jzo54k-factory-92ff9457.tgz
I guess that command should:
- flash everything inside the .tgz
- install stock recovery image
- unroot the phone (?)
but wouldn't clear my data and apps I guess.So afterwards I could either:
- fastboot erase userdata
- lock and unlock the bootloader
The goal is to erase all apps and /sdcard parition.Right or wrong?
After I am set up I would like to root the phone but doing it manually and not via CWM .zip installation.
Is there a guide somewhere explaining what needs to be done for rooting cause searching didn't help much...
Thanks in advance.
The GNex toolkit is your friend....
http://forum.xda-developers.com/showthread.php?t=1392310
Download it, connect to phone to PC and follow the prompts. I recently did the same thing (I'm on VZW) completely unrooted and back to stock when VZW released the 4.1 update. Used it for a week or two and came back to CM10 Nightlies. Used the toolkit and re-rooted and what not....
I would recommend donating and getting the auto update feature activated. The link above includes the most recent released download, but it was actually a ways behind if you have the auto update feature active. The dev does not require a certain amount donated, so I felt $15 was plenty.
(Just checked the download link is 7.8 and the auto update brings you up to 8.2)
TR-909 said:
Hello again.
After having ROMed and MODing to my liking, I decided to go back to stock since the 4.1.2 is up for my GN version (maguro).No other partition has been flashed (radio, kernel, etc).
My goal is to get into a stock state using 4.1.2 images and be unrooted.
I am thinking of booting into fastboot then:
fastboot flash all yakju-jzo54k-factory-92ff9457.tgz
I guess that command should:
- flash everything inside the .tgz
- install stock recovery image
- unroot the phone (?)
but wouldn't clear my data and apps I guess.So afterwards I could either:
- fastboot erase userdata
- lock and unlock the bootloader
The goal is to erase all apps and /sdcard parition.Right or wrong?
After I am set up I would like to root the phone but doing it manually and not via CWM .zip installation.
Is there a guide somewhere explaining what needs to be done for rooting cause searching didn't help much...
Thanks in advance.
Click to expand...
Click to collapse
OK, let's get started.
- extract yakju-jzo54k-factory-92ff9457.tgz (tgz means it's a tar file, further compressed with gzip), in the end you'll see:
valhalla% ls -ltch gimages/yakju-jzo54k
total 246M
-rwxr-xr-x 1 bk201 users 831 Oct 13 10:47 flash-all.sh
-rw-r--r-- 1 bk201 users 2.3M Oct 13 10:46 bootloader-maguro-primelc03.img
-rw-r--r-- 1 bk201 users 232M Oct 13 10:46 image-yakju-jzo54k.zip
-rw-r--r-- 1 bk201 users 13M Oct 13 10:46 radio-maguro-i9250xxlf1.img
-rw-r--r-- 1 bk201 users 789 Oct 13 10:46 flash-base.sh
Click to expand...
Click to collapse
- edit flash-all.sh, which contains:
Code:
fastboot flash bootloader bootloader-maguro-primelc03.img
fastboot reboot-bootloader
sleep 5
fastboot flash radio radio-maguro-i9250xxlf1.img
fastboot reboot-bootloader
sleep 5
fastboot -w update image-yakju-jzo54k.zip
from here, we will flash bootloader, radio, and update-image, but to do it manually, first we need to extract image-yakju-jzo54k.zip.
valhalla% unzip -l gimages/yakju-jzo54k/image-yakju-jzo54k.zip
Archive: gimages/yakju-jzo54k/image-yakju-jzo54k.zip
Length Date Time Name
--------- --------- ----- ----
4472832 2009-01-01 00:00 boot.img
4823040 2009-01-01 00:00 recovery.img
410365584 2009-01-01 00:00 system.img
140856312 2012-10-03 22:09 userdata.img
93 2012-10-02 15:03 android-info.txt
--------- -------
Click to expand...
Click to collapse
- last step, all the files in the same folder (i'm assuming you have fastboot in your path and device in bootloader mode, connected to the pc), enter the following commands:
Code:
1) fastboot flash bootloader bootloader-maguro-primelc03.img
2) fastboot reboot-bootloader
(..device will reboot into bootloader, obviously wait for bootloader screen to come up again)
3) (optional but recommended) fastboot flash radio radio-maguro-i9250xxlf1.img
4) fastboot reboot-bootloader
5) fastboot flash recovery recovery.img
6) fastboot flash boot boot.img
7) fastboot flash system system.img
8) (will wipe /data/media; optional) fastboot flash userdata userdata.img
TR-909 said:
The goal is to erase all apps and /sdcard parition.Right or wrong?
Click to expand...
Click to collapse
It's best to fresh start yes, but userdata is just /data/media.
also, with this process, no need to unroot. /system will be wiped.
if you want to root manually, and i'm pulling this from my head, you just need to push su binary to /system/xbin and chmod 0755 06755 it, and push supersu.apk to /system/app and chmod 0644 it. attention, this will either require the use of an exploit (for example, the one available to root without unlocking bl), or
Code:
fastboot boot cwm_or_twrp.img
....remount system rw (we have temp root because of custom recovery)
Code:
mount -o rw /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system
push su binary/supersu.apk to the previously said locations and set permissions (i've checked a flashable zip i got from efrant and it seems it's 06755)
Code:
adb push supersu/system/xbin/su /sytem/xbin/su
adb shell chmod 06755 /system/xbin/su
adb push supersu/system/bin/su /system/bin/su
adb shell chmod 06755 /system/bin/su
adb push supersu/system/app/Superuser.apk /system/app/Superuser.apk
adb shell chmod 0644 /system/app/Superuser.apk
adb reboot
done. someone please post if i missed/got anything wrong. this is i would go about it.
you could just have read this.
Hey bk201doesntexist.
Actually I read the guide of efrant and was questioning myself about fastboot flash all command but I probably haven't understand it well.I am going to proceed and do all steps as you suggest.
Back to work... will report soon.
Thanks.
EDIT: Currently on 4.1.2 updating gapps, whole procedure took less than 3 minutes including reboots! Didn't thoroughly check new update but first I am going to bring back my apps and stuff through TiB.
About Rooting: so basically I should boot temporarily on CWM and Adb do the root thingie.Ok let me look into it...

[help] Gnex brick/softbrick/emmc problem

Hello guys, Im a experienced user with ROMs, recovery, boot and etc but i have a problem now, and i will try to explain shortly:
AT THE MOMENT:
- I get into fastboot mode
- I get into odin downloading mode
- I have a connection with pc(win8.1)
- The computer can communicate with the phone in fastboot mode and adb(recovery)
- the drivers are installed correctly
- BOOTLOOPIN ON GOOGLE
How this happened:
I was minding my own business and my phone was on my desk when it suddenly rebooted itself and then it bootlooped forever. I had some situations when it rebooted itself but always ended in a successful boot, this time it didnt wanted to start.
What have i done till now:
- First thing i entered recovery(TWRP) and dirtyflashed my current rom version and wiped dalvik/cache. (unsuccessful)
- after several times doing the dirtyflash i finally decided to make a complete hard/factory reset the result was none (after i rebooted to recovery again ALL THE DATA WAS THERE WITHOUT ANY DIFFERENCE, like nothing happened)
- Second thing i tried flashing with Odin3 in Download mode - result was unsuccessful (Operation failed at ~45% and the phone freezed) - I tried this several times with different versions of the software and firmware on 2 different computers (same result)
- Third thing i tried to push img with ADB - no result
- Fourth thing i tried the NexusToolKit and using the UNROOT/GOBACK TO STOCK/SOFTBRICK option - operation was SUCCESSFUL (that's what the cmd console said) BUT, after around 15 mins booting on GOOGLE it started booting my old custom ROM that i had (CarbonROM) with its custom boot animation and i was WTF?! - after several minutes it finally booted the rom. As i tried to unlocked it the touchscreen and processing was very slow and unresponsive, it took around 10-15sec. to unlock the phone and then opening the home menu, and in a short delay the phone restarted itself.
- I tried deleting system,data,userdata,cache and etc with the toolkit but same resault - when i rebooted the information was still there.
- I readed alot on the forums and i found that it maybe caused my my eMMC but long ago i checked with a google store app that my chip is from the safe ones and cant go brickbug.
Some information about the phone:
Product Name - tuna
Variant - maguro 16gb
HW version - 9
Bootloader Version - primemd04
baseband version - I9250XXLJ1
carrier info - none
serial number - 0149C7ED0D020018
signing - production
lock state- unlocked
if anything needed pls ask
valkata1212 said:
Hello guys, Im a experienced user with ROMs, recovery, boot and etc but i have a problem now, and i will try to explain shortly:
AT THE MOMENT:
- I get into fastboot mode
- I get into odin downloading mode
- I have a connection with pc(win8.1)
- The computer can communicate with the phone in fastboot mode and adb(recovery)
- the drivers are installed correctly
- BOOTLOOPIN ON GOOGLE
How this happened:
I was minding my own business and my phone was on my desk when it suddenly rebooted itself and then it bootlooped forever. I had some situations when it rebooted itself but always ended in a successful boot, this time it didnt wanted to start.
What have i done till now:
- First thing i entered recovery(TWRP) and dirtyflashed my current rom version and wiped dalvik/cache. (unsuccessful)
- after several times doing the dirtyflash i finally decided to make a complete hard/factory reset the result was none (after i rebooted to recovery again ALL THE DATA WAS THERE WITHOUT ANY DIFFERENCE, like nothing happened)
- Second thing i tried flashing with Odin3 in Download mode - result was unsuccessful (Operation failed at ~45% and the phone freezed) - I tried this several times with different versions of the software and firmware on 2 different computers (same result)
- Third thing i tried to push img with ADB - no result
- Fourth thing i tried the NexusToolKit and using the UNROOT/GOBACK TO STOCK/SOFTBRICK option - operation was SUCCESSFUL (that's what the cmd console said) BUT, after around 15 mins booting on GOOGLE it started booting my old custom ROM that i had (CarbonROM) with its custom boot animation and i was WTF?! - after several minutes it finally booted the rom. As i tried to unlocked it the touchscreen and processing was very slow and unresponsive, it took around 10-15sec. to unlock the phone and then opening the home menu, and in a short delay the phone restarted itself.
- I tried deleting system,data,userdata,cache and etc with the toolkit but same resault - when i rebooted the information was still there.
- I readed alot on the forums and i found that it maybe caused my my eMMC but long ago i checked with a google store app that my chip is from the safe ones and cant go brickbug.
Some information about the phone:
Product Name - tuna
Variant - maguro 16gb
HW version - 9
Bootloader Version - primemd04
baseband version - I9250XXLJ1
carrier info - none
serial number - 0149C7ED0D020018
signing - production
lock state- unlocked
if anything needed pls ask
Click to expand...
Click to collapse
first question is, what do you mean by download mode and odin? are you not using the google galaxy nexus? for all i know, that device has fastboot but not download mode, which is a proprietary fork of fastboot (i think). am i wrong? how do you boot into download mode?
your emmc might be locked in read-only mode. when the emmc firmware data structures get corrupted beyond the firmware capacity to fix them, the firmware downgrades to read-only mode, in which you can at least recover the stored information (or part of it).
grab a different custom recovery version than the one in your phone and "fastboot flash" it. then get into the recovery. do you get the newly flashed recovery or the old one that was already on your phone?
Lanchon said:
first question is, what do you mean by download mode and odin? are you not using the google galaxy nexus? for all i know, that device has fastboot but not download mode, which is a proprietary fork of fastboot (i think). am i wrong? how do you boot into download mode?
your emmc might be locked in read-only mode. when the emmc firmware data structures get corrupted beyond the firmware capacity to fix them, the firmware downgrades to read-only mode, in which you can at least recover the stored information (or part of it).
grab a different custom recovery version than the one in your phone and "fastboot flash" it. then get into the recovery. do you get the newly flashed recovery or the old one that was already on your phone?
Click to expand...
Click to collapse
Im using the Samsung galaxy nexus and under "download mode odin" i mean VOLUME DOWN + power button. Phone got both odin and fastboot. Fastboot works in bootloader mode ( volume up + volume down + power button).
I already tried with another custom recovery different from the one currently using, yes it flashes the new one - i tried with philz and cw recovery, both booted but again i couldnt wipe everything.
Lanchon said:
first question is, what do you mean by download mode and odin? are you not using the google galaxy nexus? for all i know, that device has fastboot but not download mode, which is a proprietary fork of fastboot (i think). am i wrong? how do you boot into download mode?
your emmc might be locked in read-only mode. when the emmc firmware data structures get corrupted beyond the firmware capacity to fix them, the firmware downgrades to read-only mode, in which you can at least recover the stored information (or part of it).
grab a different custom recovery version than the one in your phone and "fastboot flash" it. then get into the recovery. do you get the newly flashed recovery or the old one that was already on your phone?
Click to expand...
Click to collapse
the galaxy nexus certainly has download mode/Odin.
it is a Samsung device, they all have this.
just like even the HTC nexus device have hboot
to the op, I wish you much luck, I cannot comment much on this, I had similar happen once and I used "fastboot boot recovery.img" and luckily was able to fix my device from there, but I see this happen sometimes to others (few threads on here about it) where they weren't able to get her back up and running I hope that is not the case for you.
---------- Post added at 12:13 AM ---------- Previous post was at 12:08 AM ----------
oh, also, do you have multiple batteries? have you tried another battery? seems simple enough, but I've heard of devices acting awry similar to this when the battery has taken a crap. (sometime the battery will act as if it's charging and holding charge just fine, but it never actually gets itself to fully charged, for example I think fully charged battery should read about 4.12 with a voltmeter, but one that's gone faulty doesn't reach that, is as if it just cannot provide enough juice needed to get things done causing the device to fail while trying to use that battery)
ashclepdia said:
the galaxy nexus certainly has download mode/Odin.
it is a Samsung device, they all have this.
just like even the HTC nexus device have hboot
to the op, I wish you much luck, I cannot comment much on this, I had similar happen once and I used "fastboot boot recovery.img" and luckily was able to fix my device from there, but I see this happen sometimes to others (few threads on here about it) where they weren't able to get her back up and running I hope that is not the case for you.
---------- Post added at 12:13 AM ---------- Previous post was at 12:08 AM ----------
oh, also, do you have multiple batteries? have you tried another battery? seems simple enough, but I've heard of devices acting awry similar to this when the battery has taken a crap. (sometime the battery will act as if it's charging and holding charge just fine, but it never actually gets itself to fully charged, for example I think fully charged battery should read about 4.12 with a voltmeter, but one that's gone faulty doesn't reach that, is as if it just cannot provide enough juice needed to get things done causing the device to fail while trying to use that battery)
Click to expand...
Click to collapse
I have one and only stock battery. TWRP has a battery counter and it seems ok it stays always on 100% when plugged in the usb. I will try to check it with a voltmeter but i doubt that the problem is from the battery.
Waiting Lanchon to asnwer
valkata1212 said:
Im using the Samsung galaxy nexus and under "download mode odin" i mean VOLUME DOWN + power button. Phone got both odin and fastboot. Fastboot works in bootloader mode ( volume up + volume down + power button).
I already tried with another custom recovery different from the one currently using, yes it flashes the new one - i tried with philz and cw recovery, both booted but again i couldnt wipe everything.
Click to expand...
Click to collapse
ok! i had 2 galaxy nexus and never realized they had download mode lol, or at least i dont remember knowing!
so to confirm: you flash any recovery and it sticks and works. you flash it using "fastboot flash recovery x.img". you ARE NOT booting it directly with "fastboot boot x.img". confirm?
this means that your emmc is not fully locked down, and is good news.
Lanchon said:
ok! i had 2 galaxy nexus and never realized they had download mode lol, or at least i dont remember knowing!
so to confirm: you flash any recovery and it sticks and works. you flash it using "fastboot flash recovery x.img". you ARE NOT booting it directly with "fastboot boot x.img". confirm?
this means that your emmc is not fully locked down, and is good news.
Click to expand...
Click to collapse
BAD NEWS: NOPE, i do not confirm, i only did fastboot boot x.img!! Now i tried fastboot flash recovery x.img, restarted bootloader, and entered to recovery and - bang - old recovery is there. It's seems that my phone is a goner right??
valkata1212 said:
BAD NEWS: NOPE, i do not confirm, i only did fastboot boot x.img!! Now i tried fastboot flash recovery x.img, restarted bootloader, and entered to recovery and - bang - old recovery is there. It's seems that my phone is a goner right??
Click to expand...
Click to collapse
ok your emmc is locked in read-only mode. i had a gnex brought to me in that condition and there was absolutely nothing i could do to fix it. writes are ignored by the emmc (but return "ok" to the kernel) and take near zero time. i tried issuing emmc erase commands, etc, and they were all ignored. i tried booting via USB (via an OMAP debugger) and i couldn't accomplish anything. there is a thread here in xda that details what i tried and what i found out. in the end, i had to replace the motherboard of that phone.
but... i know more now
there is one thing you could try: completely reset the emmc. but really, given that you didnt follow a simple fastboot flash instruction and did a fastboot boot instead makes me think that you wont be able to correctly follow the procedure to completion, but we can try.
the trick is to resize the boot partitions, and during that operation the complete emmc will be wiped. this includes the corrupted FTL data structures inside the emmc that i suspect are causing the read-only lock.
so, caveats:
-this has never ever been tried on this device or this emmc. but it was done successfully in some kindles of the same era, which have a different but similar emmc (both are samsung emmcs). take a look here but DO NOT follow that procedure:
http://forum.xda-developers.com/showthread.php?t=2413453
-everything gets wiped! including bootloaders, partition table, partitions, etc.
-the kindle can boot from usb, but the gnex cant. if the gnex is shut down or rebooted after wiping the emmc but before reconstituting the boot chain, THE DEVICE WILL BE BRICKED FOREVER and never boot again.
-if something goes wrong, BRICK.
-the procedure we will improvise and try can be plain wrong, and the device might BRICK.
-the emmc might ignore the boot partition resize command, in which case it wont brick any further, but this whole adventure would be a failure.
-actually i lied. if the device is rebooted without a proper boot chain, there is a boot-over-USB OMAP debugger that can boot it into a monitor. but reconstituting the boot chain from there might be impossible.
read everything twice and make sure you understand everything i write. ASK instead of guessing!
FROM NOW ON: everything you do, you will do it in latest release of TWRP for your device. before doing ANYTHING here, each time you boot your phone you will enter fastboot mode and "fastboot boot" this TWRP image. then you will "adb shell" to it, or "adb push/pull" to/from it.
first i need a map of your emmc. adb shell then run this and paste the output:
ls -l /dev/block/mmc*
ls -l /dev/block/platform/[whatever device name]/by-name
fdisk -l /dev/block/mmcblk0
---------- Post added at 03:25 PM ---------- Previous post was at 03:19 PM ----------
please post outputs in [ CODE ] tags so that its more readable.
Lanchon said:
ok your emmc is locked in read-only mode. i had a gnex brought to me in that condition and there was absolutely nothing i could do to fix it. writes are ignored by the emmc (but return "ok" to the kernel) and take near zero time. i tried issuing emmc erase commands, etc, and they were all ignored. i tried booting via USB (via an OMAP debugger) and i couldn't accomplish anything. there is a thread here in xda that details what i tried and what i found out. in the end, i had to replace the motherboard of that phone.
but... i know more now
there is one thing you could try: completely reset the emmc. but really, given that you didnt follow a simple fastboot flash instruction and did a fastboot boot instead makes me think that you wont be able to correctly follow the procedure to completion, but we can try.
the trick is to resize the boot partitions, and during that operation the complete emmc will be wiped. this includes the corrupted FTL data structures inside the emmc that i suspect are causing the read-only lock.
so, caveats:
-this has never ever been tried on this device or this emmc. but it was done successfully in some kindles of the same era, which have a different but similar emmc (both are samsung emmcs). take a look here but DO NOT follow that procedure:
http://forum.xda-developers.com/showthread.php?t=2413453
-everything gets wiped! including bootloaders, partition table, partitions, etc.
-the kindle can boot from usb, but the gnex cant. if the gnex is shut down or rebooted after wiping the emmc but before reconstituting the boot chain, THE DEVICE WILL BE BRICKED FOREVER and never boot again.
-if something goes wrong, BRICK.
-the procedure we will improvise and try can be plain wrong, and the device might BRICK.
-the emmc might ignore the boot partition resize command, in which case it wont brick any further, but this whole adventure would be a failure.
-actually i lied. if the device is rebooted without a proper boot chain, there is a boot-over-USB OMAP debugger that can boot it into a monitor. but reconstituting the boot chain from there might be impossible.
read everything twice and make sure you understand everything i write. ASK instead of guessing!
FROM NOW ON: everything you do, you will do it in latest release of TWRP for your device. before doing ANYTHING here, each time you boot your phone you will enter fastboot mode and "fastboot boot" this TWRP image. then you will "adb shell" to it, or "adb push/pull" to/from it.
first i need a map of your emmc. adb shell then run this and paste the output:
ls -l /dev/block/mmc*
ls -l /dev/block/platform/[whatever device name]/by-name
fdisk -l /dev/block/mmcblk0
---------- Post added at 03:25 PM ---------- Previous post was at 03:19 PM ----------
please post outputs in [ CODE ] tags so that its more readable.
Click to expand...
Click to collapse
Im doing the adb shell commands now but I have 1 question: How to find my DEVICE NAME?? im not sure what to type from all the data i get, i will wait until you respond to proceed.
EDIT: This is what i get for now:
Code:
~ # ←[6nls -l /dev/block/mmc*
ls -l /dev/block/mmc*
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
brw------- root root 179, 0 2015-02-05 15:26 mmcblk0
brw------- root root 179, 8 2015-02-05 15:26 mmcblk0boot0
brw------- root root 179, 16 2015-02-05 15:26 mmcblk0boot1
brw------- root root 179, 1 2015-02-05 15:26 mmcblk0p1
brw------- root root 259, 2 2015-02-05 15:26 mmcblk0p10
brw------- root root 259, 3 2015-02-05 15:26 mmcblk0p11
brw------- root root 259, 4 2015-02-05 15:26 mmcblk0p12
brw------- root root 259, 5 2015-02-05 15:26 mmcblk0p13
brw------- root root 179, 2 2015-02-05 15:26 mmcblk0p2
brw------- root root 179, 3 2015-02-05 15:26 mmcblk0p3
brw-rw---- radio radio 179, 4 2015-02-05 15:26 mmcblk0p4
brw------- root root 179, 5 2015-02-05 15:26 mmcblk0p5
brw------- root root 179, 6 2015-02-05 15:26 mmcblk0p6
brw------- root root 179, 7 2015-02-05 15:26 mmcblk0p7
brw------- root root 259, 0 2015-02-05 15:26 mmcblk0p8
brw-rw---- radio radio 259, 1 2015-02-05 15:26 mmcblk0p9
~ # ←[6n
Code:
~ # ←[6nls -l /dev/block/platform/
ls -l /dev/block/platform/
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
drwxr-xr-x root root 2015-02-05 15:26 omap
~ # ←[6n
Code:
~ # ←[6nls -l /dev/block/platform/omap
ls -l /dev/block/platform/omap
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
drwxr-xr-x root root 2015-02-05 15:26 omap2_mcspi.3
drwxr-xr-x root root 2015-02-05 15:26 omap_hsmmc.0
~ # ←[6n
Code:
~ # ←[6nfdisk -l /dev/block/mmcblk0
fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 15.7 GB, 15758000128 bytes
1 heads, 16 sectors/track, 1923584 cylinders
Units = cylinders of 16 * 512 = 8192 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 1923584 15388671+ ee EFI GPT
Partition 1 does not end on cylinder boundary
~ # ←[6n
Tell me if you need something
valkata1212 said:
How to find my DEVICE NAME??
Click to expand...
Click to collapse
you should try all options!
but i think it is probably omap/omap_hsmmc.0
are you sure you are "fastboot boot" booting into the latest TWRP recovery before doing adb shell??? your fdisk command doesn't support GPT disks, that is very strange.
also do:
cat /proc/partitions
cat /proc/mounts
also from the pc (are you using linux or windows?):
create a PC folder and cd into it, then:
adb pull -p /dev/block/mmcblk0boot0
adb pull -p /dev/block/mmcblk0boot1
tell me the exact size of the two downloaded files. KEEP THESE FILES SAFE!
Lanchon said:
you should try all options!
but i think it is probably omap/omap_hsmmc.0
are you sure you are "fastboot boot" booting into the latest TWRP recovery before doing adb shell??? your fdisk command doesn't support GPT disks, that is very strange.
also do:
cat /proc/partitions
cat /proc/mounts
also from the pc (are you using linux or windows?):
create a PC folder and cd into it, then:
adb pull -p /dev/block/mmcblk0boot0
adb pull -p /dev/block/mmcblk0boot1
tell me the exact size of the two downloaded files. KEEP THESE FILES SAFE!
Click to expand...
Click to collapse
I can 100% confirm Im on the newest TWRP recovery version v2.8.4.0 flashed with fastboot boot x.img
And here are the results i got, and also those new commands:
Code:
~ # ←[6nls -l /dev/block/platform/omap/omap_hsmmc.0/by-name
ls -l /dev/block/platform/omap/omap_hsmmc.0/by-name
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
lrwxrwxrwx root root 2015-02-05 18:06 boot -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 2015-02-05 18:06 cache -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 2015-02-05 18:06 dgs -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 2015-02-05 18:06 efs -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 2015-02-05 18:06 metadata -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 2015-02-05 18:06 misc -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 2015-02-05 18:06 param -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 2015-02-05 18:06 radio -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 2015-02-05 18:06 recovery -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 2015-02-05 18:06 sbl -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 2015-02-05 18:06 system -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 2015-02-05 18:06 userdata -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 2015-02-05 18:06 xloader -> /dev/block/mmcblk0p1
~ # ←[6n
Code:
~ # ←[6ncat /proc/partitions
cat /proc/partitions
major minor #blocks name
31 0 1024 mtdblock0
179 0 15388672 mmcblk0
179 1 128 mmcblk0p1
179 2 3584 mmcblk0p2
179 3 20480 mmcblk0p3
179 4 8192 mmcblk0p4
179 5 4096 mmcblk0p5
179 6 4096 mmcblk0p6
179 7 8192 mmcblk0p7
259 0 12224 mmcblk0p8
259 1 16384 mmcblk0p9
259 2 669696 mmcblk0p10
259 3 442368 mmcblk0p11
259 4 14198767 mmcblk0p12
259 5 64 mmcblk0p13
179 16 2048 mmcblk0boot1
179 8 2048 mmcblk0boot0
~ # ←[6n
Code:
~ # ←[6ncat /proc/mounts
cat /proc/mounts
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,seclabel,relatime 0 0
/dev/block/mmcblk0p11 /cache ext4 rw,seclabel,relatime,user_xattr,barrier=1,data
=ordered 0 0
/dev/block/mmcblk0p12 /data ext4 rw,seclabel,relatime,user_xattr,barrier=1,data=
ordered 0 0
/dev/block/mmcblk0p12 /sdcard ext4 rw,seclabel,relatime,user_xattr,barrier=1,dat
a=ordered 0 0
~ # ←[6n
AND THIS IS WHAT I GET WHEN I TRIED TO PULL THE FILES U ASKED: (both mmcblk0boot0/1)
Code:
E:\WugFresh Development\Nexus Root Toolkit\data\MMC>adb pull -p /dev/block/mmcbl
k0boot0
remote object '/dev/block/mmcblk0boot0' not a file or directory
lol please repeat:
ls -l /dev/block/platform/omap/omap_hsmmc.0/by-name
using a wider terminal so that the output can be read
your partitions are:
Code:
major minor #blocks name
31 0 1024 mtdblock0
179 0 15388672 mmcblk0
179 1 128 mmcblk0p1 xloader
179 2 3584 mmcblk0p2 sbl
179 3 20480 mmcblk0p3 efs
179 4 8192 mmcblk0p4 param
179 5 4096 mmcblk0p5 misc
179 6 4096 mmcblk0p6 dgs
179 7 8192 mmcblk0p7 boot
259 0 12224 mmcblk0p8 recovery
259 1 16384 mmcblk0p9 radio
259 2 669696 mmcblk0p10 system
259 3 442368 mmcblk0p11 cache
259 4 14198767 mmcblk0p12 userdata
259 5 64 mmcblk0p13 metadata
179 16 2048 mmcblk0boot1
179 8 2048 mmcblk0boot0
---------- Post added at 03:34 PM ---------- Previous post was at 03:28 PM ----------
cat /proc/mtd
cat /proc/emmc
dd if=/dev/block/mmcblk0boot0 of=/tmp/mmcblk0boot0
dd if=/dev/block/mmcblk0boot1 of=/tmp/mmcblk0boot1
from the PC:
adb pull /tmp/mmcblk0boot0
adb pull /tmp/mmcblk0boot1
---------- Post added at 03:36 PM ---------- Previous post was at 03:34 PM ----------
get the latest philz touch recovery for gnex. fastboot boot into it, then try this again:
fdisk -l /dev/block/mmcblk0
Lanchon said:
lol please repeat:
ls -l /dev/block/platform/omap/omap_hsmmc.0/by-name
using a wider terminal so that the output can be read
your partitions are:
Code:
major minor #blocks name
31 0 1024 mtdblock0
179 0 15388672 mmcblk0
179 1 128 mmcblk0p1 xloader
179 2 3584 mmcblk0p2 sbl
179 3 20480 mmcblk0p3 efs
179 4 8192 mmcblk0p4 param
179 5 4096 mmcblk0p5 misc
179 6 4096 mmcblk0p6 dgs
179 7 8192 mmcblk0p7 boot
259 0 12224 mmcblk0p8 recovery
259 1 16384 mmcblk0p9 radio
259 2 669696 mmcblk0p10 system
259 3 442368 mmcblk0p11 cache
259 4 14198767 mmcblk0p12 userdata
259 5 64 mmcblk0p13 metadata
179 16 2048 mmcblk0boot1
179 8 2048 mmcblk0boot0
---------- Post added at 03:34 PM ---------- Previous post was at 03:28 PM ----------
cat /proc/mtd
cat /proc/emmc
dd if=/dev/block/mmcblk0boot0 of=/tmp/mmcblk0boot0
dd if=/dev/block/mmcblk0boot1 of=/tmp/mmcblk0boot1
from the PC:
adb pull /tmp/mmcblk0boot0
adb pull /tmp/mmcblk0boot1
---------- Post added at 03:36 PM ---------- Previous post was at 03:34 PM ----------
get the latest philz touch recovery for gnex. fastboot boot into it, then try this again:
fdisk -l /dev/block/mmcblk0
Click to expand...
Click to collapse
Code:
~ # ←[6ncat /proc/mtd
cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00001000 "w25q80"
~ # ←[6n
hmm :?
Code:
~ # ←[6ncat /proc/emmc
cat /proc/emmc
cat: can't open '/proc/emmc': No such file or directory
~ # ←[6n
I downloaded and fastboot booted latest phillz and i did the command again, but the resault is the same:
Code:
~ # fdisk -l /dev/block/mmcblk0
fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 15.7 GB, 15758000128 bytes
1 heads, 16 sectors/track, 1923584 cylinders
Units = cylinders of 16 * 512 = 8192 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 1923584 15388671+ ee EFI GPT
Partition 1 does not end on cylinder boundary
~ #
So i pulled both mmcblk files, they are 2,048 KB each.
this is going to be redundant, buy do it just in case:
adb pull -p /dev/block/mmcblk0p##
where ## is 1 to 9 and 13 (skip 10, 11, 12)
Lanchon said:
this is going to be redundant, buy do it just in case:
adb pull -p /dev/block/mmcblk0p##
where ## is 1 to 9 and 13 (skip 10, 11, 12)
Click to expand...
Click to collapse
Done. had to do the trick with dd if=/dev/block/mmcblk0p of=/tmp/mmcblk0p first then adb pull /tmp/mmcblk0p, but i got the files now, their size range are from 64 KB to 20,480 KB (largest one)
Whats next:?
EDIT: first reboot into clean latest TWRP
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-beg bs=1M count=96
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
from the PC:
adb pull -p /tmp/mmcblk0-beg
adb pull -p /tmp/mmcblk0-end
beg should be 96MB
end should be 28MB
verify, that on the PC.
DO NOT REBOOT THE PHONE FROM THIS POINT FORWARD!
we want those files in the ramdrive
Lanchon said:
EDIT: first reboot into clean latest TWRP
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-beg bs=1M count=96
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
from the PC:
adb pull -p /tmp/mmcblk0-beg
adb pull -p /tmp/mmcblk0-end
beg should be 96MB
end should be 28MB
verify, that on the PC.
DO NOT REBOOT THE PHONE FROM THIS POINT FORWARD!
we want those files in the ramdrive
Click to expand...
Click to collapse
downloaded beg and i confirm its 98 MB but i have a problem with END, it doesnt want to copy it im tmp, i deleted the "skip=15000 part" and it came out 250 MB!! but couldnt pull it cuz it game me "no space left on device"
What should i do? Reboot and do this again or ?
valkata1212 said:
downloaded beg and i confirm its 98 MB but i have a problem with END, it doesnt want to copy it im tmp, i deleted the "skip=15000 part" and it came out 250 MB!! but couldnt pull it cuz it game me "no space left on device"
What should i do? Reboot and do this again or ?
Click to expand...
Click to collapse
reboot
redo first dd
no need to pull again
redo second dd, and tell me the error message or whatever it outputs. form now on, i recommend you dont try to fix things without posting first, one error can mean BRICK.
Lanchon said:
reboot
redo first dd
no need to pull again
redo second dd, and tell me the error message or whatever it outputs. form now on, i recommend you dont try to fix things without posting first, one error can mean BRICK.
Click to expand...
Click to collapse
Code:
E:\WugFresh Development\Nexus Root Toolkit\data\MMC>adb shell
~ # ←[6ndd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
It doesnt start the operation dont know why, just like the first time i did. Beg finished for 2-3 sec but -end just doesnt show up.
valkata1212 said:
Code:
E:\WugFresh Development\Nexus Root Toolkit\data\MMC>adb shell
~ # ←[6ndd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
dd if=/dev/block/mmcblk0 of=/tmp/mmcblk0-end bs=1M skip=15000
It doesnt start the operation dont know why, just like the first time i did. Beg finished for 2-3 sec but -end just doesnt show up.
Click to expand...
Click to collapse
you are saying:
-no error displayed
-no file created
?
does the phone stop responding?

[Q] Galaxy Nexus stopped working, trying to recover important data...

Hi Guys
I'm new to the Forum and start with asking a question - apologize for that, I know that it's impolite.
I'm pretty desperate at the moment. Tried to switch on my Galaxy Nexus some days ago and it did not start. If I try to switch it on (long button press), the google logo appears for about 72 seconds, then "something" happens on the screen (usually the logo becomes brighter and horizontal lines appear on the screen). And that's it.
There's no clear reason why the mobile is broken now.
The big problem is that I have lots of pictures of my little boy on that device, from his birth until now (it's his first birthday tomorrow). These pics are very very important to me, the only pictures I have from his birth. I did not backup those pictures - I'm stupid. So my goal is to rescue those images from the device somehow. Currently I'm spending every free second to read and learn how to recover those images...
Device info:
Galaxy Nexus, Tuna Maguro 16GB
HW Version: 9
Bootloader Version: PRIMEMD04
Baseband Version: I9250XXLJ1
Everything is stock version, Android 4.4.2 (I think), stock bootloader
What I've tried so far:
- Installed fastload / ADB on Ubuntu 14.04 from repo. Manually installed ADB 1.0.32 as well.
- I can boot the device into Fastboot / Rescue / Odin mode, that works.
- Tried to clear the cache. It hangs after "Formatting /cache". No "completed" message. If I go to the recovery menu now, I get a couple of messages which say
"E:failed to mount /cache (Invalid argument)"
and then lots of "Can't mount /cache/recovery/log" messages.
If I boot in Rescue Mode, select "apply update from ADB" and connect the mobile to the PC:
Code:
[ 502.524071] usb 1-5: new high-speed USB device number 3 using ehci-pci
[ 502.657321] usb 1-5: New USB device found, idVendor=18d1, idProduct=d001
[ 502.657330] usb 1-5: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[ 502.657348] usb 1-5: Product: Galaxy Nexus
[ 502.657352] usb 1-5: Manufacturer: samsung
[ 502.657355] usb 1-5: SerialNumber: (redacted)
So it gets detected, at least.
Then:
Code:
$ ./adb get-state
sideload
$ ./adb devices -l
List of devices attached
(serial redacted) sideload usb:1-5
$ ./adb backup -all
adb: unable to connect for backup
$ ./adb bugreport
error: closed
$ ./adb shell pwd
error: closed
$ ./adb logcat
- waiting for device -
^C
I've downloaded the stock yakju ROM from the google dev website (can't post links, sorry).
There are a bunch of files in that archive:
Code:
$ ll
total 298996
drwxr-x--- 2 m m 4096 Aug 21 2013 ./
drwxr-xr-x 7 m m 4096 Aug 30 23:50 ../
-rw-r----- 1 m m 2363392 Aug 21 2013 bootloader-maguro-primemd04.img
-rw-r----- 1 m m 956 Aug 21 2013 flash-all.bat
-rwxr-x--x 1 m m 827 Aug 21 2013 flash-all.sh*
-rwxr-x--x 1 m m 785 Aug 21 2013 flash-base.sh*
-rw-r----- 1 m m 291192953 Aug 21 2013 image-yakju-jwr66y.zip
-rw-r----- 1 m m 12583168 Aug 21 2013 radio-maguro-i9250xxlj1.img
Code:
$ zipinfo image-yakju-jwr66y.zip
Archive: image-yakju-jwr66y.zip
Zip file size: 291192953 bytes, number of entries: 5
?rw-r--r-- 2.0 unx 4481024 b- defN 09-Jan-01 00:00 boot.img
?rw-r--r-- 2.0 unx 5042176 b- defN 09-Jan-01 00:00 recovery.img
?rw-r--r-- 2.0 unx 485561008 b- defN 09-Jan-01 00:00 system.img
-rw------- 2.0 unx 140860420 b- defN 13-Aug-13 22:56 userdata.img
-rw-r----- 2.0 unx 93 b- defN 13-Aug-13 16:00 android-info.txt
So my questions are:
Am I doing the right thing here? I Hope that this is a software problem and the hardware is ok.
If yes, which of those file(s) should I flash to the device, without risking the loss of data?
Can you think of any other possibility to recover the data? Clockwork mod or TWRP maybe? Or a custom sideload script (inside the uploaded zip file).
I've read that flashing a custom bootloader wipes the device - so maybe CW / TWRP is not a good idea...
Thank you very very much for your help.
Matt
It may have been a while, bit it might help anyways
Boot your phone to the Bootloader mode. Connect it to your PC via USB.
Use Terminal to cd into your adb/fastboot folder.
Grab the latest TWRP from here: https://dl.twrp.me/maguro/
Copy it into the same directory as fastboot and rename it to recovery.img
Then try to boot into recovery (assuming you haven't rooted your phone and you have a locked bootloader) with "./fastboot boot recovery recovery.img"
I am not sure if this will work with a locked bootloader, but it's worth a try.
If it boots to TWRP then "./adb pull /sdcard/ /backup/" this should create a folder with all the contents of the internal memory in the fastboot direcory. Just let it copy, its done when you are at a prompt again.

LG G4 fails to complete LOS 14.1 boot after battery drained to zero [Fixed]

The battery of a rooted, UsUed LG G4 running LineageOS 14.1 was accidentally allowed to drain to zero. After re-charging above 50%, the device failed to boot. The LOS boot screen "bubble on a string" animation would continue indefinitely.
The phone still booted to TWRP, download mode, and fastboot mode.
Originally, it was suspected that this was ILAPO. However, this suspicion was incorrect.
After extensive work creating a boot sector that would allow logging and a ton of help from @steadfasterX, it was discovered that various files in /data/system had been corrupted and had sizes of zero. Android would try to read values from these files, fail, and repeat.
First, a full TWRP backup of the phone was made and copied off-device. Then, I made a second backup of /data/system. Next, I deleted the following zero-byte files from /data/system using TWRP (or ADB after launching TWRP).
packages.list
packages.xml
profiles.xml
netpolicy.xml
notification_policy.xml
If this doesn't work, I would have considered deleting other zero-byte files in /data/system. I used "ls -laS" to get a size-ordered list of files in my current directory.
After a reboot, android re-created the files and booted to the lockscreen.
All of the apps in /data/data had already been cleared. Otherwise, Android would probably have choked on the differences between the user IDs that it wanted to assign to apps and the ownership of the various app folders.
The following links suggest ways to restore some apps from previously created backups
GitHub - joshuabragge/twrp-manual-restore: Automate individual app restores from an android TWRP backup
Automate individual app restores from an android TWRP backup - GitHub - joshuabragge/twrp-manual-restore: Automate individual app restores from an android TWRP backup
github.com
https://www.semipol.de/posts/2016/07/android-manually-restoring-apps-from-a-twrp-backup/
(Permanent archive: https://web.archive.org/web/2019083.../android-restoring-apps-from-twrp-backup.html)
There is no warranty on this solution. It was a makeshift effort created by an amateur. If you choose to duplicate it, you do so at your own risk. You may permanently destroy your phone.
Old post below:
I'm trying to understand whether a particular G4 (H815) has ILAPO. Its been sneezing, has a sore throat, and now can't taste anything^H^H oops, I mean:
- Previously, the phone would get hot during use.
- The phone has been UsUed.
- The battery was accidentally allowed to discharge to zero.
- After the battery was recharged, the phone was unable to boot past the Lineageos "bubble on a string" animation. The animation simply continues forever.
- The phone can boot to TWRP, fasboot, download mode, etc.
Attempts to fix:
- Tried renaming /sdcard/Android to /sdcard/Android.old but this had no effect.
- Tried clearing cache and dalvik cache but this had no effect
- (NEW) Tried attaching to computer and launching "adb logcat" during animation. Device is never found. If I remember correctly, "USB debugging" was off when the device died. (ADB does work in TWRP.)
- (NEW) Tried creating a custom 4-core (2 core for boot) boot image using the instructions here https://forum.xda-developers.com/t/...tom-x-cores-boot-image-ilapo-tempfix.3718389/ and used "fastboot flash boot boot.img" to flash it. This doesn't seem to work.
-- If I reboot into TWRP after a long period of waiting for the lineageos splash screen, I get a CPU temperature of 46 C. I don't know what temperature was generated in the same situation the modified boot image was installed.
Most of the info on ILAPO suggests that phones with it can't get past the LG logo. That is not the case here. Is this ILAPO or something different? Does anyone have ideas as to what might be an appropriate fix?
Is it possible to retrieve boot logs using TWRP in order to figure out when/where/why the boot hangs?
electricfield said:
I'm trying to understand whether a particular G4 (H815) has ILAPO. Its been sneezing, has a sore throat, and now can't taste anything^H^H oops, I mean:
- Previously, the phone would get hot during use.
- The phone has been UsUed.
- The battery was accidentally allowed to discharge to zero.
- After the battery was recharged, the phone was unable to boot past the Lineageos "bubble on a string" animation. The animation simply continues forever.
- The phone can boot to TWRP, fasboot, download mode, etc.
Attempts to fix:
- Tried renaming /sdcard/Android to /sdcard/Android.old but this had no effect.
- Tried clearing cache and dalvik cache but this had no effect
- (NEW) Tried attaching to computer and launching "adb logcat" during animation. Device is never found. If I remember correctly, "USB debugging" was off when the device died. (ADB does work in TWRP.)
- (NEW) Tried creating a custom 4-core (2 core for boot) boot image using the instructions here https://forum.xda-developers.com/t/...tom-x-cores-boot-image-ilapo-tempfix.3718389/ and used "fastboot flash boot boot.img" to flash it. This doesn't seem to work.
-- If I reboot into TWRP after a long period of waiting for the lineageos splash screen, I get a CPU temperature of 46 C. I don't know what temperature was generated in the same situation the modified boot image was installed.
Most of the info on ILAPO suggests that phones with it can't get past the LG logo. That is not the case here. Is this ILAPO or something different? Does anyone have ideas as to what might be an appropriate fix?
Is it possible to retrieve boot logs using TWRP in order to figure out when/where/why the boot hangs?
Click to expand...
Click to collapse
Sounds like the ilapo. Is the battery charged now? I don't know which LOS version you have installed but if you use mine:
follow FAQ #7 of my LOS thread
steadfasterX said:
Sounds like the ilapo. Is the battery charged now? I don't know which LOS version you have installed but if you use mine:
follow FAQ #7 of my LOS thread
Click to expand...
Click to collapse
Thank you for your reply. You seem to know more about G4 issues than anyone. I really appreciate your help.
The battery is charged now.
Unfortunately, I am using the microg version of LOS 14.1, rather than your 16.0.
I tried following the instructions in your FAQ #7, but I can't do step 1 (boot android). The only way for me to exit the bootloop is by removing the battery. There is no "debug" in /cache after I mount cache in TWRP.
I also looked at FAQ #1. ADB never finishes waiting for the device. In fact "lsusb" doesn't show the phone during OS boot (ADB is fine when TWRP is loaded).
Any other ideas?
electricfield said:
Thank you for your reply. You seem to know more about G4 issues than anyone. I really appreciate your help.
The battery is charged now.
Unfortunately, I am using the microg version of LOS 14.1, rather than your 16.0.
I tried following the instructions in your FAQ #7, but I can't do step 1 (boot android). The only way for me to exit the bootloop is by removing the battery. There is no "debug" in /cache after I mount cache in TWRP.
I also looked at FAQ #1. ADB never finishes waiting for the device. In fact "lsusb" doesn't show the phone during OS boot (ADB is fine when TWRP is loaded).
Any other ideas?
Click to expand...
Click to collapse
As written in my mentioned FAQ taken battery out is needed in your case. Step 2 iirc.
If you dont use my LOS then no way. The cache/debug is something I've added and no one else has.
Option1:
You can just flash my LOS 16 or /e/ ROM (take a full backup before in TWRP) and use that for debugging your current issue. Why using microg btw? /e/ is great
Option2:
The other option would be pulling the boot img of your current LOS (in TWRP: adb pull /dev/block/bootdevice/by-name/boot ) and rebuilding it as insecure (i.e. usb debug on and adb root ) but if you never did that before it it will be hard i guess. AiK might work here or using mAid which includes bootimgtool.
Option3:
Also you can attach that boot img here and if i ever find the time i can do option2 for you but don't expext that this happens soon .
Thank you again for your help.
I'm a little afraid that installing a new & different ROM will increase the level of complexity. I'll do it if I must, though.
I started looking at option #2. Retrieving the boot image was fine, but unpacking presents a problem.
$ ./unpack-bootimg.sh boot.img.original
Found a secondary file after the ramdisk image. According to the spec (mkbootimg.h) this file can exist, but this script is not designed to deal with this scenario.
Is there a guide anywhere?
electricfield said:
Thank you again for your help.
I'm a little afraid that installing a new & different ROM will increase the level of complexity. I'll do it if I must, though.
I started looking at option #2. Retrieving the boot image was fine, but unpacking presents a problem.
$ ./unpack-bootimg.sh boot.img.original
Found a secondary file after the ramdisk image. According to the spec (mkbootimg.h) this file can exist, but this script is not designed to deal with this scenario.
Is there a guide anywhere?
Click to expand...
Click to collapse
thousands.. But the problem is that our device is sensitive when it comes to packaging the boot.img again. Bootimgtool is working in 9 of 10 times though.
Boot mAid . Open a terminal. Type bootimgtool --help .important is to use "-v qcom". Then extract the ramdisk with gzip and cpio, then modding the default.prop to make it insecure , then using gzip and cpio again to rebuild the ramdisk, finally using bootimgtool to construct the boot.img again. Sounds harder than it is but i have no access to my pc until monday so i cannot give all the needed cmds atm. There are plenty of guides out there and tools ofc which allow unpack,repack etc. That's why i mentioned AIK which does exactly the above but it fails sometimes to build a correct working boot.img.
So my suggestion is try your luck with one of the tools or wait until I've access to my pc. Consider joining my TG group then for easier support (see my sig)
steadfasterX said:
thousands.. But the problem is that our device is sensitive when it comes to packaging the boot.img again. Bootimgtool is working in 9 of 10 times though.
Boot mAid . Open a terminal. Type bootimgtool --help .important is to use "-v qcom". Then extract the ramdisk with gzip and cpio, then modding the default.prop to make it insecure , then using gzip and cpio again to rebuild the ramdisk, finally using bootimgtool to construct the boot.img again. Sounds harder than it is but i have no access to my pc until monday so i cannot give all the needed cmds atm. There are plenty of guides out there and tools ofc which allow unpack,repack etc. That's why i mentioned AIK which does exactly the above but it fails sometimes to build a correct working boot.img.
So my suggestion is try your luck with one of the tools or wait until I've access to my pc. Consider joining my TG group then for easier support (see my sig)
Click to expand...
Click to collapse
Thank you once again. I'm really impressed by how much help you have been able to give so far.
Unfortunately, I have no phone with which to join the Telegram group.
I made the modified boot image, but adb is still unable to speak to the phone during boot. I note that lsusb does not show the phone during boot -- maybe the system hangs before USB is activated. However, I could have made the boot image incorrectly.
Here is what I did:
[[email protected] extract]$ bootimgtool -i boot
Image size: 41943040
Page size: 4096
Kernel size: 22456976
Ramdisk size: 1672742
Second stage size: 0
Device tree size: 0
Kernel load address: 0x00008000
Ramdisk load address: 0x01000000
Second stage load address: 0x00f00000
Device tree load address: 0x00000000
Tags load address: 0x00000100
Product name:
Command line: maxcpus=4 boot_cpus=0-1 console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-1 buildvariant=userdebug
[[email protected] extract]$ bootimgtool -x boot -v qcom
[[email protected] extract]$ gunzip ramdisk
[[email protected] ex]$ cpio -i < ../ramdisk
In default.prop, I changed:
ro.adb.secure=0
ro.secure=0
security.perf_harden=0
ro.debuggable=0
persist.sys.usb.config=mtp,adb
In default.prop, I added:
persist.service.adb.enable=1
persist.service.debuggable=1
[[email protected] ex]$ find > /tmp/filelist
[[email protected] ex]$ cpio -o < /tmp/filelist > ../ramdisk.modified
This produces
-rw-r--r-- 1 android users 4166400 Jan 2 17:29 ramdisk.gunzip.original
-rw-r--r-- 1 android users 4162048 Jan 2 17:31 ramdisk.modified
-rw-r--r-- 1 android users 1672742 Jan 2 17:16 ramdisk.img.original
I don't understand why the "modified" gunzipped file is slightly smaller than the original.
[[email protected] extract]$ mv ramdisk.modified.gz ramdisk.img
[[email protected] extract]$ cp boot boot.original
[[email protected] extract]$ bootimgtool -v qcom -c boot
Overwrite 'boot'? [y/N] y
-rw-r--r-- 1 android users 25370624 Jan 2 17:38 boot
-rw-r--r-- 1 android users 41943040 Jan 2 17:37 boot.original
I am wary because I don't understand why the new file is so much smaller than the original. However, I decided to proceed. Uploaded modified boot to /sdcard/boot.modified
Inside adb:
/dev/block/platform/soc.0/f9824900.sdhci/by-name # ls -al boot
lrwxrwxrwx 1 root root 21 Jan 1 04:16 boot -> /dev/block/mmcblk0p38
/dev/block/platform/soc.0/f9824900.sdhci/by-name # cp /sdcard/boot.modified /dev/block/mmcblk0p38
Plugged in device. On computer "adb wait-for-device". Reboot device.
Unfortunately, no action from adb.
electricfield said:
Thank you once again. I'm really impressed by how much help you have been able to give so far.
Unfortunately, I have no phone with which to join the Telegram group.
I made the modified boot image, but adb is still unable to speak to the phone during boot. I note that lsusb does not show the phone during boot -- maybe the system hangs before USB is activated. However, I could have made the boot image incorrectly.
Here is what I did:
[[email protected] extract]$ bootimgtool -i boot
Image size: 41943040
Page size: 4096
Kernel size: 22456976
Ramdisk size: 1672742
Second stage size: 0
Device tree size: 0
Kernel load address: 0x00008000
Ramdisk load address: 0x01000000
Second stage load address: 0x00f00000
Device tree load address: 0x00000000
Tags load address: 0x00000100
Product name:
Command line: maxcpus=4 boot_cpus=0-1 console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-1 buildvariant=userdebug
[[email protected] extract]$ bootimgtool -x boot -v qcom
[[email protected] extract]$ gunzip ramdisk
[[email protected] ex]$ cpio -i < ../ramdisk
In default.prop, I changed:
ro.adb.secure=0
ro.secure=0
security.perf_harden=0
ro.debuggable=0
persist.sys.usb.config=mtp,adb
In default.prop, I added:
persist.service.adb.enable=1
persist.service.debuggable=1
[[email protected] ex]$ find > /tmp/filelist
[[email protected] ex]$ cpio -o < /tmp/filelist > ../ramdisk.modified
This produces
-rw-r--r-- 1 android users 4166400 Jan 2 17:29 ramdisk.gunzip.original
-rw-r--r-- 1 android users 4162048 Jan 2 17:31 ramdisk.modified
-rw-r--r-- 1 android users 1672742 Jan 2 17:16 ramdisk.img.original
I don't understand why the "modified" gunzipped file is slightly smaller than the original.
[[email protected] extract]$ mv ramdisk.modified.gz ramdisk.img
[[email protected] extract]$ cp boot boot.original
[[email protected] extract]$ bootimgtool -v qcom -c boot
Overwrite 'boot'? [y/N] y
-rw-r--r-- 1 android users 25370624 Jan 2 17:38 boot
-rw-r--r-- 1 android users 41943040 Jan 2 17:37 boot.original
I am wary because I don't understand why the new file is so much smaller than the original. However, I decided to proceed. Uploaded modified boot to /sdcard/boot.modified
Inside adb:
/dev/block/platform/soc.0/f9824900.sdhci/by-name # ls -al boot
lrwxrwxrwx 1 root root 21 Jan 1 04:16 boot -> /dev/block/mmcblk0p38
/dev/block/platform/soc.0/f9824900.sdhci/by-name # cp /sdcard/boot.modified /dev/block/mmcblk0p38
Plugged in device. On computer "adb wait-for-device". Reboot device.
Unfortunately, no action from adb.
Click to expand...
Click to collapse
Ok i haven't followed every step bc I'm in half sleep mode already but you did one step wrong : you cant use cp like you did to copy the boot img. Either use the IMG button within TWRP flash menu or use fastboot flash boot boot.img to actually flash the modded boot img
Thank you, once again.
I think that something must be wrong with the boot image.
After "fastboot flash boot boot.modified", I get a blue light. The screen is blank with a cursor in the upper-left hand corner.
"fastboot flash boot boot.original" restores it to its previous state. i.e., it gets to the first lineageos splash screen bubble.
I'm suspicious of the difference between the file sizes of the original and modified boot images.
electricfield said:
Thank you, once again.
I think that something must be wrong with the boot image.
After "fastboot flash boot boot.modified", I get a blue light. The screen is blank with a cursor in the upper-left hand corner.
"fastboot flash boot boot.original" restores it to its previous state. i.e., it gets to the first lineageos splash screen bubble.
I'm suspicious of the difference between the file sizes of the original and modified boot images.
Click to expand...
Click to collapse
Ignore the size diff. That's bc of diff compressing tools but does not matter. Your cpio cmd is unusual . Cpio has switches to create directories and that is not used in yours above . Thats likely the reason why it does not boot at all. Again sorry that i can't help better atm but without my pc..
Thanks.
I changed the ramdisk extraction command to:
gzip -dc ../ramdisk.img | cpio -imd
and the creation command to:
find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz
Bootimgtool then produced a boot image that booted. After fastboot flash, the device is in the same state as before (splash screen).
Unfortunately, "adb wait-for-device" produces nothing. "lsusb" does not show the phone.
Can you confirm the lines to change in default.prop?
In default.prop, I changed:
ro.adb.secure=0
ro.secure=0
security.perf_harden=0
ro.debuggable=0
persist.sys.usb.config=mtp,adb
I added:
persist.service.adb.enable=1
persist.service.debuggable=1
electricfield said:
Thanks.
I changed the ramdisk extraction command to:
gzip -dc ../ramdisk.img | cpio -imd
and the creation command to:
find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz
Bootimgtool then produced a boot image that booted. After fastboot flash, the device is in the same state as before (splash screen).
Unfortunately, "adb wait-for-device" produces nothing. "lsusb" does not show the phone.
Can you confirm the lines to change in default.prop?
In default.prop, I changed:
ro.adb.secure=0
ro.secure=0
security.perf_harden=0
ro.debuggable=0
persist.sys.usb.config=mtp,adb
I added:
persist.service.adb.enable=1
persist.service.debuggable=1
Click to expand...
Click to collapse
ro.debuggable=1 is better (allows adb root)
security.perf_harden shouldn't be added (or.changed if it was there)
Rest looks ok. At least as long as you really changed these values directly or added them at the top (ro. values can be set only once)
Otherwise you should wait until tomorrow then i can share a 100% working way
electricfield said:
Thanks.
I changed the ramdisk extraction command to:
gzip -dc ../ramdisk.img | cpio -imd
and the creation command to:
find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz
Bootimgtool then produced a boot image that booted. After fastboot flash, the device is in the same state as before (splash screen).
Unfortunately, "adb wait-for-device" produces nothing. "lsusb" does not show the phone.
Can you confirm the lines to change in default.prop?
In default.prop, I changed:
ro.adb.secure=0
ro.secure=0
security.perf_harden=0
ro.debuggable=0
persist.sys.usb.config=mtp,adb
I added:
persist.service.adb.enable=1
persist.service.debuggable=1
Click to expand...
Click to collapse
Oh wait! Pls share the bootimgtool command you are using to create the new boot.img
Thank you, again.
The bootimgtool command is the same one as I used before (no change). Before running it, I renamed the new ramdisk to ramdisk.img.
bootimgtool -v qcom -c boot.modified3
Followed by bringing the phone into fastboot mode and running
fastboot flash boot boot.modified3
The phone boots to the lineageos splash screen but no response to "adb wait-for-device".
I'll try ro.debuggable=1 and get rid of security.perf_harden in a few minutes, but I wonder if they are unlikely to change anything given that the device does not show up in (linux) lsusb.
electricfield said:
Thank you, again.
The bootimgtool command is the same one as I used before (no change). Before running it, I renamed the new ramdisk to ramdisk.img.
bootimgtool -v qcom -c boot.modified3
Followed by bringing the phone into fastboot mode and running
fastboot flash boot boot.modified3
The phone boots to the lineageos splash screen but no response to "adb wait-for-device".
I'll try ro.debuggable=1 and get rid of security.perf_harden in a few minutes, but I wonder if they are unlikely to change anything given that the device does not show up in (linux) lsusb.
Click to expand...
Click to collapse
That wont change anything if adb does not come up. Just for completeness.
Ok so if you renamed it to ramdisk.img then all.good that was the thing i had in mind (that you didn't and not.used the -r switch). Well ok then without my pc the only thing i can think of might be the USB cable but thats very unlikely
Thanks again for your help.
The boot image that was flashed is definitely the correct one. I extracted it to another folder and checked it before flashing.
I re-made the boot image, but the result is the same (no adb, no device in lsusb).
What "-r switch" are you referring to in your previous message?
The USB cable works fine for ADB in TWRP, so I doubt it is the problem.
electricfield said:
Thanks again for your help.
The boot image that was flashed is definitely the correct one. I extracted it to another folder and checked it before flashing.
I re-made the boot image, but the result is the same (no adb, no device in lsusb).
What "-r switch" are you referring to in your previous message?
The USB cable works fine for ADB in TWRP, so I doubt it is the problem.
Click to expand...
Click to collapse
The -r (iirc) switch was related to bootimgtool. That way you can choose your newly created ramdisk.img but when you renamed it to ramdisk.img it works without.
Thanks.
I would deeply appreciate if you were able to guide me in making the boot image correctly when you have your computer on Monday.
On the other hand, if this method won't work, its best if I know that so that I can try the next thing....
electricfield said:
Thanks.
I would deeply appreciate if you were able to guide me in making the boot image correctly when you have your computer on Monday.
On the other hand, if this method won't work, its best if I know that so that I can try the next thing....
Click to expand...
Click to collapse
ok here you go, this must be added /changed in default.prop:
Code:
ro.adb.secure=0
ro.secure=0
ro.debuggable=1
persist.service.adb.enable=1
persist.service.debuggable=1
persist.sys.usb.config=adb
thumbs pressed
Thank you.
I rebuilt the boot image with these entries, but "adb wait-for-device" still does not work during boot.
Any other ideas?

Categories

Resources