yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] El Daddy:
I'm not frustrated with you so don't worry about that. I'm giving you credit for wanting to try to learn. I saw that you revived my old toolkit thread. :)

Its true, efrants guide is verbose, but he wanted to explain in a step by step so users can learn. Yes there area a few shortcuts that one can do, but in my opinion its better to do all of the steps so if in the future one needs to just flash the system.IMG, they'll know how to do it.

Believe me. When I joined xda 5 years ago I knew nothing. I have no background in CS or coding. (I work in the beer industry) But, I did my best to follow the guides and learn. Now I feel confident enough to try and help others and teach them.

So hang in there and take your time. I'm off to bed for the night. If you can't figure it out, I know efrant has already offered, but I would also be willing to give you a hand if needed.

Good luck!
[Nexus 4 General] pacotheslayer:
flashing question

Would it be fine if I directly download the file to my phone and then go into recovery mode and wipe cache and wipe data and then flashing it like a custom ROM? Or do I have to use a computer. I am using the latest AOKP
[Nexus 4 General] vicstarman:
Awesome! Thanks for replying and being so understanding as well. Efrant TOTALLY helped me out!! I am indebted to him for sure. He got me up and running. I didn't feel TOO stupid after all, though I should have been more careful and attentive to learning properly, because he said it was admittedly a "quirky" experience. Apparently my phone and/or whatever I did to it really threw things for a loop (no pun intended).

Bottom line is, read carefully and act with caution. I randomly decided to throw Trinity kernel on my Stock ROM device like an a-hole. That's what started the whole chaos.

I'm back up and running, stock rom, unrooted, and locked as of this minute. With CWR ready to rock. I will at least unlock the bootloader and root for now so I can use apps and backup. But I may try to slow up for a bit and continue to learn the right way to do things (step by step, old school style).

Peace out,

N

---------- Post added at 10:59 PM ---------- Previous post was at 10:57 PM ----------

(though I'm already frustrated with the stock kernel.... in the time it took me to re-set up my accounts and home screen (one), the battery went from 100% to 61%. With the screen on the dimmest setting!

Such a crappy kernel!!!!
[Nexus 4 General] thephantom:
Depends on which file you mean. If you mean the full images, then no.

Flowed and Tapped from my Nexus
[Nexus 4 General] Ranzoo:
Nice work!!! Keep it!
[Nexus 4 General] gericomsurnet:
i do the seem things to install stock rom jb 4.2.2 and it work perfectly

thanks you a lot

Nice work!!!
[Nexus 4 General] BallOfHate:
Good stuff

@efrant: Just simply an awesome tutorial. I am on a Macbook Air (Mountain Lion) and haven't go into the terminal and messed around before. Your instructions are very clean. Keep up the terrific work!
[Nexus 4 General] shankesh:
Awesome tutorial.. Thumbs up dude...
[Nexus 4 General] osugsxr:
been searching on this but not much found, I have unlocked bootloader, rooted, and custom recovery but have the "secure boot enabled" does it make a difference ? I flashed few roms and no issues. Any input would be helpful
[Nexus 4 General] efrant:
No, it makes no difference.
[Nexus 4 General] aldarm:
thanks a lot...

...for this great tutorial and also for your post: [REF] "Android for the Nexus 4" 101 & FAQs
[Nexus 4 General] shafton:
Install Update

So I followed the original post and successfully installed 4.2.1 on my Nexus 4. No custom anything and no root.

I cannot get the latest OTA update to install from the phone or via an update.zip in Recovery/ADB.

What process should I follow to get this update to install? I do not want to wipe the device if possible....
[Nexus 4 General] efrant:
If you've followed the instructions in the first post, you should be entirely stock, and the OTA update would install. What is the issue you are having?

By the way, you can also flash the 4.2.2 images as per the instructions in the OP, and you won't need the OTA update.
[Nexus 4 General] shafton:
Update Failed

I agree, it should be entirely stock (I just followed these instructions, completely, about 1 week ago). When running the update it simply says "Failed" with no additional information. Is there an easy way for me to confirm each component is stock?
[Nexus 4 General] efrant:
The easiest way I can think of is to flash them again. :)
[Nexus 4 General] shafton:
Okee dokee

I'm fine with that, but preferably without losing my data.. if possible, can you tell me what steps under section D I should follow to try again without losing data?
[Nexus 4 General] efrant:
Do all the steps but skip flashing the userdata image and you won't lose any data. That being said, some people have reported that they couldn't get their device to boot without doing a factory reset, so probably best to backup just in case.

