yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] Austin Ag06:
Thanks efrant and undercover... I tried a second USB cable and almost every port on my PC...I'll try restarting everything a few times and see if it helps.

---------- Post added at 07:47 PM ---------- Previous post was at 07:22 PM ----------

I tried rebooting the phone as well as my VM and pc and still no luck. I also tried several different ports after phone reboots. Maybe I'll see if i can pick up a new usb cable tomorrow.
[Nexus 4 General] undercover:
No, I don't think it's usb cable, although it's worth a try. Make sure usb ports are direct, not via hub. At this stage I guess you have to reinstall drivers just in case, toolkits are the easiest and best option (I couldn't do it manually for some reason).

Edit. Oh, and the best option to make sure your path is correct is to open the folder containing adb and fastboot, hold shift (if doesn't work try right shift) , right click and "open terminal window" or something like that.

Also, make sure you have adb, fastboot and all needed dll's in that folder along with images.
[Nexus 4 General] chachin:
Couldsomeone get me a .tot for the nexus 4 16GB?
[Nexus 4 General] efrant:
VM? Why are you using a VM? It should work directly on Windows, Linux, and MacOS.
[Nexus 4 General] efrant:
In case the OP causes confusion for anyone, you don't actually need adb.exe to follow this procedure. (And the dll's are for adb, not fastboot -- fastboot.exe is a stand alone file.) I just included in case people need them for other things.
[Nexus 4 General] undercover:
Thanks. I avoid going into that much detail since that creates more problems than needed. adb reboot bootloader will need adb and dll's so when that fails people will come asking for solutions and 9/10 times you won't even think of asking about it since you'd assume they have it (just one of the examples) . :)
[Nexus 4 General] monkeying. around:
In the NOTES section, in red, you said radio twice. Is that correct? ( my bad about spelling)

So what is the difference between:

-unlock, flash cwm and root.

-unlock flash radio + other things in step c and d. Then root.

Sorry for my ignorance just trying to learn
[Nexus 4 General] efrant:
Sorry, typo. I'll fix it.

The other stuff is to return your device to stock. It's for those that have flashed custom roms/kernels etc and want to return to stock.
[Nexus 4 General] monkeying. around:
OK thanks. Now I get it.

Regarding the updates, if I am unlocked and have root access with no other changes, I can successfully install the update correct?

Only thing I will lose is root access?
[Nexus 4 General] Austin Ag06:
I tried for the life of me to install the correct drivers on my Windows 7 pc with no luck. Then I remembered that I had the same issues when I was trying to unlock and root my Captivate a few years ago. However, at that time I had admin ts on my work laptop and was able to install everything correctly on my work computer. So I thought it was worth a try to use xp on a vm to install the correct drivers.
[Nexus 4 General] efrant:
Yes and yes.

Well, that may be your problem. You'll need to try and get the drivers installed on your PC. PM me and we can do it over Teamviewer if you are having issues.
[Nexus 4 General] mojo22:
Ok i've officially bricked my phone!

5) Open a command prompt in the directory mentioned above and type: fastboot boot customrecovery.img

This didn't work for me - was giving me a error message - so I tried this

./fastboot-mac flash recovery customrecovery.img

and it said OK.

After I tried to boot into Recovery mode and it got stuck at the Google logo.

Then I went back to fastboot mode and cleared cache. Then It got stuck at a logo with an android laying down with a red exclamation mark.

Then I re flashed and cleared cache. Now Im ****ed :)

Its stuck at google logo.

Any help much appreciated
[Nexus 4 General] ferchope:
i flashed twrp using fastboot.then i used the new recovery to flash supersu.but now when i try to install a new app says i dont have enough room.I had more than 11 gb available before
[Nexus 4 General] El Daddy:
When you see the android laying down that means you are in stock recovery. Press volume up and power to open the menu. Then factory reset and clear cache from there. You should be up and running after that.
[Nexus 4 General] mojo22:
Thanks I tried to press UP only and nothing happened. So I went back to the terminal and cleared cache again etc.

Problem now is I can't get to that screen where the android dude is laying down with the exclamation mark!

How do I get there? Its constantly booting into Google logo.
[Nexus 4 General] El Daddy:
Boot into the bootloader. Then use the volume key to toggle to reboot recovery.
[Nexus 4 General] mojo22:
Yip that is what I done.

I toggle down to Reboot recovery and then it gets stuck on the Google Logo.

And I can't do anything
[Nexus 4 General] El Daddy:
Can you flash the stock recovery from the bootloader?

