[Q] NOT your average stuck in bootloop - Nexus 5 Q&A, Help & Troubleshooting

Bear with me: Right now my nexus is stuck in a bootloop. My nexus had been partially rooted, everytime i went to download the OTA 5.0.1. update it would just take me to TWRP, and i didn't know what to do with that. So I finally tried to fully root the phone, and also use TWRP to install the OTA update. Now I'm stuck, I've tried wiping the cache/factory reset. How do I got about flashing it back to stock without losing all my data?
(apologies for the title, I thought originally that I had killed mtp and adb, but I figured out how to get them back just after posting)
Thanks!

As I saw your post before the edit.... Stop using toolkits and read about adb. If it's bootlooping then it's 95% not bricked so don't panic and read the guides
Just download system.img you want and fastboot it
Edit -
Don't see this as me being mean or a ****. This is stuff everyone needs to know, it's really not hard at all so don't worry. Once you've used it a few times you'll wonder why you ever used toolkits

Ben36 said:
As I saw your post before the edit.... Stop using toolkits and read about adb. If it's bootlooping then it's 95% not bricked so don't panic and read the guides
Just download system.img you want and fastboot it
Edit -
Don't see this as me being mean or a ****. This is stuff everyone needs to know, it's really not hard at all so don't worry. Once you've used it a few times you'll wonder why you ever used toolkits
Click to expand...
Click to collapse
I don't think you're being a ****. I'm very grateful for your input. I used to be very into jailbreaking when I had an iPhone, but i haven't been able to put the same time towards getting the hang of rooting (which I think has a steeper learning curve to begin with|). I sort of understand adb but I obviously need to learn more. I've been using the toolkit because it was simpler. I remember from trying to use adb before that I need to place the files I want to transfer in the same folder as adb (i think?) but I could never get that to work.
I also don't understand system.img.'s relevance here. I'm not getting the "Error: Update package missing system.img" error.

The reason I say read the guides is simply it saves me or anyone else typing out a massive guide that already exists in many places.
If you're looping then something is more than likely wrong with the system not the data. So flashing just the system will keep your data safe (as long as you flash the same android version as you previously had, lollipop or kitkat)
You need to be in the bootloader not recovery and use the command fastboot flash system system.img
Google img's are here - https://developers.google.com/android/nexus/images
(just keep unzipping until you find the individual img files)

photobumm said:
I don't think you're being a ****. I'm very grateful for your input. I used to be very into jailbreaking when I had an iPhone, but i haven't been able to put the same time towards getting the hang of rooting (which I think has a steeper learning curve to begin with|). I sort of understand adb but I obviously need to learn more. I've been using the toolkit because it was simpler. I remember from trying to use adb before that I need to place the files I want to transfer in the same folder as adb (i think?) but I could never get that to work.
I also don't understand system.img.'s relevance here. I'm not getting the "Error: Update package missing system.img" error.
Click to expand...
Click to collapse
He's saying to flash a system image to get you up and running again, and I agree that that is what you should do. As far as placing the files in the same folder as adb and fastboot is concerned (you'll use fastboot to flash the image), you need to do just that. I created a folder on my desktop called "ADB" and that's where both adb and fastboot are, as well as all the files that I flash with fastboot ie. system images, recoveries, etc... Here's a great guide to get you going with adb and fastboot- http://forum.xda-developers.com/showthread.php?t=2277112
Now when you go to flash it, if you decide to use the flash-all.bat to flash everything (the full factory image) and bring you back to stock, you'll have to open the .bat file with a text editor and remove the "-w" from the script and that way it won't wipe your phone. If you want to just reinstall the OS without everything else (worth a shot), just flash the system with the command
Code:
fastboot flash system system.img
and that should get you running again. If what I just said is confusing, read the guide I posted and it should become clear.
Here is where you'll download the factory image from- https://developers.google.com/android/nexus/images
Just unzip it, pull the system.img out and place it in the same folder that fastboot is in and flash away.
And one final thing- definitely avoid toolkits at all costs. You spent a good chunk of change on your phone, take the time to learn how to mod it the correct way.
Good luck!

_MetalHead_ said:
He's saying to flash a system image to get you up and running again, and I agree that that is what you should do. As far as placing the files in the same folder as adb and fastboot is concerned (you'll use fastboot to flash the image), you need to do just that. I created a folder on my desktop called "ADB" and that's where both adb and fastboot are, as well as all the files that I flash with fastboot ie. system images, recoveries, etc... Here's a great guide to get you going with adb and fastboot- http://forum.xda-developers.com/showthread.php?t=2277112
Now when you go to flash it, if you decide to use the flash-all.bat to flash everything (the full factory image) and bring you back to stock, you'll have to open the .bat file with a text editor and remove the "-w" from the script and that way it won't wipe your phone. If you want to just reinstall the OS without everything else (worth a shot), just flash the system with the command
Code:
fastboot flash system system.img
and that should get you running again. If what I just said is confusing, read the guide I posted and it should become clear.
Here is where you'll download the factory image from- https://developers.google.com/android/nexus/images
Just unzip it, pull the system.img out and place it in the same folder that fastboot is in and flash away.
And one final thing- definitely avoid toolkits at all costs. You spent a good chunk of change on your phone, take the time to learn how to mod it the correct way.
Good luck!
Click to expand...
Click to collapse
So I have adb and fastboot running. And I changed the flash-all.bat file. However, I don't understand what I do now? I downloaded the Hammerhead zip and it has a bunch of things in it. Which files do I put into the adb/fastboot folder and how do I then flash them?
In the hammerhead file it lists the bootloader, flash-all, radio and then a zip file "image-hammerhead...". What files am I using and what is the code that I input? Is this the same sa flashing a rom?
I also tried placing the system.img in the adb folder, and then using the
Code:
fastboot flash system system.img
but it gives me an error "cannot load 'system.img'

So now my issue is I get a "error: could not load 'system.img'. after running
Code:
fastboot flash system system.img [code/] . I also tried with boot.img. Same error.
I ran the "flash all" script, by accident, a screenshot of the terminal is attached.. I'm still stuck in a the boot loop, however, and if try to enter recovery mode an android lying down with a red triangle is present. The above "error: could not load..." is still present.