Otherwise, you can boot CWM and try to install the update using that. It will tell you exactly why it is failing.

1) Download CWM from here and save it to the same directory as your fastboot.exe file. Rename it to cwm.img

2) Download the JDQ39-from-JOP40D update from here and place it in /sdcard on your device

3) Reboot your device into the bootloader and plug into your PC

4) Open a command prompt in the same folder as in step 1 and type: fastboot boot cwm.img

5) Navigate the menu in CWM to flash the update you downloaded in step 2. If it fails, it will tell you why. Post the error in this thread.
[Nexus 4 General] shafton:
Solved

Thanks for suggesting CWM -- this for some reason made my error clearer to me. Apparently on my phone (maybe this is unique maybe not), what seemed to be my /sdcard directory was actually /sdcard/0 -- which meant that all my previous attempts were actually generating a "no such file/directory" error.

Seems like I should correct this issue, anything you've seen before?

Really appreciate your responses -- led me to successfully install the update.
[Nexus 4 General] efrant:
I've never had the issue, but I understand that some have had it. Likley due to flashing ROMs with older custom recoveries.
[Nexus 4 General] roddem:
not able to root ;(

i am not able to root ! i followed the step by step instructions ! flashed the latest 4.2.2 and m not able to root it ˜! even tried flashing the 4.2 and root but to no success.. earlier my device used to say pipe properties could not be found ! now that error doesnt come but it says error : device not found ! i am on a mac ! when i reach the part of booting into custom recovery and trying and flash the su zip, it says installation aborted !

please help me out
[Nexus 4 General] haige:
Thanks a lot

Just wanna express my most sincere gratitude for teaching me how to restore my N4, I seriously thought for a second that my phone's a goner :good:
[Nexus 4 General] mys3:
unlocking bootloader by fastboot works fine, but when i come to the flash customrecovery step on rooting 4.2.2 the command returns this error:

error: cannot load 'customrecovery.img' image : no error

what am i doing wrong?
[Nexus 4 General] efrant:
Check the following:

1) Is the image in the same directory as fastboot.exe?

2) Is your command prompt window open in that same directory?

3) If you have "Hide extensions of known file types" enabled in Windows and you renamed the file cwm.img, then you actually named it cwm.img.img. Fix it.
[Nexus 4 General] mys3:
Thanks. I think my problem may be with downloading the cwm file. When I click on link it opens a page full of code & when I save it doesn't give the option to save as an image but as a document. How do I change this please?
[Nexus 4 General] vickysud:
followed the steps n updated to 4.2.2 but its taking lot of time at "X" boot animation..usually how much does it take on first boot ?

How to get into stock recovery ? when i press recovery i only see android with red triangle.
[Nexus 4 General] trueblueram:
Refer lines highlighted in red in op
[Nexus 4 General] Caseyy:
Sorry for the noob question but does this work on 4.2.2? Just got my N4 this morning and updated to 4.2.2 before i got to root the phone. D'Oh!!

Any help will be very very much appreciated.

Sláinte!
[Nexus 4 General] chrone:
Since you're on 4.2.2, just flash the custom recovery and from within flash the supersu flashable zip to gain root.

It's well explained in point E of the first post. :)

Sent from my Nexus 4
[Nexus 4 General] Tunderpimp:
Alright I'm on D. Step 5 the problem is I opened the occam and only one file was inside occam-jdq39-factory-345dc199. I see no radio, etc. Now I've flashed this kinda stuff on my old phone If I understand occam is a rom img. My phone said it unlocked bootloader, and shows an unlocked lock when it boots. Can/or should I proceed to root my phone?

Sent from my SGH-T959V
[Nexus 4 General] 3rdstring:
occam-jdq39-factory-345dc199.tar is another compressed file it needs to be "unzipped" with something like 7zip
[Nexus 4 General] efrant:
You don't have to flash anything if all you want is root. Unlock the bootloader and proceed to step E.

Btw, to find the images, you have to extract the tar within the tgz
[Nexus 4 General] Tunderpimp:
Unlocked bootloader and rooted. Thanks

Sent from my SGH-T959V

---------- Post added at 01:29 AM ---------- Previous post was at 01:20 AM ----------

I was looking at another guide it said I could get my custom recovery to stick by flashing it with rom manager. I was gonna use twrp. I was hoping for your guy's opinion on this method. In my past experience recovery was built into a custom kernel.

Sent from my SGH-T959V
[Nexus 4 General] azrash:
nope for the Nexus 4, you can flash them via fastboot, or use an app like Rom Manager or GooManager. I used the fastboot method as I was already in fastboot mode, might as well flash recovery straight away

