yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] J. Clarkson:
So, unroot the Nexus 4 phone using image from here https://developers.google.com/android/nexus/images#occam, lock the bootloader, then factory reset and it should all be as new?

Google Chrome, and Google Now will still be there right, I wouldn't have to install these separately?

Also, does anyone know why there is only 1 image for this phone? Usually you have many others for all networks, like T-Mobile UK ect..
[Nexus 4 General] chrone:
If you want to unroot, no need of using fastboot. Just do factory reset from stock rom settings or from the stock recovery. Assume you're not doing anything with the stock rom, stock boot/kernel, stock radio/baseband, and only root, doing the factory reset both soft or hard reset will reset your phone back to brand new one out of the box.

Use fastboot method to unlock the bootloader, flash factory image from google as posted on first post to reset your system back to brand new one as out of the box experience after using custom rom or so on.

It would better to know what are you trying to achieve here.

All of the default google apps will be there intact. You need to sign in on each app and set it again as per your preferences.

As far as i've known, nexus 4 image is managed by google and it has same specification except the storage differences.

Sent from my Nexus 4
[Nexus 4 General] J. Clarkson:
That's fine, sure let me explain.

I'm buying a Nexus 4 phone off someone, and he says 'A friend routed the phone for me to put apps on but I believe it can be easily unrooted'.

That is why I'm beginning to read up on what I can do, to revert this phone back to brand new state. If I can simply turn on the phone and go to settings and factory reset it and it will clear off what ever 'rooting' this person has done then I'll be very happy.
[Nexus 4 General] efrant:
Yes.

Correct, you would not have to install them separately. They would still be there.

The N4 is a Nexus device, and not carrier-branded, therefore only one stock image.

This is not correct. The root files will still be there after a factory reset, as they are stored in the /system folder, not in /data. A factory reset does not erase the /system folder. You either need to flash the system.img file using fastboot, or go in and manually delete the files.
[Nexus 4 General] spaceman860:
Doing a factory reset will not unroot the phone. You need to flash the system IMG so it can remove the su app and files

Sent from my Nexus 4

---------- Post added at 10:47 AM ---------- Previous post was at 10:44 AM ----------

The best thing to do is flash all the imgs so you know every thing is up to date

Sent from my Nexus 4
[Nexus 4 General] chrone:
thanks for correcting me. i've edited the wrong information i gave. sorry for the confusion [MENTION=5284628]J. Clarkson[/MENTION], it's been awhile not tweaking android, my level of knowledge degrades. :P
[Nexus 4 General] J. Clarkson:
Hmm, I think I'm better off following your guide and flashing all the IMGs included in the factory image (hopefully your guide explains this, and not just for the system.img) I haven't read it properly yet, waiting to get the phone in my hands then I'll start.

Yeah, that is what I will do.

PS: The initial thing I wanted when I heard I needed to unroot this phone was the safest way to unroot without bricking the phone as I previously owned an LG P500 and whilst upgrading to a version of Android then downgrading the phone got stuck in Emergency Mode for 3 hours and I removed the battery and now I can't switch on the phone (I've tried various button pressing combinations, can't get it to turn on).
[Nexus 4 General] efrant:
By following the procedure in the first post (aside from the optional "part E - root") you will be back to stock. If you want, you can re-lock the bootloader, but not really necessary, as it doesn't affect anything related to the Android OS.

As for a "safe" way to return to stock, you can't compare a Nexus device to a non-Nexus device. A Nexus device has an unlockable bootloader, which allows you to flash images directly to the partitions on your device using fastboot. As long as your device can power up to the bootloader, you can always recovery your phone. In 99% of the cases, the only thing that would brick an N4 is a bad bootloader flash (like if you pulled the battery while your N4 was in the process of flashing the bootloader. But even then, there are ways (although not straight-forward) to recover it. Pretty much everything else is safe.
[Nexus 4 General] J. Clarkson:
Great, you've given me a lot of hope lol, cheers mate!
[Nexus 4 General] vodred:
Just to know I left my phone in front of the computer that downloaded the official image though the toolkit for 3.5(!) hours because the toolkit failed to extract the one and only occam factory image from the google developers site
[Nexus 4 General] RussianCode:
I have been waiting for a good 5 Mins for the system to flash and very worried it froze on me. Anyone have any idea how long it might take?

Left it on the Whole last night. The phone is still on "Writing 'system'.
[Nexus 4 General] barryfivian:
AMAZING

So easy to follow.