Create a folder and put fastboot in it.
So you unzipped the stock image. You said you have some images in the folder and a zip image.
Unzip that second zip.
There you will find the rest of the images you need.
Now take the recovery, bootloader, system, userdata, cache, and radio images and move them into the folder which you created for fastboot.
Rename the bootloader image to bootloader. img
Now when looking at that open folder containing all the images and fastboot hold down shift and left click and select "open command promt from window"
Type
/fastboot erase bootloader
/fastboot flash bootloader bootloader.img
/fastboot reboot-bootloader
/fastboot erase recovery
/fastboot flash recovery recovery.img
/fastboot erase radio
/fastboot flash radio radio.img
Repeat for the rest of the image files
Finally type /fastboot reboot
Profit.
---------- Post added at 10:54 PM ---------- Previous post was at 10:51 PM ----------
P. S. Make sure your phone is booted in fastboot mode first.

Oh and that android is stock recovery

U fixed it?

So for some reason I still kept getting that error. I ended up restoring to stock using the nexus root toolkit. So it all worked out in the end.

Related

[Q] Technical difference between RSDLite and fastboot

I recently bricked my Atrix 2, and since I don't have easy access to a Windows machine, I attempted to flash it back to stock using fastboot from the android dev tools. I noticed that the XML file in the FXZ looked like a set of fastboot commands, so that's what I tried to do. However, no matter which zip I started from, it always failed to flash system.img, saying that verification failed. After giving up on that approach, I used a friend's windows machine to flash the exact same zip using RSDLite, and it succeeded just fine. This leads me to conclude that RSDLite must be doing something special when flashing the system.img. Does anyone know what it is, and is there a way to do the same thing using the standard Android development tools (fastboot, etc)?
Thanks!
bemjb said:
I recently bricked my Atrix 2, and since I don't have easy access to a Windows machine, I attempted to flash it back to stock using fastboot from the android dev tools. I noticed that the XML file in the FXZ looked like a set of fastboot commands, so that's what I tried to do. However, no matter which zip I started from, it always failed to flash system.img, saying that verification failed. After giving up on that approach, I used a friend's windows machine to flash the exact same zip using RSDLite, and it succeeded just fine. This leads me to conclude that RSDLite must be doing something special when flashing the system.img. Does anyone know what it is, and is there a way to do the same thing using the standard Android development tools (fastboot, etc)?
Thanks!
Click to expand...
Click to collapse
Fastboot is basically doing what RSD Lite does manually. If you keep on getting a flash system.img error mkake sure that you have the proper drivers. You can download Android-SDK for your platform and then open the manager. There should be an option to install a drivers package.
I am pretty sure RSD Lite does nothing special. I have flashed just the system.img multiple times to quickly get my phone back up and running.
.
farshad525hou said:
Fastboot is basically doing what RSD Lite does manually. If you keep on getting a flash system.img error mkake sure that you have the proper drivers. You can download Android-SDK for your platform and then open the manager. There should be an option to install a drivers package.
I am pretty sure RSD Lite does nothing special. I have flashed just the system.img multiple times to quickly get my phone back up and running.
.
Click to expand...
Click to collapse
Thanks, but there are no USB drivers available for Mac OS X: the Android SDK says that they are unavailable for this platform. Maybe if I get the chance, I'll see if doing the flash with fastboot on Windows gives different results.
Are you using moto-fastboot?
Oh there's a Mac version here (from here)
There's a size limit on flash operations with normal fastboot.
moofree said:
Are you using moto-fastboot?
Oh there's a Mac version here (from here)
There's a size limit on flash operations with normal fastboot.
Click to expand...
Click to collapse
I've been using normal fastboot, I didn't realize there was a difference there. Thanks a ton, I'm sure that will solve my issue!
This needs to be added to to using the fastboot command that Farshad posted.
If you are doing this from OS X or linux, or well even windows, I posted a string of commands on how to flash these files using fastboot, there is a certain order, and there are files from the fxz you will need to skip.
Next time please do a search on this board for fastboot flash commands....
I will be nice and post this one last time, but this has been answered by me about 10 times now.... just saying....
run these commands from the OS X or linux terminal command line:
cd to the directory that contains the fxz files, and run the following (make sure that the adb and fastboot commands are in your path, I will not include that here, you should google how to add things to your path):
Code:
fastboot erase userdata
fastboot erase boot
fastboot erase system
fastboot erase recovery
fastboot flash userdata userdata.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot reboot
jimbridgman said:
This needs to be added to to using the fastboot command that Farshad posted.
If you are doing this from OS X or linux, or well even windows, I posted a string of commands on how to flash these files using fastboot, there is a certain order, and there are files from the fxz you will need to skip.
Next time please do a search on this board for fastboot flash commands....
I will be nice and post this one last time, but this has been answered by me about 10 times now.... just saying....
run these commands from the OS X or linux terminal command line:
cd to the directory that contains the fxz files, and run the following (make sure that the adb and fastboot commands are in your path, I will not include that here, you should google how to add things to your path):
Code:
fastboot erase userdata
fastboot erase boot
fastboot erase system
fastboot erase recovery
fastboot flash userdata data.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot reboot
Click to expand...
Click to collapse
do you really have to erase before flashing? I always try to avoid formatting system, but I have not done this manually, so you may have to.
lkrasner said:
do you really have to erase before flashing? I always try to avoid formatting system, but I have not done this manually, so you may have to.
Click to expand...
Click to collapse
Yes if you don't you will most likely get an error when you try to flash system.img, over a different system version.
jimbridgman said:
This needs to be added to to using the fastboot command that Farshad posted.
If you are doing this from OS X or linux, or well even windows, I posted a string of commands on how to flash these files using fastboot, there is a certain order, and there are files from the fxz you will need to skip.
Next time please do a search on this board for fastboot flash commands....
I will be nice and post this one last time, but this has been answered by me about 10 times now.... just saying....
run these commands from the OS X or linux terminal command line:
cd to the directory that contains the fxz files, and run the following (make sure that the adb and fastboot commands are in your path, I will not include that here, you should google how to add things to your path):
Code:
fastboot erase userdata
fastboot erase boot
fastboot erase system
fastboot erase recovery
fastboot flash userdata data.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot reboot
Click to expand...
Click to collapse
Sorry I missed your other explanations. I did see a lot of posts with random fastboot commands, but pretty much none with any sort of explanation or rationale. Most of them seemed to be on the order of "Use these commands because I said so" or "I used these and they seem to work, I don't know why".
Do you have a writeup where you explain why should I flash with fastboot in a different order than is given in the fxz? And can you explain why you are skipping flashing most of the partitions? None of the instructions for using RSD Lite suggested removing nearly that many of the entries in the xml file, so I would like to know why I wouldn't want to flash the same things that RSD Lite would be flashing.
If you do have a canonical post explaining what needs to be done and why, I can ask the maintainer of the newbie information post to add a link to that post, so that it is easy to find and hopefully make it so that you don't have to post about it again. If that post doesn't exist, if you would like to give me enough information to write it, I am more than happy to write it up (crediting you for the info, of course), and then see about getting it added to the newbie post.
bemjb said:
Sorry I missed your other explanations. I did see a lot of posts with random fastboot commands, but pretty much none with any sort of explanation or rationale. Most of them seemed to be on the order of "Use these commands because I said so" or "I used these and they seem to work, I don't know why".
Do you have a writeup where you explain why should I flash with fastboot in a different order than is given in the fxz? And can you explain why you are skipping flashing most of the partitions? None of the instructions for using RSD Lite suggested removing nearly that many of the entries in the xml file, so I would like to know why I wouldn't want to flash the same things that RSD Lite would be flashing.
If you do have a canonical post explaining what needs to be done and why, I can ask the maintainer of the newbie information post to add a link to that post, so that it is easy to find and hopefully make it so that you don't have to post about it again. If that post doesn't exist, if you would like to give me enough information to write it, I am more than happy to write it up (crediting you for the info, of course), and then see about getting it added to the newbie post.
Click to expand...
Click to collapse
The reason is there are other files, and some are binary files that run commands and make changes to the bootloader, and other things, you do not need any of that to have a working phone. Some of them also open the bootloader to allow flashing, which is not needed if you erase the boot partition first. Any of those files like mbmloader, and anything with .bin after it will not work correctly unless you use RSDlite, it sends the signatures and such to the files that require it.
For getting your phone back up in a quick and dirty fashion we don't care about the signatures, we are assuming you got the fxz from a known source, by doing it this way.
You should do other research besides this site, pull apart a few roms, the fxz, and figure out how they work. Do some android research as to the boot process, etc. That how this kind of information is learned. The why in this case is less important. I would have to explain android and linux and how they boot as well in more detail here, but those are best left to the google and linux explanation sites.
This is not a process for a beginner, that is why it is not in the beginner thread. It has the possibility of hard bricking your phone if a mistype happens.
I am going to be 100% honest here, if you don't know any of the information I am referring to in this post, just use RSDlite, it has checks and safeguards that this process does not.
If you really want to learn about this, and not just asking questions because you don't understand, then jump in with us devs and start to learn, pull apart some ROMs flash a few ROMs, build a few ROMs, those things will teach you more than you will ever need to know about what files are and are not needed for a working phone. Also google is a good resource.
Also your boot.img and your recovery.img could be left out, since they are never touched by you or a ROM flash. I leave them in for a slight safeguard that your phone will actually be wiped clean.
P.S. I am a linux and OS X user myself, hence why I learned all of this a long time ago... I have been using and working on android since the G1 firat came out.
I also use bootcamp with win7 just to use RSDlite, when the need arises... that is not often, if you follow my process. It skips all the checking, processing that RSDlite does with using fastboot.
jimbridgman said:
The reason is there are other files, and some are binary files that run commands and make changes to the bootloader, and other things, you do not need any of that to have a working phone. Some of them also open the bootloader to allow flashing, which is not needed if you erase the boot partition first. Any of those files like mbmloader, and anything with .bin after it will not work correctly unless you use RSDlite, it sends the signatures and such to the files that require it.
For getting your phone back up in a quick and dirty fashion we don't care about the signatures, we are assuming you got the fxz from a known source, by doing it this way.
You should do other research besides this site, pull apart a few roms, the fxz, and figure out how they work. Do some android research as to the boot process, etc. That how this kind of information is learned. The why in this case is less important. I would have to explain android and linux and how they boot as well in more detail here, but those are best left to the google and linux explanation sites.
This is not a process for a beginner, that is why it is not in the beginner thread. It has the possibility of hard bricking your phone if a mistype happens.
I am going to be 100% honest here, if you don't know any of the information I am referring to in this post, just use RSDlite, it has checks and safeguards that this process does not.
If you really want to learn about this, and not just asking questions because you don't understand, then jump in with us devs and start to learn, pull apart some ROMs flash a few ROMs, build a few ROMs, those things will teach you more than you will ever need to know about what files are and are not needed for a working phone. Also google is a good resource.
Also your boot.img and your recovery.img could be left out, since they are never touched by you or a ROM flash. I leave them in for a slight safeguard that your phone will actually be wiped clean.
P.S. I am a linux and OS X user myself, hence why I learned all of this a long time ago... I have been using and working on android since the G1 firat came out.
I also use bootcamp with win7 just to use RSDlite, when the need arises... that is not often, if you follow my process. It skips all the checking, processing that RSDlite does with using fastboot.
Click to expand...
Click to collapse
Thanks for the rather comprehensive reply. Sadly, I do not have the time or inclination to build ROMs, in fact, I may not have dug into this at all if I had a Windows license, but I do not. So it is true that I didn't know all of the information that you mentioned in the post, but I had guessed a lot of it given the format of the xml file in the fxz and the names of the partitions. I just like to verify that my guesses are not incorrect, thus the questions. I do have plans to spend some time reading Google's official Android documentation, I just hadn't gotten there yet.
Anyways, while I am not interested in building ROMs, given the format of the xml file, it looks like it would be a fairly easy task to build a Java application that would read the XML file, check the MD5 sums, and then do the flashing just like RSD Lite. If I was to do something to contribute to the development effort, I'd probably start there. Don't know if I'll have time, but that's much more of a problem to me than a custom ROM. You mention signature checking: does RSD Lite actually check cryptographic signatures on the images themselves, or is it only checking the MD5s? (Feel free to ignore that question if you think I should spend some time Googling, if you don't answer, I'll get around to looking it up eventually)
P.S. I am an experienced Linux and OS X user. I only happen to be new to the Android world. (I was using webOS before this)
bemjb said:
Thanks for the rather comprehensive reply. Sadly, I do not have the time or inclination to build ROMs, in fact, I may not have dug into this at all if I had a Windows license, but I do not. So it is true that I didn't know all of the information that you mentioned in the post, but I had guessed a lot of it given the format of the xml file in the fxz and the names of the partitions. I just like to verify that my guesses are not incorrect, thus the questions. I do have plans to spend some time reading Google's official Android documentation, I just hadn't gotten there yet.
Anyways, while I am not interested in building ROMs, given the format of the xml file, it looks like it would be a fairly easy task to build a Java application that would read the XML file, check the MD5 sums, and then do the flashing just like RSD Lite. If I was to do something to contribute to the development effort, I'd probably start there. Don't know if I'll have time, but that's much more of a problem to me than a custom ROM. You mention signature checking: does RSD Lite actually check cryptographic signatures on the images themselves, or is it only checking the MD5s? (Feel free to ignore that question if you think I should spend some time Googling, if you don't answer, I'll get around to looking it up eventually)
P.S. I am an experienced Linux and OS X user. I only happen to be new to the Android world. (I was using webOS before this)
Click to expand...
Click to collapse
No worries.... I am and have been a unix linux architect for 20 years (yes I got a job as a sysadmin at 17), been using macs since the 80s, I don't own a machine with a fulltime windows install. I only recently installed win 7 on my bootcamp partition on my macbook just for rdslite, only used it twice....
I have a shell script that will flash the phone using the commands I posted, if you would like I can upload it and post a link tomorrow. My shell script works on both os x and linux.
If you you try to do EXACTLY what rsdlite does line by line it will FAIL, even with a java app. The bin files and the mbm files can only be utilized with RSDlite. RSDlite has SEVERAL checks that only it can do after each step.... If you want to restore the fxz using the mac or linux the shell script is the easiest, no real need for all the fluff, of rsdlite or an app. I have done it about 20 times now without issue, so have others on here.
Again, just let me know if you want my script and I will post it here.
And no it does not check the cryptographic signature of the bootloader, but the mbm program that rdslite runs, does check the signature of the boot image and the bootloader.
I was not implying that you actually jump into rom dev work.... just that, by doing some pulling apart and attempting it will teach you more than reading the android docs.
If you are a linux guy then hopefully you know what sec linux is, and how it uses signatures with the bootloader. That is similar to what motorola has done with their bootloader on their android phones.
Jim
Sent from my MB865 using xda premium
jimbridgman said:
No worries.... I am and have been a unix linux architect for 20 years (yes I got a job as a sysadmin at 17), been using macs since the 80s, I don't own a machine with a fulltime windows install. I only recently installed win 7 on my bootcamp partition on my macbook just for rdslite, only used it twice....
I have a shell script that will flash the phone using the commands I posted, if you would like I can upload it and post a link tomorrow. My shell script works on both os x and linux.
If you you try to do EXACTLY what rsdlite does line by line it will FAIL, even with a java app. The bin files and the mbm files can only be utilized with RSDlite. RSDlite has SEVERAL checks that only it can do after each step.... If you want to restore the fxz using the mac or linux the shell script is the easiest, no real need for all the fluff, of rsdlite or an app. I have done it about 20 times now without issue, so have others on here.
Again, just let me know if you want my script and I will post it here.
And no it does not check the cryptographic signature of the bootloader, but the mbm program that rdslite runs, does check the signature of the boot image and the bootloader.
I was not implying that you actually jump into rom dev work.... just that, by doing some pulling apart and attempting it will teach you more than reading the android docs.
If you are a linux guy then hopefully you know what sec linux is, and how it uses signatures with the bootloader. That is similar to what motorola has done with their bootloader on their android phones.
Jim
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
You do have a couple of years on me on Linux use, and definitely lots more years of Mac use, I didn't use Macs until OS X. But I think we've established geek cred quite effectively at this point. ;-)
Thanks for offering the script, but if it literally just runs the commands that you gave earlier, it would be simple for me to just toss one together myself. (Now, if you want to elaborate on the secret sauce in RSDLite, I'd be all ears.
I do know what SELinux is. I haven't looked into the specifics of how they use signatures with the bootloader, but I have a pretty good idea of ways that it could be implemented. It does make a lot of sense that Moto would do something similar to SELinux. Actually, I'm a little bit surprised that they're doing something similar and not just doing the same thing, but perhaps the bootloaders are different enough that they needed to roll their own signing. (Or they just did what a lot of people do and fell into NIH syndrome.)
Thanks,
Bem
jimbridgman said:
This needs to be added to to using the fastboot command that Farshad posted.
If you are doing this from OS X or linux, or well even windows, I posted a string of commands on how to flash these files using fastboot, there is a certain order, and there are files from the fxz you will need to skip.
Next time please do a search on this board for fastboot flash commands....
I will be nice and post this one last time, but this has been answered by me about 10 times now.... just saying....
run these commands from the OS X or linux terminal command line:
cd to the directory that contains the fxz files, and run the following (make sure that the adb and fastboot commands are in your path, I will not include that here, you should google how to add things to your path):
Code:
fastboot erase userdata
fastboot erase boot
fastboot erase system
fastboot erase recovery
fastboot flash userdata userdata.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot reboot
Click to expand...
Click to collapse
Hm. My bootloader and I are not on very good terms atm :\
-It tells me "command restricted" when erasing system, recovery, or boot with fastboot. RSD Lite just says "FAIL."
-Also, it tells me "preflash validation failure" when flashing boot or recovery. RSD Lite again just says "FAIL"
-It also gives me the "preflash validation failure" when flashing system with fastboot. Moto-fastboot and RSD Lite both work. Maybe fastboot would work if we could erase system?
-Finally, we don't have a userdata.img
cogeary said:
Hm. My bootloader and I are not on very good terms atm :\
-It tells me "command restricted" when erasing system, recovery, or boot with fastboot. RSD Lite just says "FAIL."
-Also, it tells me "preflash validation failure" when flashing boot or recovery. RSD Lite again just says "FAIL"
-It also gives me the "preflash validation failure" when flashing system with fastboot. Moto-fastboot and RSD Lite both work. Maybe fastboot would work if we could erase system?
-Finally, we don't have a userdata.img
Click to expand...
Click to collapse
In the first line the fastboot command I referenced and that Farshad mentioned and linked to is the moto-fastboot command. You are supposed to rename the binary to fastboot, there was a readme at one time that explained that and was included with the download of moto-fastboot.
Also, yes we don't have a Userdata.img, but I pulled this from my own personal script, that I have been using since the G1 days, that was my first android phone. My script is not customized for just our phone, so the userdata.img line will fail, but since we don't need it, it is no big deal.
Jim
jimbridgman said:
In the first line the fastboot command I referenced and that Farshad mentioned and linked to is the moto-fastboot command. You are supposed to rename the binary to fastboot, there was a readme at one time that explained that and was included with the download of moto-fastboot.
Also, yes we don't have a Userdata.img, but I pulled this from my own personal script, that I have been using since the G1 days, that was my first android phone. My script is not customized for just our phone, so the userdata.img line will fail, but since we don't need it, it is no big deal.
Jim
Click to expand...
Click to collapse
Oh I see now . I typically use moto-fastboot but I never renamed it. Thanks for the clarification.
cogeary said:
Oh I see now . I typically use moto-fastboot but I never renamed it. Thanks for the clarification.
Click to expand...
Click to collapse
Yeah the reason to rename the binary/exe, was for compatibility with other scripts and programs in old days, when there was no odin or RSDlite, etc. I still do it, so that if someone does come up with some bad-assed way to do something via a script or other means for another phone, then I don't have to edit their script to reference the "moto-fastboot" binary/exe. I just rename the fastboot to fastboot-orig, or fastboot-google. If I ever change phones, and I will, I can rename the binary/exe again real easy.
Just one of those things I have learned over the years with both android and linux and well even in the old DOS and windows NT 3.51 and 4.0 command line days.

[Q] Problems loading factory image

I've looked all over, but cannot find anything on the problem I am having.
I go through the steps to load the current factory image onto my nexus s 4g through terminal on my mac, but for some reason it doesn't load everything. Here's what it says in terminal about the items that can't load:
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
And here's what my folder looks like where I'm loading everything from:
I guess I can't post a picture from an outside source, so I'll just type in what my folder looks like:
boot.img
bootloader-crespo4g-d720spric1.img
flash-all.bat
flash-all.sh
flash-base.sh
image-sojus-jro03r
image-sojus-jro03r.zip
radio-crespo4g-d720sprilf2.img
there are files in the unzipped folder (image-sojus-jro03r) named:
android-info.txt
recovery.img
system.img
userdata.img
These seem to be some of the files that are missing, but even when i drag them over to the main folder, they still don't load. maybe something to do with the fact that they are .sig's?
I drag the flash-all.sh file into terminal and it loads and writes everything except for these .sig's, which I truthfully don't know what they are. Now I can't get into the correct recovery mode, it just shows some weird blue-lettered options that are different then the normal recovery options. That is why I think the fact that these .sig files are not loading is the problem.
I also booted up the new operating system and signed on, but for some reason none of my apps can download.
Sorry for my noobness, but I'm sure I'm missing one easy step that will fix my problems.
Does anyone know what I'm going through?
Any help is much appreciated.
Alright. I've searched the web and found a few different things. It seems that it's common for those .sig files to not load. Also, i loaded the factory image again and was able to download my apps.
I also now foolishly realize that to get a good version of recovery, I need to root my phone. I'm in terminal now, and for some reason adb is not showing my phone in adb devices. This wasn't a problem when I loaded the factory image, but now it's a problem when I'm trying to do this: http://forum.xda-developers.com/showthread.php?t=1129759
step 5 is a problem, but hey, I can turn off the phone and go into fastboot mode myself. I guess step 7 is the next problem I'm dealing with. Here's what I get in terminal when I do step 7 manually (I put a *#* where my name is just so everyone knows):
MacBook:~ *#*$ /Users/*#*/Desktop/adb-fastboot/recovery-clockwork-5.0.2.0-crespo.img
-bash: /Users/*#*/Desktop/adb-fastboot/recovery-clockwork-5.0.2.0-crespo.img: Permission denied
Does anyone know what I'm dealing with this time around?
You probably need to enable adb in Settings --> Developer Options. If it's an issue with adb while in recovery, i'm pretty sure the stock recovery (which will be overwritten on every boot from a stock ROM) doesn't allow it. What you need to do is flash a new recovery in fastboot (not in recovery).
Commands (while in fastboot mode):
/path/to/fastboot devices <-- this will tell you if your phone is connected properly
/path/to/fastboot flash recovery /path/to/recovery.img <-- this will flash the new recovery
You'll need to type in the path to fastboot unless you have it in somewhere like /bin or a more convenient environmentally recognised location. The command you typed there is the same as trying to open the .img file as a script, you want to tell fastboot to flash the file to the phone and not open it with the computer.
Edit: Also, once you root, you probably want to delete /system/etc/install-recovery.sh. That file replaces any custom recovery with stock each time you boot.
Thanks Harbb.
That's what I ended up doing, using fastboot. it worked perfectly. I did try to find the /system/etc/install-recovery.sh file in root explorer, but could not find it. don't know where it is.
Everything is rooted and restored on my custom rom to where I was previously using titanium backup.
Here's the tutorial I was using: http://forum.xda-developers.com/showthread.php?t=1129759
with this video being a walkthrough of the previous tutorial: http://www.youtube.com/watch?v=sP9ZDWmbLVM
I was actually using the recovery img in the android folder that I downloaded from the tutorial, and not the one he told me to download, which was my problem in the end. Here's the link to the download page where I should have downloaded it from: http://forum.xda-developers.com/showthread.php?t=988686&highlight=clockwork+4.0.0.2
Thanks again Harbb, much appreciated.
No worries buddy, glad you got it sorted.

[GUIDE]How to update from 5.0 to 5.x without loosing data if you're not 100% stock

Instead of having instructions all over the place inside various threads I felt a clear guide should be available as it's own thread. Now since Google implemented this great feature (all hail google) where normal OTA's no longer work on Nexus devices with Android 5.0 that isn't 100% stock i.e. rooted with or without custom recovery a lot of people don't know how to update their devices.
IMO opinion the easiest way without losing any data is to use Fastboot and this is an attempt of a how-to-guide. This is made on a windows PC, probably works with other OS's too.
What you need:
1. You need ADB.exe and fastboot.exe inside an easy accessed folder i.e. put in c:\ADB.
The easiest way to get these are with this tool: http://forum.xda-developers.com/showthread.php?t=2317790
You can also get this by installing the whole Android SDK but that is just a waste of bandwidth and time.
2. You also need to download the latest factory image for Nexus 5. Do this here: https://dl.google.com/dl/android/aosp/hammerhead-lrx22c-factory-0f9eda1b.tgz
3. You might need adb drivers but you'll have to find instructions for this by yourself.
The procedure:
1. Extract necessary files. The factory image you'll download is named hammerhead-lrx22c-factory-0f9eda1b.tgz
This is an archive which can be opened with an extractor of your choice e.g. 7-zip
Inside this archive is another file with no file type extension. Extract this file and rename it to whatyouwant.zip since it's a regular zip file. Then extract all files within this file (very meta with zips inside zips inside zips etc).
The files you need for updating with fastboot are:
system.img
boot.img
radio-hammerhead-m8974a-2.0.50.2.22.img (rename this to radio.img for more convenience)
put all these files in the ADB folder (it will make things easier).
2. plug your phone to your PC. You need to have USB debugging activated in developer mode.
3. open a command prompt and orient yourself to the adb folder (c:\ADB)
4. type adb reboot bootloader and wait until your phone is in bootloader mode.
5. type fastboot flash system system.img and wait until it's finished.
6. type fastboot flash radio radio.img
7. type fastboot flash boot boot.img
8. reboot your device (type fastboot reboot).
Hopefully this will work and you will update without loosing any data. Then you can proceed with rooting, flashing custom recovery etc. This is easiest done with WUG nexus root toolkit (http://forum.xda-developers.com/showthread.php?t=2389107)
I couldn't find any other guide's but if there's already one please remove this.
Just a note, you don't need adb.exe at all, and the drivers are actually USB drivers.
Its also worth noting that 95% of us prefer to recommend users not use toolkits.
Also, you could simply say:
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash radio radio.img
...then point them to the existing adb and fastboot thread which would have saved you writing all the installation stuff out.
Thanks for the guide @mertzi. I've just used to upgrade my Nexus 5 to 5.0.1 without any loss of data. I appreciate the help!
rootSU said:
Just a note, you don't need adb.exe at all, and the drivers are actually USB drivers.
Its also worth noting that 95% of us prefer to recommend users not use toolkits.
Also, you could simply say:
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash radio radio.img
...then point them to the existing adb and fastboot thread which would have saved you writing all the installation stuff out.
Click to expand...
Click to collapse
Do I still use "fastboot flash radio radio.img" even though the radio image from the tgz file is "radio-hammerhead-m8974a-2.0.50.2.22.img"?
optoisolator said:
Do I still use "fastboot flash radio radio.img" even though the radio image from the tgz file is "radio-hammerhead-m8974a-2.0.50.2.22.img"?
Click to expand...
Click to collapse
No. The 4th section is the file path and location.
So this keeps user data? Just updated the system to 5.0.1?
Maintains root and all?
Sent from my Nexus 5 using XDA Free mobile app
Keeps user data but you will have to re-root.
Thank you, thank you, thank you.
I've spent last couple days trying to make heads or tails out of other "tutorials". Some of them linked the OTA update and gave instructions for full image, others gave instructions but lacked the links to the image. I am surprised that none of my searches took me here until today.
Thanks a lot for this guide I was ale to update to 5.0.1 thanks to this guide.
Can I use this method to update from 4.4.4 to 5.0.0 ?
... Not aire if you can jump from 4.4.4 to 5.0 this way...
I actually jumped flashing radio and baseband and THEN flashing CM12.1

How to unroot, lock bootloader and go back to stock?

For background, I have Verizon pixel 2 and am using a Mac.
I went down a massive rabbit hole last night reading through these forums and all the posts and was able to unlock bootloader, flash the January OTA and then root by doing the modified boot file with magisk. (interestingly enough the booting into recovery gives me red ! Over a dead Android and I could not load the OTA that way, nor did the adb sideload OTA comand work either, I had to push the extracted walleye img and then the zip file as discussed in one of the steps in some other thread here)
So anywho, in the end I now have a phone that gives me 2 errors when it reboots, one for unlocked bootloader and another for root telling me something is wrong with my phone and i should contact the manufacturer (which I read on here is normal), but my biggest issue is that my ADT alarm app doesn't work anymore (even if i check it off for hide in magisk). I feel like the root is just not worth it for me and I want to revert to completely stock image, even if it resets my phone and I have to re back everything up all over again like did when i had to do the unlocking of the boot loader.
So -- What are the steps I should take?
1)uninstall magisk from magisk manager?
2)delete magisk manager?
The above will unroot me, correct?
3)Do I push the stock boot image file onto the phone?
4) do I have to repush the latest OTA walleye image and zip file onto the phone again?
5) do I then do the adb reboot and do the flashing lock command (same command i did to unlock the boot loader) to lock up the bootloader and reset to stock?
If someone could be as explicit as possible in correctiong or validating my steps above it would be much, much appreciated.
I don't want to do any more unnecessary steps in flashing things than is needed so if I have extra steps above (perhaps 4 is not needed?) Let me know.
Thanks
Proceed with Caution
I am not an expert by any means, but can speak from personal experience. I was in the exact same situation as you. I followed the detailed steps to unlock the bootloader on my pixel 2, received similar issues, and the same prompt when the phone rebooted. All that to say proceed with caution.
My thoughts on questions 1 & 2: I personally wouldn't recommend you remove or delete magisk from the manager. When I did i had to reinstall it via twrp. My phone functioned fine, apart from the error at reboot.
My thoughts on questions 3 -5: When I followed the steps on XDA for your questions here I ended up bricking my Pixel 2 with locked bootloader from Verizon. Probably an error on my part, but wouldn't want someone else to go through the headache, hours of issues, and then an expensive paper weight.
My suggestion would be to:
1. Leave your phone as is and attempt to trouble shoot the app or apps you are having issue with
2. contact Google support on your phone and see if they would replace it
3. wait for an established method to unroot the pixel 2 here
Thankfully Google replaced my phone due to the error after rebooting, prior to me bricking it. I knew I had a replacement phone coming. So I attempted to go back to stock and that is when I messed it up.
Note sure this is exactly what you were looking for, but hope this helps you.
Dozens of posts with hundreds of pages on how to root but no advice on how to go back to stock cleanly?
iridium7777 said:
Dozens of posts with hundreds of pages on how to root but no advice on how to go back to stock cleanly?
Click to expand...
Click to collapse
Your version is Verizon which is making things more complicated. Generally when the bootloader is unlocked, you just hit flash-all.bat and then relock the phone. Given that the Verizon I'm not sure.
So you are on stock ROM with all these apks loaded ? If you go to settings, then do a factory data reset, you'll reset the phone back to stock and completely wipe the phone and return it to stock, at that point you can go into bootloader mode and relock.
Again your bootloader is unlocked, so the flash-all is your best option. If you see the red exclamation point with the error android laying on his back, you press power and up volume and toggle that and it will bring in the stock recovery which you can sideload the OTA however it may fail since you have magisk.
I bought my phone stock last year and have not rooted it or modified it in anyway. Too many problems and it only gets harder and harder as Google releases a new phone.
@mikeprius -- thank you for replying. after reading more on here, it seems like that's the way to go -- flash-all script, seems like i don't really need to do 1&2 that i wrote above as the flash-all will wipe that out by itself.
at that point i should be running the latest stock 8.1 but with an unlocked bootloader (and according boot up message screen) and i should be able to re-do the fastbook unlocking command to lock the phone back up.
(and yes, after reading even more now -- and i tried this yesterday -- i completely missed the portion about PWR + Vol Up button, that's why i think i had that issue, but still, i was able to push the update by pushing img and then the zip through).
iridium7777 said:
@mikeprius -- thank you for replying. after reading more on here, it seems like that's the way to go -- flash-all script, seems like i don't really need to do 1&2 that i wrote above as the flash-all will wipe that out by itself.
at that point i should be running the latest stock 8.1 but with an unlocked bootloader (and according boot up message screen) and i should be able to re-do the fastbook unlocking command to lock the phone back up.
(and yes, after reading even more now -- and i tried this yesterday -- i completely missed the portion about PWR + Vol Up button, that's why i think i had that issue, but still, i was able to push the update by pushing img and then the zip through).
Click to expand...
Click to collapse
If I were in your situation and the bootloader is unlocked, just use flash-all which has a wipe script then call it a day. I think trying to screw around even more is just a waste of time and I wouldn't even bother with the OTA, just erase and flash stock. You don't have to relock your bootloader if you don't want to, if you stay fully stock you may still be able to get OTA updates. I'm not sure if a bootloader locked is required someone can chime in as it has been awhile since I've done this, but over 1 yr ago, I just kept the bootloader unlocked, kept things stock and everything was good to go. Obviously there are security issues with an unlocked bootloader, but I'm sure you know this already
@mikeprius you keep saying reset/erase, do you suggest i re-set the phone and then flash the stock image?
i was just going to flash the stock image, i figured it already wipes the phone, and locking the bootloader would wipe it again, so what's the point of erasing all data prior?
Not to hijack this thread, but a question to add... I thought that there were kernels that would mask certain things to allow all of those apps to work, and get rid of the "problem with device" message.
Is that correct?
iridium7777 said:
@mikeprius you keep saying reset/erase, do you suggest i re-set the phone and then flash the stock image?
i was just going to flash the stock image, i figured it already wipes the phone, and locking the bootloader would wipe it again, so what's the point of erasing all data prior?
Click to expand...
Click to collapse
Just flash the stock images. It will auto reset.
Again, don't mess with anything just flash stock images, then go from there.
Also flash the newest version of the stock images out there. The pixel 2 will error if you try to downgrade any version.
here are all the steps to UNROOT and LOCK the boot loader on your Pixel 2 on a Mac (windblows users simply ignore all the "./" references).
1) download the latest ADB tools from google
2) download the latest factory Walleye image
3) unzip files from 1&2 into a common directory
4) edit flash-all.sh file and add "./" infront of every instance of "fastboot" in the script [windows users ignore this step]
5)hook up your phone to your computer in debug and file transfer mode. check that "./adb devices" loads your devide
6)type " ./adb reboot bootloader"
7) check that your device is still connected by typing "./fastboot devices"
8) type "./flash-all.sh"
===the script will run and your phone will be restored to stock, and UNROOTED. upon boot up skip through all of the setup steps and get to the phone settings as fast as you can. enable developer option, enable debug mode, set phone to data transfer ====
9) check that your phone is connect to your computer by "./adb devices"
10) type "./adb reboot bootloader"
11) check your devices is still connected by "./fastboot devices"
12) type "./fastboot flashing lock"
===== this will re-wipe your device again, you'll see the circle of death, and this will LOCK your boot loader back up again======
side note, feel free to skip over the steps where you check that your phone is still connected to the computer (./fastboot devices) if you're less paranoid and comfortable.
iridium7777 said:
here are all the steps to UNROOT and LOCK the boot loader on your Pixel 2 on a Mac (windblows users simply ignore all the "./" references).
1) download the latest ADB tools from google
2) download the latest factory Walleye image
3) unzip files from 1&2 into a common directory
4) edit flash-all.sh file and add "./" infront of every instance of "fastboot" in the script [windows users ignore this step]
5)hook up your phone to your computer in debug and file transfer mode. check that "./adb devices" loads your devide
6)type " ./adb reboot bootloader"
7) check that your device is still connected by typing "./fastboot devices"
8) type "./flash-all.sh"
===the script will run and your phone will be restored to stock, and UNROOTED. upon boot up skip through all of the setup steps and get to the phone settings as fast as you can. enable developer option, enable debug mode, set phone to data transfer ====
9) check that your phone is connect to your computer by "./adb devices"
10) type "./adb reboot bootloader"
11) check your devices is still connected by "./fastboot devices"
12) type "./fastboot flashing lock"
===== this will re-wipe your device again, you'll see the circle of death, and this will LOCK your boot loader back up again======
side note, feel free to skip over the steps where you check that your phone is still connected to the computer (./fastboot devices) if you're less paranoid and comfortable.
Click to expand...
Click to collapse
hey there. what is the command suppose to look like? every combination I try gives me an error:
first, I don't even enter the Fastboot command the same wayit given me an error:
Asads-MacBook:~ asad$ ./fastboot devices
-bash: ./fastboot: No such file or directory
so I try this: Asads-MacBook:~ asad$ fastboot devices
[serial #] fastboot
these are all the errors I get:
Asads-MacBook:~ asad$ cd /Users/asad/Desktop/walleye-opm1.171019.021
Asads-MacBook:walleye-opm1.171019.021 asad$ ./flash-all.sh
./flash-all.sh: line 21: fastboot./: No such file or directory
...
Asads-MacBook:walleye-opm1.171019.021 asad$ ./flash-all.sh
./flash-all.sh: line 21: ./fastboot: No such file or directory
...
Asads-MacBook:walleye-opm1.171019.021 asad$ ./flash-all.sh
fastboot: usage: unknown command ./flash
...
Asads-MacBook:walleye-opm1.171019.021 asad$ ./flash-all.sh
./flash-all.sh: line 21: fastboot./: No such file or directory
...
how is the command suppose to look that I can edit it the right way?
"fastboot: No such file or directory" means that you didn't do step 1, step 3 on the file you didn't download, and there should probably be a "cd /<whatever the 'common directory'>" is. (I just created a directory named adb. That's good enough for me to know what it's for.)
You have to download adb and fastboot (which come in the adb tools file), unzip them to whatever directory you're going to use for flashing the phone, and cd to that directory.
Then, since you're evidently on MacOS, each command has to have ./ in front of it (that says "the current directory"). Try all that, then see what happens.
Rukbat said:
"fastboot: No such file or directory" means that you didn't do step 1, step 3 on the file you didn't download, and there should probably be a "cd /<whatever the 'common directory'>" is. (I just created a directory named adb. That's good enough for me to know what it's for.)
You have to download adb and fastboot (which come in the adb tools file), unzip them to whatever directory you're going to use for flashing the phone, and cd to that directory.
Then, since you're evidently on MacOS, each command has to have ./ in front of it (that says "the current directory"). Try all that, then see what happens.
Click to expand...
Click to collapse
yayy! that worked!
so i had adb and fastboot in a folder (platform-tools) and i had the factory image in its own seperate folder (walleye-files). i was making the cd; walleye folder and trying to flash-all.sh there.
so i had to put the files from the walleye folder into the platform-tools folder. Then I made platform-tools the cd. now when . i could now follow all the steps from 4-12 and got the pixel 2 the way it was OTB.
thanks!
Great! I'm not a Mac expert (last time I used one was the 128K Mac in 1985), so I'm not sure how to export a path in MacOs, so I gave you the complicated way, but you got it done anyway. (If you ever find out how to add the platform-tools folder to your path, you can leave adb and fastboot in there and keep the ROMs [walleye] in their own folder, cd to it and adb and fastboot will still work.)

Deepest wipe/flash I can do?

What is the most thorough wipe and full reinstall I can do?
I have flashed different OS' before but it still carries forward baggage like random folders and TWRP files.
Is there a way to get my phone to the most basic level there is (inc no TWRP) with the newest OS/Kernel?
xinfernal said:
What is the most thorough wipe and full reinstall I can do?
I have flashed different OS' before but it still carries forward baggage like random folders and TWRP files.
Is there a way to get my phone to the most basic level there is (inc no TWRP) with the newest OS/Kernel?
Click to expand...
Click to collapse
What I tend to do with Bacon is to go back to the last version of firmware that Cyanogen put out, which you can read about here (https://forums.oneplus.com/threads/oneplus-one-rom-cyanogen-os-13-1.440959/).
I'll download the Fastboot images (https://www.androidfilehost.com/?fid=24591000424960109)
Unzip to wherever on your computer.
Copy a working version of adb/fastboot binaries to the same directory where you unzipped your Bacon images.
Search the unzipped folder contents for a the shell file called "flash-radio.sh" and open it with a text editor of some sort.
In there you'll have a few scripts that call the fastboot binary to flash all of the unzipped binaries/images to their respective partitions on the device. If you're savvy enough you can modify/add to this shell file so that it flashes everything for you in one fell swoop (Recovery, Boot, Cache, System, Userdata, etc.). If not then you'll need to run each command individually in a terminal/powershell/command prompt window (example "fastboot flash system system.img" or "./fastboot flash recovery recovery.img" or even "sudo ./fastboot flash boot boot.img"; depending on your computer setup you may need to make the fastboot binary executable but that's a deeper conversation.).
Finally just to entertain superstition I'll do the flash for about three times. Any respectable developer will tell you that this is probably bad practice just because an emmc/flash-based memory can only take so many read/writes in its lifetime, but again that's a deeper conversation. I'm sure that there are also device forensic specialists that will tell you that the only ultimate wipe you can ever do on an emmc is pulverization with a decent sledgehammer.
Manually reboot the device or if you're still in fastboot just run an iteration of fastboot reboot.
Profit.

Categories

Resources