Flowed from my Nexus 4
[Nexus 4 General] Tunderpimp:
I did that but when I rebooted into fastboot mode then went into recovery it just shows an android with a red explanation point

Sent from my SGH-T959V
[Nexus 4 General] chrone:
Are you sure you were typing "fastboot flash recovery cwm/twrp.img"?

Sent from my Nexus 4
[Nexus 4 General] El Daddy:
Read the "what is recovery" section in efrant's 101 guide. There lies your answer. http://xdaforums.com/showthread.php?t=2010338
[Nexus 4 General] Tunderpimp:
Thanks, I prefer to read the the guide so I have a better understanding.

Sent from my SGH-T959V
[Nexus 4 General] Tunderpimp:
Thanks for all of the information

Sent from my SGH-T959V
[Nexus 4 General] chrone:
you can rename to anything in the world, just don't change the .img extension. efrant's guide is to use customrecovery.img so that you can differentiate which is the stock recovery and which is the custom one. i used to rename the cwm to cwm.img and twrp to twrp.img.

the file explorer thing that you're experiencing, can you select another option for it to be allowed? and where is the path exactly? if it's inside "C:\Program Files" or so, the microsoft uac thing will sure pops up each time you tried to edit a file in there. put the platform tools (fastboot.exe, cwm.img, etc) on another partition such as D:\ and such.

edit:

seems you got it worked out. welcome to the club! :D
[Nexus 4 General] peste76:
Just a short question. I flashed a lot in the past (Desire HD & Galaxy Nexus) but before i do this on my Nexus 4 i have a short question. I´m on 4.2.2 and if i now unlock the bootloader (for flash CWM & get root) - do i have to flash all other things from the Stock Image too ? I think not cause i´m already on 4.2.2 or do i understand something wrong ? Thanks!
[Nexus 4 General] azrash:
You don't have too. Once you have unlocked the bootloader, you can proceed to flashing a custom recovery and root.

Remember to backup your apps + data via carbon by Koush or adb backup

And copy the files in the internal storage to the PC first. Unlocking the bootloader would wipe everything

Flowed from my Nexus 4
[Nexus 4 General] efrant:
No.
[Nexus 4 General] bLank-Mind:
first thing thank you for making great and easy tutorial to follow.. i search everywhere from google and finally landing on this thread..

i successed unlock bootloader, flash custom recovery and root the phone.. but the problem is my driver for MTP is gone.. i can not copy file through my computer.. the explorer for nexus 4 not show.. how could i install the driver for file transfer?
[Nexus 4 General] efrant:
Turn off USB Debugging and it will work fine (with your current driver).
[Nexus 4 General] kartik50:
I've done that, when I try and wipe cache it just reboots :S . I don't know whats going on, but when i try and flash customrecovery.img , it says its worked, but then it doesn't boot :(((
[Nexus 4 General] efrant:
Did you wipe data?
[Nexus 4 General] kartik50:
yep. im trying the other cwm now
[Nexus 4 General] androidofduty:
all in one tool kits are much easy for me to use, coz i m a noob:D
[Nexus 4 General] efrant:
http://xdaforums.com/showthread.php?t=1469909
[Nexus 4 General] El Daddy:
If you keep using Toolkits you'll always be a n00b.

Wouldn't you get more satisfaction learning how to do anything you wanted without the help of a Toolkit?

It's really not that difficult to learn basic ADB and Fastboot commands. After you do it a few times your won't even need to reference the commands. You'll know them and you'll be able to do things much quicker than any Toolkit can. Then, you can help, family, friends, and other n00bz on XDA learn as well. This is what XDA is all about.
[Nexus 4 General] Simer03:
THANK YOU!! finally....the only thing that has worked to restore my factory image!!

none of the toolkits worked in doing this! no more toolkits for me, ever!!
[Nexus 4 General] Zealotki11er:
Which step do i follow to restore phone 100% stock. I have it Rooted with CWM.
[Nexus 4 General] efrant:
You need to flash all the images and then re-lock the bootloader, so, do everything except skip part E.
[Nexus 4 General] joeski27:
So how might I go about setting up the image files via 7zip using a Mac??? Obviously an OS X version of 7zip does not exist...???

EDIT - Nevermind, Mac does it automatically just by opening the tgz file
[Nexus 4 General] MLPosey27:
So I'm in Section D, Step 9, and I don't have a "system.img" file. I double checked all the things I was supposed to download and I don't see one.

Stock phone, just took it out of the box.

Did I miss something?

EDIT: Found it. Had overlooked a .zip file.
[Nexus 4 General] KidCarter93:
I've just added this guide to the Nexus 4 Complete Index :)
[Nexus 4 General] joeski27:
So when one flashes the system.img, does it typically take a long long time for that command to finish running? Mine has been stuck at "sending 'system'..." for several minutes now. I mean I guess the system.img file is much larger than all the others, but just wondering if this was normal...?
[Nexus 4 General] efrant:
Not sure if "several minutes" is normal. A minute or so, yes. Is your USB cable plugged into a port at the back of your PC? Re-try.
[Nexus 4 General] joeski27:
Yup, sure is (on a mac actually). All other .img files flashed pretty quickly with no problems, but this one is giving me fits. Might just kill the fastboot session and try again with a freshly downloaded image packet...

---------- Post added at 11:23 PM ---------- Previous post was at 11:16 PM ----------

ok this is odd, noticed something - everytime I try to flash the system.img (fastboot-mac flash system system.img), the first time I try the command, it gives me "ERROR: usb_write failed with status e00002be FAILED (data transfer failure (No such file or directory))"....but then I try it again, exact same command, and it goes to "sending 'system' (531285 KB)..." just as though it was now running properly. Now obviously I have the "system.img" file right where it should be, in the same directory as everything else (adb, fastboot-mac, all of the other .img files, etc) so I have no idea what the issue is here.
[Nexus 4 General] efrant:
Kill the terminal session and open a new one, and then try again. You can always do this before as well: "fastboot-mac erase system" and then flash the system image.

Maybe try another USB cable as well.
[Nexus 4 General] joeski27:
Dammit I did the "erase system" prompt you suggested, and then tried to flash the system.img, but still wouldnt take, now I can reboot at all, stuck at the Google screen. Can't even get it to recognize while in fastboot so that I can try to flash again. Think Im seriously stuck here...

Check that - can see it in fastboot again, but still don't think I can flash the system.img. About to try flashing system.img using the usb cable that came with my Nexus 10 (other cable was the one that came with the Nexus 4)

---------- Post added at 11:47 PM ---------- Previous post was at 11:42 PM ----------

Nope, still can't flash the system.img. WTF is going on here??? Makes no sense whatsoever, as all other .img files flashed just fine

---------- Post added 30th November 2012 at 12:13 AM ---------- Previous post was 29th November 2012 at 11:47 PM ----------

Well no worries, I ended up just firing up a VMware (virtual Windows), then downloading and installing the N4 Toolkit, and and then successfully got the system.img to flash via that program. :cowboy:
[Nexus 4 General] quattro_rs:
i downloaded the wrong customrecovery.img and after i typed fastboot boot customrecovery.img my device was stock on google screen with the unlock symbol on the bottom !

after i realized it was the wrong .img i redownload the correct one and everything worked then i flashed SuperSU and rebooted and i have root now ...

do i need to flash a factory image because i pushed the wrong customrecovery.img the first time ?
[Nexus 4 General] efrant:
No need. You are all set.

When you use the "boot" command in fastboot, it doesn't write/push/flash/whatever anything to your device. All it does is it starts your device using the image by loading that image into your phone's RAM. Once you reboot it disappears (since RAM is volatile memory, as opposed to NAND flash memory, which is non-volatile).
[Nexus 4 General] tyea:
Here is a simple way to install a clean stock setup.

1. Download the factory image from Google and unzip it using WinZip or 7zip.

2. Copy those files to your platform-tools folder (see pic of all files dated 11/28 that I copied as an example)

3. Get the phone in boot loader status

4. In dos prompt command window go to the platform-tools directory.

5. Type the name of the batch file: flash-all.bat

6. Let it run and the phone will reboot when its done.

Occam, Tapatalk
[Nexus 4 General] bLank-Mind:
tried it.. not works too..:(

FYI i did'nt install usb driver twice as your mention on the tutorial.. could be that the problem?
[Nexus 4 General] efrant:
Not sure what happened. If you turn on USB Debugging and install the ADB driver, MTP should work once you turn USB Debugging off.
[Nexus 4 General] aa1401:
thanks a bunch man
[Nexus 4 General] Patrick2205:
Thanks for your work :) Helped so much :)
[Nexus 4 General] variety:
I feel like an idiot, but how do you do "7) Reboot your device into bootloader mode (by turning it off, hold volume down, and press and hold power) and plug it into your computer;" with clockworkmod installed?
[Nexus 4 General] chrone:
Power off your phone.