THANKS!!!!!:good::good:
[Nexus 4 General] RussianCode:
I always get stuck here.
[Nexus 4 General] spaceman860:
Try a different USB port make sure the cable is connected properly. Extract the 4 imgs inside the zip (boot,recovery,system, userdata) and flash them separately.

From my BLACKED OUT N4

---------- Post added at 10:07 AM ---------- Previous post was at 09:44 AM ----------

Looks like your using a toolkit

From my BLACKED OUT N4
[Nexus 4 General] El Daddy:
That's not a toolkit. It's the flash-all script.
[Nexus 4 General] pspTP:
My phone has been overheating and I need to send it back to Google under warranty replacement. I have a new phone on the way and I have to send the current one in.

The current phone is rooted and has the Franco kernel and the .33 radio for LTE. Other than that it is stock. Do I simply follow the steps in the guide as is to get back to factory state and send the phone back?
[Nexus 4 General] spaceman860:
Yes. Don't forget to relock the bootloader

From my BLACKED OUT N4
[Nexus 4 General] RohanM:
Hello.

1) I have unlocked bootloader and rooted... Also tried few roms. But reverted to stock rom using a nandroid backup. So now I havestock rom with root and cmw. Do i still need to flash stock image ?? Or nandroid has already done it right ?

2) how to revert that recovery to stock?

3) if I kept bootloader unlocked that will not change anything major ? Like ota ?

Note.. U can bypass device wipe after unlocking boot loader... Just dnt reboot device and flash a recovery then wipe cache partition and then reboot. ;)

Credits for not losing data while unlocking goes to [MENTION=4883664]chromium96[/MENTION] :good:
[Nexus 4 General] chrone:
Quick answer:

1. It is stock if the nandroid is from stock rom too.

2. Fastboot flash recovery recovery.img

3. You will still get the ota.

Correct me if I'm wrong. :)

Sent from my Nexus 4
[Nexus 4 General] pafaisal:
Hi Efrant

I have extracted the .tgz file with winrar not with 7zip. and I have installed the stock rom. After this batter drain quickly. Is this because of I used winrar...?

Can you please clarify why you are recommending 7zip to extract...?

Thanks
[Nexus 4 General] thephantom:
Shouldn't be an issue. I also use winrar when I extract files. There must be a rogue app running in the background
[Nexus 4 General] EddyOS:
Absolutely no link between what you used to extract the images and bad battery life!
[Nexus 4 General] RohanM:
My query. I used arom but was not liking it so I restored nandroid backup of my stock.

So now my setup is like this. Root+cmw+stock 4.2.2 (nan restored)+ unlocked bootloader.

My questions is that so now I am only one step closer to be on full stock and that is stock recovery ?

Correct me if m wrong. If I now only flash stock recovery. Img then its ok? No need to flash other img mentioned in the op ??

I want to make sure that i get 4.3 which is around the corner now. 24th july announcement. :)
[Nexus 4 General] spaceman860:
If you just want to be able to receive and install the ota update you can have a custom recovery and root and it will be ok.

http://xdaforums.com/showthread.php?t=2145848

[INFO] Nexus OTA Help-Desk

There's a leaked 4.3 ROM that came out a few hours ago http://xdaforums.com/showthread.php?t=2368401

[ROM] [4.3] Android 4.3 for Mako (leak) rooted

From my BLACKED OUT N4
[Nexus 4 General] RohanM:
So i dont need to do anything now right?

So going full stock only if one wants to claim warranty ir for rma purposes. :rolleyes:
[Nexus 4 General] spaceman860:
Correct

From my BLACKED OUT N4
[Nexus 4 General] SaMi_InF:
My phone is break !!!

hi , i have a nexus 4

i was wipe all with the TWRP and when it finished i went to advanced and fill all blanks ( ticked ) and wipe again , then i reboot my phone to install the original ROM to my phone with the toolkit ( number 9 in program and ... )

when i rebooted my phone , it got braek !

please help me ... my screen is black and i cant see and do anything with my phone

i dont have any backup

please help me :crying:
[Nexus 4 General] efrant:
Ok, I see there are two problems here that contributed to your device not booting. Luckily, I have solutions for both.

Problem #1: You used a toolkit, and it messed up your phone. And now you have no clue how to restore it because you have been using a toolkit.

Solution: Stop using toolkits. They do not teach you anything, and when you do mess up your phone, you will not know what to do, just as in this case.

Problem #2: Your phone is messed up and you want to return it to original state, but instead of reading the first post of this thread and following the instructions, you post "please help me".