fastboot flash recovery recovery.img
[Nexus 4 General] undercover:
Hold on. No need to reflash anything. Factory reset from recovery.

In bootloader go to recovery. Once you see broken DROID hold power and tap + vol. Then factory reset.
[Nexus 4 General] trueblueram:
@efrant - I think the part of the op where u r talking about the x boot loop should be highlighted in red.
[Nexus 4 General] El Daddy:
He can't get to recovery.
[Nexus 4 General] efrant:
Done.
[Nexus 4 General] mojo22:
Is this on my phone?

Because I am just downloading the factory nexus .img file now. Its taking ages @ 18kb/sec! Still have to wait another 2 hours

I wish I could get there!

I got there once but now I can't get there again.

I'm between:

./fastboot-mac flash recovery customrecovery.img

and clearing cache.

What to do now!?

Stuck on Google logo when I go into bootloader and select recovery. - ALSO stuck in google logo if phone boots normally

EDIT: I did backup my phone and have a backup.ab file in my platform tools. Can they help?
[Nexus 4 General] Austin Ag06:
Still no luck on my end...PM sent
[Nexus 4 General] undercover:
Oh, I missed that, sorry. That will only work from stock recovery. As I understand he's got custom?
[Nexus 4 General] El Daddy:
Yeah he flashed a customs recovery and got stuck at the Google logo. Usually that's kernel related right? Not positive.

He tried booting in the bootloader and getting the recovery that way but is stuck in the same spot. I'm guessing a reflash of the stock images or at least stock recovery would fix the problem.
[Nexus 4 General] mojo22:
Nope I am on stock rom.

This is what I done:

1. Back-up phone

2. Unlocked boot loader

3. Downloaded CWM.img to computer

4. Downloaded SU.zip to phone

5. tried to " fastboot boot customrecovery.img " but I kept getting an error msg ' -bash: ./fastboot: cannot execute binary file ' even though I chmod 755 * in the platform tools directory.

6. Then I tried " ./fastboot-mac flash recovery customrecovery.img " and get the message OK

from bootloader I went to recovery and got stuck at Google logo. Then I went back to bootloader and cleared cache. Got to the android lying down with exclamation mark and hit the UP volume ( without power cause I didn't know ) and nothing happened.

Then I went back and forth trying to flash customrecovery.img

I renamed it back to its oringinal name and flashed that but nothing.

Now I am stuck.
[Nexus 4 General] efrant:
Download the factory image, extract the recovery.img file from within, and flash it: ./fastboot-mac flash recovery recovery.img

Then boot into recovery. You should see the Android with the red /!\. Wipe cache. Reboot.
[Nexus 4 General] mojo22:
Can you please upload that somewhere so I can download it?

I am downloading the factory img files and they are 327mb @ 18kb/sec is going to take another 2 hours.
[Nexus 4 General] efrant:
Go to the General section for the N4 and click on the paperclip beside the name of this thread. That will pull up a list of attachments. I've already uploaded the stock recovery in an earlier post.
[Nexus 4 General] mojo22:
these are the files that I can download.

platform-tools-v16.zip	1.75 MB	1564

cwm-recovery-occam-JOP40D.zip	6.62 MB	12

cwm-boot-occam-JOP40D.zip

Doesn't look like there is a stock recovery in there ? Clockwordmod - recovery which is the on I already have.

I don't understand why this happened. It should of work. Is there a way to dig myself out of this still using the CWM.img ?

EDIT!:::!! Downloaded cwm-recovery and found recovery.img inside will flash now brb

---------- Post added at 06:42 PM ---------- Previous post was at 06:33 PM ----------

This worked!

Thanks a bunch :highfive:

Now I am booted into android OS but I do not know what I have flashed and not flashed on my phone.

What is the best way to recover from this?

The problem is that when I downloaded recovery-clockwork-6.0.2.3-mako.img I changed name to customrecovery.img then flashed that then I changed again to recovery-clockwork-6.0.2.3-mako.img then flashed that.

Cheers again!

Much appreciated
[Nexus 4 General] efrant:
Recover from what? You are all stock.
[Nexus 4 General] mojo22:
Flashing recovery.img and clearing cache actually removed whatever I flashed before?

This is where I am at now ( still trying to install CWM and SU ) :
[Nexus 4 General] efrant:
Yes.

Looks like you need to re-download CWM. Image is corrupt.
[Nexus 4 General] El Daddy:
It seems like you are trying to boot the kernel and not recovery. Make sure you rename the right file.
[Nexus 4 General] mojo22:
Yip you were right!

Thanks I am up and running now.

I don't quite understand what you mean?

I've just setup my phone now and didn't use my backup. Is there anyway to explore the backup.db file to extract some files?
[Nexus 4 General] efrant:
Maybe. Ask here.
[Nexus 4 General] mojo22:
That will run the backup.ab to my phone. I'm looking to extract it on pc and get what I want from it.

Thanks though.

This thread seems to do the job.
[Nexus 4 General] monkeying. around:
Thanks efrant now rooted, booted and ready for action!
[Nexus 4 General] suheric:
I'm stucked on the last rooting part.

I downloaded cm-10.1-20130125-NIGHTLY-mako.zip file and changed it to customrecovery.img

also I downloaded Supersu into my phone.

But on the command prompt, when I type in fastboot boot customrecovery.img

it says 'booting...' and it doesnt go anywhere.

Now I left it for 15min but still no change. I tried to press volume button to go on to the recovery mode but no change.

Is booting takes that long? or am I doing wrong.

I'll really appreciate any advice.
[Nexus 4 General] 3rdstring:
cm-10.1-20130125-NIGHTLY-mako.zip is a ROM, not a recovery image.
[Nexus 4 General] trueblueram:
Try n get to boot loader(hold power+volume down. If u r able to follow the steps in the op to the t. You should end up with everything stock. After this keep phone aside, read up on modding.
[Nexus 4 General] suheric:
1) Download (to your computer) the latest version of CWM (from here) or TWRP (from here) for your device;

2) Rename the file to customrecovery.img, and make sure it is in the same directory as your fastboot.exe file;

Then which file do I need to rename on step 2?

Thanks in advance.
[Nexus 4 General] El Daddy:
Whichever recovery you decide to download from step 1.
[Nexus 4 General] suheric:
I downloaded cm-10.1-20130125-nightly-mako.zip and after extraction, I only see boot.img file.

Is this the file I need to rename?

Sorry for being noob but all I can do is following the detailed steps.
[Nexus 4 General] El Daddy:
That's not recovery. That is a ROM.

efrant hyperlinked both clockwork recovery and twrp recovery in step one. Choose the one you'd like to run. Download it and rename it.
[Nexus 4 General] 3rdstring:
You need to look under the recovery or touch recovery columns, NOT the ROM colum
[Nexus 4 General] suheric:
Thanks you guys.

It is very embarrasing, but the phone is rooted and I'm happy.

Thank you very much for your patience.
[Nexus 4 General] urcindalo:
From within Linux?

I will be a complete Android n00b in the near future when I can order my Nexus 4 :) (currently an iPhone 3G user)

However, I'm a long-time Gentoo Linux user. Is it possible to follow the guide from within a Linux environment? In case yes, how?

Thanks in advance.

Addendum:

I just found "dev-android/fastboot" as a package for Gentoo Linux in the GPO dot ZUGAINA dot ORG site (I can't post URL's yet :().

Will it be enough to follow the guide without booting into Windows? I guess so, but, any experiences?
[Nexus 4 General] cdon2109:
This tool really helped me when I stupidly wipe the ROM using the twp recovery. Very easy to use. I had to manually download the factory image since Google removed it from their server.
[Nexus 4 General] efrant:
I've included fastboot complied for Linux in the attachment in the first post. This procedure will work fine in Linux. Just make sure you put the "./" in front of fastboot, i.e., usee ./fastboot

And yeah, no drivers necessary for Linux.
[Nexus 4 General] trueblueram:
Did u get your order in?
[Nexus 4 General] urcindalo:
Nope :( I've been waiting for too long to be able to do that (I live in Spain).

Hopefully I'll be able to do so very soon :fingers-crossed:

---------- Post added at 07:49 PM ---------- Previous post was at 07:41 PM ----------

Thanks very much :)

I hope you compiled it statically just in case I have some missing libraries.
[Nexus 4 General] efrant:
Yes, it is statically compiled, although it was Google who compiled it, not me. :)
[Nexus 4 General] knsitu:
I unlocked the bootloader, flashed CWM recovery, superSu apk and Busybox

If i want to return my nexus 4 to the SAT to replace it, making a full wipe factory reset, flashing stock recovery and locking the bootloader will be enough?

Root files, supersu and busybox remain with a Factory reset? I didn't change the rom is the stock rom.

Thank you
[Nexus 4 General] efrant:
A factory reset will not remove root files or busybox or any other files that you put in /system. A factory reset only deletes the data in the userdata partition, not in the system partition.
[Nexus 4 General] dcarpenter85:
Followed the guide to unlock and root my phone, worked perfectly. Thanks.
[Nexus 4 General] knsitu:
I flashed the stock image from the toolkit to return it to the sat but I'm from Spain and I remember when I first start my nexus was in Spanish, now when you first start or make a factory reset it's in English. That could be a problem to give it to the sat for a replacement?
[Nexus 4 General] tweaked:
efrant, thank you. This guide is dead on. Helped me reinstal back to stock. You sir; are the man.
[Nexus 4 General] dongyun:
Wow! Awesome!
[Nexus 4 General] efrant:
I doubt it would b ea problem.
[Nexus 4 General] vineet381:
Hi,

I followed everything in Step D and I am stuck at logo X

When in recovery, I do not see any option to wipe factory data, I only see android symbol with red exclamation sign.

Please advise how to go pass through the logo
[Nexus 4 General] efrant:
The android with the red exclamation is the main screen of the stock recovery. To access the menu from that screen, hold the power button and press volume up.
[Nexus 4 General] vineet381:
nothing, I came to red exclaimation screen by volume up + volume down + power, then selected recovery from volume up and then hit power to enter recovery, now when i press vloume up + power, nothing happens :(
[Nexus 4 General] efrant:
You are NOT supposed to press volume up + power.

You are supposed to hold the power button and THEN press volume up.
[Nexus 4 General] vineet381:
Okay, at what point do I release the buttons? When I hold the power button and press vloume, i feel a jerk, screen reboots with "Google", I release the buttons and then after 1 minutes, I am on the X logo screen..
[Nexus 4 General] efrant:
Ok, maybe I am not being clear.

You don't hold both of the buttons down. When you see the android with the red exclamation, you press and hold power and then immediately after, press and release volume up, and then release power.
[Nexus 4 General] vineet381:
You're a life saver! Thank you so much dude!
[Nexus 4 General] 918273645ams:
Do you need to unlock the bootloader to root? seems much more confusing :\
[Nexus 4 General] efrant:
Much more confusing that what?

The Nexus 4 is running Android 4.2. There is no exploit yet to root 4.2, so the only way to do it is with an unlocked bootloader.
[Nexus 4 General] knsitu:
I think it's all ok.

How it must look the Stock recovery? When I enter recovery to check if CMW recovery was erased properly an image with an Android bot lied down appears with the belly opened and a weird red triangle with an exclamation inside on his belly. It gets stuck there and I had to hard reset the nexus 4. Is it ok?

When the rom started it started fine.

All works fine.
[Nexus 4 General] efrant:
The "Android bot lied down appears with the belly opened and a weird red symbol on his belly" IS the stock recovery. That is the way it is supposed to look. To access the menu, hold power and press volume up.
[Nexus 4 General] kartik50:
Slight problem - I unlocked the bootloader successfully, and I flashed a custom recovery - but now it won't boot. Its been stuck on the Google (with the little unlocked bootloader symbol) for about 5 minutes now, should I be worried? Is this normal?

Thankx
[Nexus 4 General] efrant:
Not normal, but you shouldn't be worried. So if I understand correctly, you followed this guide unlock the bootloader, and then all you did was flash CWM? And then you rebooted? It seems very strange that you would get stick at the splash screen just by doing that. Boot into your recovery and wipe data and cache, and then reboot.
[Nexus 4 General] w1ndhawk:
I will uninstall the Samsung USB Drivers that I had used for unlocking+rooting my phone. But, can someone please explain to me the part in bold. Should I be installing the driver twice: once in bootloader mode and once when it is normally booted? Am I missing something here.

Further, my device is already CWM flashed + unlocked + rooted. Does anything in this guide change for me or should I follow it to the dot? (Basically trying to improve battery life: http://xdaforums.com/showthread.php?t=2107163 )

Any help will be appreciated :good:

PS: Generally I don't ask stupid questions but this is my first android device, so forgive me.
[Nexus 4 General] efrant:
If you're computer recognizes your phone in fastboot mode, then don't worry about uninstalling/installing drivers. Just skip the driver part and do everything else.
[Nexus 4 General] m4r0v3r:
so I got lazy as and understood what the commands did and just double clicked on the flash all bat, and it went perfectly till it got stuck at the X but I deleted the cache and user data and it worked a treat. two questions

why does it break?

and can I just add the erase cache and erase userdata command to the bat file for future?
[Nexus 4 General] efrant:
We haven't quite figured it out yet, but it seems that the "fastboot erase cache" command doesn't perform as expected.

No, it won't help by adding "fastboot erase cache" to the batch file, as it is already there -- the "-w" flag in the "fastboot update" command wipes data and cache already.

The only way I've seen so far to get around this is to boot into recovery and wipe cache from there.
[Nexus 4 General] w1ndhawk:
Completed step 15 and went past the Google Logo but stuck on the X Logo.

Wondering: is it building dalvik cache or is it stuck? (I've been waiting for the past 10 mins)
[Nexus 4 General] undercover:
Erase cache from recovery. If it doesn't help, do factory reset.
[Nexus 4 General] w1ndhawk:
Yes, that's what I did and it booted. Was just being cautious because I didn't want to interrupt if it was building dalvik cache.

EDIT:

I just tried booting into recovery and the red exclamation robot is still coming. Should I reflash CWM?

EDIT2:

Oh ofcourse, I read your rooting step now. Ignore above question.

EDIT3:

Done! Lets hope my battery life improves (as has been experienced by a few other members of this forum)

Special thanks to you effrant for guiding me and especially making this guide so noob-friendly.

EDIT4:

All software working fine. However, I am getting a mind flicker on the screen. Any suggestions?

EDIT5:

Flicker gone now! WTFAX!
[Nexus 4 General] gandharv.aiims:
@ efrant

Thanks for your guide... really nice work to help people understand the entire process of flashing

I have recently moved over to android platform from iOS so was just doing my homework to graduate above noob level.

I had a security ques/concern in case a phone is stolen (as my last one was and thats why i am more paranoid about it)

Your guide tells me (and it works pretty perfectly) that in order to re-flash a stock or even a custom ROM all that is needed is to unlock the bootloader, boot CWM without flashing it and then you can go ahead flashing all that you want. And since we are using fastboot commands here, enabling or disabling USB debugging makes no difference.

Now if I have an anti theft app installed (as system app) say avast with USB debugging turned off and an active lock screen that wont deter anything in case the thief is even as learned as I am. Flashing the system will kill all device tracking apps

Moreover since I have bought the phone from Play Store unlocking the bootloader doesnt wipe my /sdcard although all the account settings etc are gone. Thus even the data on /sdcard is not safe.

All that I want to ask is if there is a method that you might know of to prevent unauthorized fastbboot access onto the device. I guess I can live with a rooted N4 with locked bootloader and stock recovery in this case.
[Nexus 4 General] efrant:
If you want your data on your device to be completely secure, you will need to turn on encryption in the settings.

Otherwise, you can ensure you have ALL of the following, and it will make things difficult for anyone to get a hold of your data:

1) Locked bootloader;

2) Stock (or other secure) boot image (i.e., ro.secure needs to be set to 1);

3) Stock recovery;

4) USB debugging turned off;

5) Lock screen password.
[Nexus 4 General] gandharv.aiims:
By your reply i am guessing there is now way to prevent fastboot access as such. In that case does having CWM or stock recovery make any real difference or is just that the one will have to go through the hassle of downloading the CWM for N4 to flash. Besides I was reading in this thread that flash_all.bat allows flashing even with stock recovery
[Nexus 4 General] efrant:
Relocking the bootloader does prevent fastboot access. But that alone does not make your device secure. If you have a looked bootloader but, for example, you have already CWM flashed, all someone has to do is boot into CWM, and all your data is available to them - no fastboot access needed. That is why if you don't enable encryption, you need to make sure you hit all the five points I mentioned above.

EDIT: To add to that, there are some low-level tools that can still pull off data from your device even with all the five items I mentioned above done. That is why, if you want your data to be secure, you need to enable encryption.

EDIT2: And your comment about the flash_all script is misleading -- it won't work with a locked bootloader.
[Nexus 4 General] w1ndhawk:
@efrant

I want to thank you for this guide.

I followed your guide last night and I can see battery life improvement in my device.
[Nexus 4 General] vickysud:
can anyone give me download link for stock JOP40D ROM, kernel/ramdisk, radio and recovery.
[Nexus 4 General] thephantom:
Page 1. C-3
[Nexus 4 General] efrant:
If you are referring to a CWM-flashable version, I haven't finished it yet, and I'm on vacation for the next couple of weeks. Besides, you shouldn't need it unless your usb port is not working.
[Nexus 4 General] cobyman7035:
I'm on stock rom plus r53 franco. Do I just flash stock zip file to get back easy as pie?

via my NeXus⁴ using XDA Premium
[Nexus 4 General] chrone:
Since you're on stock rom and only using custom kernel then i assume you're safe to flash only the boot image as posted on first post.

Might need to flash recovery image too if you want it all stock.

Sent from my Nexus 4