Hold down power button and volume at same time, wait till the android robot appears.

Press volume up or down to select recovery.

Press power button to give the selected options a go.

Profit. :)

Sent from my Nexus 4
[Nexus 4 General] efrant:
The bootloader screen is when you start with your device off, and then you hold volume down, and press and hold power. That's it.
[Nexus 4 General] Nexus4Owner:
Hey, guys. I have a problem. I rooted my cellphone and installed an incorrect ROM. And now I can't seem to be able to go into recovery mode, every time I try, all I see is the white logo. It appears that I'm running stock 4.2.2, though. Please help!
[Nexus 4 General] efrant:
Flash your recovery using fastboot as per the first post.
[Nexus 4 General] Nexus4Owner:
Thank you, I'm now using 4.2.2 rooted version. But recovery mode still doesn't work :(
[Nexus 4 General] Jean_85:
Are you using the toolkit or no?
[Nexus 4 General] efrant:
If you have the stock recovery installed, when you boot into recovery, you should see an Android with a red triangle and "!". THAT is the stock recovery. To access the menu from that screen, hold power and press volume up.
[Nexus 4 General] jark99:
ON 4.2.2, Is it okay if i use all the same files i used to flash recovery and root via adb? I had to send in my phone for repair and i have a feeling its going to come back with 4.2.2 on it!
[Nexus 4 General] efrant:
Yes.
[Nexus 4 General] Nexus4Owner:
I don't think I have the stock recovery installed because every time I try it, it sends me to a different screen with bootloader and recovery options that don't work.

The toolkit doesn't work, every time I try to do something, my cellphone doesn't respond.
[Nexus 4 General] efrant:
Re-flash the stock recovery as per the first post, i.e., flash only the recovery.img file. Skip flashing the other images.
[Nexus 4 General] thephantom:
[Hi efrant,

As discussed in private, here are some additional steps I took in flashing which didn't cause bootloops or change the storage size of my unit. I did check as well the post of El Daddy and it does have some similarities. A little bit of history is back in December I also got the bootloop when flashing back to stock which is easily remedied by going into recovery and also showed the 8gb storage instead of 16gb which is remedied by factory reset (happened to my N7 as well). I was playing around the other day and doing some tests and thought of modifying some steps. The results of which didn't give me any bootloop and i was able to retain the original storage size. As flashing the images would really overwrite what is currently installed, I find it redundant to use the fastboot erase option however it would seem to solve the issue, at least for me. If there are others who can test as well, it would be better.

fastboot erase system

fastboot flash system system.img

fastboot erase userdata

fastboot flash userdata userdata.img

fastboot erase boot

fastboot flash boot boot.img

fastboot erase recovery

fastboot flash recovery recovery.img

Then afterwards i did this:

fastboot erase cache

fastboot reboot-bootloader

fastboot reboot
[Nexus 4 General] f.us:
If I want to test another superuser app, should I uninstall the other one first?

Or is it possible to run both of them? If so, which app would grant permissions?

If I want to replace the old superuser app, what would be the way of doing so?c
[Nexus 4 General] efrant:
Short answer: You don't have to uninstall first.

Long answer: If, for example, you wanted to try Koush's app, and you currently have Chainfire's app installed, you can flash Koush's app in recovery and it will be the one to grant permissions. If you try to open Chainfire's app, it will ask you to update the binary -- if you don't, the app will close. If you do, Chainfire's app will be granting the permissions.
[Nexus 4 General] sorinpanduru2189:
Hello Everyone,

I tried to go back to stock using the method presented in the OP.

However, when i issue the fastboot flash system system.img command, my N4 gets stuck at 'writing 'system'...' phase..

I have no idea what to do next...

Please Help!

EDIT: the actual fastboot output:

C:\Users\Sorin\Desktop\n4\occam-jdq39>fastboot flash system system.img

erasing 'system'...

OKAY [ 0.540s]

sending 'system' (523357 KB)...

OKAY [ 32.746s]

writing 'system'...

Been like this for the past 15 minutes...

EDIT:

Managed to install latest CM10.1 nightly...

Still can't install stock!
[Nexus 4 General] efrant:
Not sure what could be causing that.

Did you try a different USB cable? A different USB port? A different computer? Did you flash the bootloader first (and reboot into the bootloader) before trying to flash the system image?
[Nexus 4 General] pauleandro:
Hi everybody.

What`s the difference between flashing cache or just erase cache? (I`m referring to the item “13” of the first post.

Tks all.