Solution: Read the first post completely, twice - to make sure you are familiar with it. Once you have done that, then you can proceed to follow the steps in that post, and if you have any issued, we would be happy to help you.
[Nexus 4 General] SaMi_InF:
Efrant i read the Post #1 and #2 in this thread but i can't do them and they don't help me .. because my phone's screen is black , and it does not show anything to me ! i can't go to fastboot , or cwm or anything ... I wiped everything off my phone.. i thought that i have to do this to install a rom .. but .. i was wrong

What can i do Efrant? :(
[Nexus 4 General] efrant:
So you are saying if you hold the volume down button and then press and hold the power button, your phone doesn't boot into the bootloader screen?
[Nexus 4 General] SaMi_InF:
Yes exactly.. my phone's screen doesn't show me anything ...

when i connect it with a usb cable , my pc play a sound it means my pc can know my phone , just know

and when i hold the volume down button and then press and hold the power button for a long , the LED color in bottom of phone get Red

nothing else ! what can i do ? :(
[Nexus 4 General] spicediablo:
Looks like a bricked phone?

Sent from Mako⁴
[Nexus 4 General] SaMi_InF:
Yes i think it's bricked ! what can i do ?! :(
[Nexus 4 General] undercover:
Take off back cover (easy), disconnect battery (easy). There was a whole thread in this somewhere with instructions.

“Power-lust is a weed that grows only in the vacant lots of an abandoned mind. ” ― Ayn Rand
[Nexus 4 General] SaMi_InF:
How can i disconnect the Nexus 4 battery ?!
[Nexus 4 General] efrant:
Try this.

Or if that doesn't work, try this.
[Nexus 4 General] faddyie:
Put ur phone on charging for like 20 to 30 mins then disconnect charger and try to go yo fastboot mode.

1. Put the power button and hold till it turns off.

2. Hold vloume down button and press power button to goto bootloader.
[Nexus 4 General] SaMi_InF:
It didn't work !
[Nexus 4 General] spicediablo:
Have u tried efrant suggestions?

Sent from Mako⁴
[Nexus 4 General] SaMi_InF:
I'm trying
[Nexus 4 General] LJGDY:
Can't relock bootloader!

I have followed the guide exactly but I am trying to relock the bootloader for return to google. I type in fastboot oem lock and then reboot it but the lock state changes back to unlocked.

What do I do?!

Thanks.
[Nexus 4 General] efrant:
That's bizarre. I've never seen that before. Don't know what to tell you.
[Nexus 4 General] bozzykid:
Did you flash the stock bootloader from the factory image? Make sure you restart the bootloader after you flash it.
[Nexus 4 General] Irthu:
urgent help!!!

i tried installing a system font from the rom toolbox and when it rebboted it wasnt booting up... i can switch on my device but it remains in the glowing (X) and doesnt load up... i tried a factory reset i didnt work... i dont have a custom recovery nor do i have a nandroid backup on my device. i have rooted it using wugfresh's toolkit.

i have been trying many methods over the day and nothing seems to work. i have dowloaded a stock image from google's site but its on my pc. some help pls!!!!

i have the drivers installed on my windows 8 . atleast they were wokring intially when i got the root done on it . i have no clue what to do now !!
[Nexus 4 General] faddyie:
Follow the op instructions in first post. Read carefully and now dont use toolkits until u know what u are doing. Its quite easy
[Nexus 4 General] Irthu:
i cant get the drivers installed. i cant switch debugging on ... what do i do? max i can do is get into the bootloader how can i then get the drivers installed? i tried the naked drivers.. i downloaded the zip and extracted the file... what do i after that exactly? its a bit confusing . i have downloaded the image.files etc.

BUT THE DRIVERS ARE NOT GETTING RECOGNISED!! I AM USING A WINDOWS 7 64 BIT...
[Nexus 4 General] Droid2drummer:
Dont feel bad. I wiped my internal memory yes the whole OS. While twrp updated the recovery I just ticked like usual and then quickly realized. Lol Now I have twrp no os and I'm getting twrp saying no root. I can access "boot loader" or start. Fast boot. I tried fixing with tool kit as well as I m lost. Been pretty good all these years and never would've done this intentionally. Any ideas? I'm guessing just maybe I can try this. But not sure. I thought I'd ask in case there was an executable zip to extract to desktop. Gos I miss my Sammy now via Odin the savior. Lol
[Nexus 4 General] faddyie:
I used this toolkit to install drivers: http://xdaforums.com/showthread.php?t=1995688

First read it carefully. Do till you install the drivers then follow the op instruction.

Follow the op instructions in the first post. Since you have got twrp, you should be having drivers on the pc. Be patient and follow the instructions. U can get back to the stock easily.
[Nexus 4 General] efrant:
Why are you try to switch on usb debugging? Does it say you need to do that in the first post?

To install the drivers, it is the same procedure as any other device you plug into your PC. Boot your phone into the bootloader and plug into your PC. Download the drivers and unzip them on your PC. Open up Device Manager. Find your phone in the list, right-click on it and click update driver. Then click on "let me choose" or something like that (not "automatically install driver") then click on "manually select driver from a list", then click on the "have disk" button, and point to where you downloaded the driver. Then select the bootloader/fastboot driver from the list.

Do not use a tool kit or an automated installer to install the driver because you will never learn how to install drivers yourself.
[Nexus 4 General] peoples_flip:
In my panic I failed to see that step... I did that and it resolved the "X" issue. Thanks a lot, I can breathe now. lol
[Nexus 4 General] Mohsin1:
thanks.......

you rock man....it took me more than 2 hours to do all the steps....but the result was sweet.....thanks again.....

:p

:fingers-crossed:

:cyclops::good::good::good::good::good::good:
[Nexus 4 General] cman6453:
I was having the same issue and am not exactly sure what I did differently but I got it to work on my Mac. What I did do was extract the files from the OCCAM .TGZ. Extracted the .ZIP file within the .TGZ file. Unzipped the toolkit that efrant posted and placed all the files in the unzipped folder for the toolkit. I re-flashed the system.img and it worked. Took 62.xx seconds to complete. Got thru the rest of the steps flawlessly. N4 is back to stock and will be headed back to T-Mobile. :(
[Nexus 4 General] Chochiwpg:
Hi efrant,

I am going to attempt to flash the factory image later tonight. I have already downloaded all the necessary files and I am ready to go. I just have a couple questions regarding the instructions in the OP.

After you flash the bootloader the instructions prompt us to reboot the bootloader. Then flash the radio and reboot the bootloader afterward as well. Then it instructs us to flash the system, userdata, boot, and recovery partitions. But it does not mention to reboot the bootloader after flashing each one. Is it recommended to flash system, reboot, flash userdata reboot etc etc? Or is it not necessary to reboot the bootloader when flashing system, userdata, boot and recovery?

Thanks, just want to be thorough and make sure I do it correctly.
[Nexus 4 General] efrant:
Unnecessary to reboot into the bootloader after flashing those images. Only after flashing the bootloader and Radio.
[Nexus 4 General] noobdeagle:
Can someone explain to me why all the guides on how to flash the stock images use the most convoluted and complicated way ?, Google supply a 'flash-all.bat' that does the whole process for you. :confused:
[Nexus 4 General] Chochiwpg:
Thanks, I will give this a try when I get home and if I have any issues I will let you know. I really enjoy these tutorials because I would much rather learn and do it long hand than using a toolkit. I respect the devs that create the toolkits to help us out and make things easier, but I want to learn something along the way and this helps greatly. Thank you.
[Nexus 4 General] efrant:
Sure, I can explain (although I answered this twice already).

Yes, executing the "flash-all" script certainly works. However, I think you missed the point of this thread as stated in the first post:

I do not advocate using pre-made scripts until someone understands what those scripts are doing. If you fully understand, then perfect, use the script. If you don't understand, then if you use it, you remain ignorant and unable to troubleshoot your own issues. What is important is understanding the journey.
[Nexus 4 General] Chochiwpg:
One last question efrant before I give this a try:

As per the OP

Notes:

1) Yes, you will receive the OTA update notification (when it is available) for the next update.

Just want to make sure, as long as I have the stock bootloader, radio, system, userdata, boot and recovery I am safe to root and still receive OTA updates? I assume that is the case, but just want to be 100% sure.

Thanks
[Nexus 4 General] Zealotki11er:
I did all the steps. I am getting stuck @ X screen. Over 30 mins. did the same thing with my Galaxy Nexus and had not problems. What would you recommend i do?

Edit: I am going to have to learn read before posting.
[Nexus 4 General] Chochiwpg:
Man you are a savoir, the exact same thing happened to me and this was the only thing that allowed me to get past the X logo. Very odd indeed.

Seems to be working now, back to good old stock. Peace.
[Nexus 4 General] undercover:
efrant, wouldn't fastboot flash zip image-occam-jop40d.zip do essentially the same job?
[Nexus 4 General] cue_32:
Worked perfectly... the only thing that confused me was the part where you already at the Stock Recovery mode (Android with red exclamation) and you have to press the Vol+up button to activate the options. After wiping cache and data, all is well.

Thanks
[Nexus 4 General] schemeKC:
The flash-all.bat in the zip/tgz will accomplish the same thing (won't re-lock the bootloader, of course), but if I'm not mistaken efrant's purpose with this thread is to try to help explain why everything works like it does so people have a greater understanding of their tech. If you already know what it all does then using the bat accomplishes the same thing.
[Nexus 4 General] undercover:
Thanks. Yes that makes sense. Since I'm more into troubleshooting I always think of the easiest way to explain how to FIX it :)

I even missed the bat (I was only looking for system.img. :D

" One day your life will flash before your eyes. Make sure its worth watching "
[Nexus 4 General] efrant:
It's exactly as schemKC stated. It works fine, but: http://xdaforums.com/showpost.php?p=35053402&postcount=87
[Nexus 4 General] undercover:
Yup, i overlooked that as explained above. We used to troubleshoot sensation in irc for people in trouble, so you want to recover it quickest way possible and then divert users to read up. Your approach is a lot more sensible in this case. :)
[Nexus 4 General] drdingo21:
Had a custom Rom on my nexus and used this guide to get back to stock (thanks!)

But now everything sees my 16 gig nexus 4 as the 8 gig (windows and settings ->Storage) show I only have ~5 gig free. Before the custom ROM and coming back to the stock rom I had the full ~12 gig free.

Whats the deal?
[Nexus 4 General] efrant:
Did you do step D6 right after doing D5?
[Nexus 4 General] faddyie:
+1
[Nexus 4 General] Federico_96:
Hi [MENTION=1566190]efrant[/MENTION] I don't know if this is the right place to ask but i hope so.

I manually unlocked my n4 bootloader and manually installed twrp, and before flashing a custom rom i made a nandroid backup of my stock 4.2.2 ( not rooted) rom.I'm using sabermod now and as you know OTA update is coming next week, and i have some questions for you.

According to this thread if i restore my nandroid backup i will meet the criteria and my OTA will complete, from what i can understand, even if i haven't a stock recovery, is this right?

Restoring a backup will completely made my device stock ( except for unlocked bootloader and twrp recovery obiuvsly) or could remain some traces of my custom rom in my device that will compromise OTA update ?

Should i follow your guide to return completey stock or my OTA update will install just fine ?
[Nexus 4 General] RohanM:
Hello. Where can I get stock recovery for this indian ver ??
[Nexus 4 General] PhantomGamers:
the nexus 4 is the same wherever you get it so the files in the OP will be relevant to you
[Nexus 4 General] RohanM:
But I have JDQ39E not JDQ39 !! :confused:
[Nexus 4 General] PhantomGamers:
hm are you trying to reset it to stock to return it? the JDQ39 recovery should work fine on JDQ39E
[Nexus 4 General] RohanM:
Actually yes gonna restore to stock. but just to get 4.3 OTA :)

How abt this ?

http://xdaforums.com/showthread.php?t=2298470
[Nexus 4 General] efrant:
If you restore your backup, you'll be able to flash the OTA zip in TWRP, but you will need to reboot into TWRP and flash it. It won't automatically install if you try to do it from the update screen.
[Nexus 4 General] RohanM:
As per some people OTA has nothing to do with what recovery u are using... I have same situation just replace TWRP with CWM & nandroid of DQ39E [ root ] !!

http://xdaforums.com/showthread.php?t=2298470&page=5

Comment no #46
[Nexus 4 General] efrant:
Not sure what you are trying to say, but what I said holds true: if you are running a stock ROM and a custom recovery, you can still install the OTA update, it's just that you will need to boot into the custom recovery to install it - you cannot install it from inside android like you would be able to with the stock recovery.
[Nexus 4 General] spaceman860:
If you have twrp and you get the ota notification you can just click on it and it will reboot into recovery and install the ota zip. I did this on the last ota we got.

The only thing about doing it this way is that it won't give you the chance to flash the su zip after and you'll lose su and recovery. I'm not sure if this is still true since twrp now checks to see if the ROM has root

From my BLACKED OUT N4
[Nexus 4 General] Federico_96:
Thank you that's what i wanted to know :good: