yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] floepie:
Erfant, I seem to be having problems with the "erase cache" function of fastboot. Going from stock, I flashed a kernel. Typically, I erase cache before and after flashing the boot with a kernel. However, when I boot the phone, it gets stuck on the boot animation. However, when I reboot into the custom recovery (TWRP) and perform a "wipe cache", all is well again. I've tried this three times, going back and forth between the stock kernel and the custom kernel. Both kernels work just fine, but each time requires that I go into the recovery and wipe the cache from recovery. Wiping the cache from fastboot results in the stuck boot animation, so apparently it's not wiping the cache. Everything else is stock.

Any ideas as to why this could be happening? This happens with a fastboot version I used previously with the One X as well as a newer fastboot version from the toolkit.
[Nexus 4 General] El Daddy:
Flash stock recovery. Boot into recovery. Press volume up and power to open the menu. Clear cache and factory reset.
[Nexus 4 General] floepie:
Thanks. You mean this is a known "problem" insofar as the above is the remedy for this? I say "problem" because it's only mildly inconvenient. And, I don't think I want to go through the hassle of a full wipe. The inconvenience is only that "fastboot erase cache" seems to be broken.
[Nexus 4 General] efrant:
Yeah, it seems to be the case. I've noticed it as well. You need to wipe cache from recovery (custom or stock) for it to actually work. Not sure why it's like this on the N4.
[Nexus 4 General] floepie:
OK, but are there any instances where it does work? Because I see that you still have the fastboot erase cache command written in the guide.
[Nexus 4 General] efrant:
Yeah, I will revise it at some point. Thanks for reminding me.

When it became apparent that it was causing issues, I added the note about booting into recovery and wiping cache from there, but had not changed the original steps.
[Nexus 4 General] mrallen81:
i dont know why but fastboot dont seem to be working on my pc, ive installed all drivers

im just hitting a wall :confused:
[Nexus 4 General] GunninZombiesdown:
Good call, forgot to put it in fastboot. I tried it earlier today and the phone seemed to have discharged the battery entirely. So I charged it and the LED lit up red immediately. I then unplugged it and plugged it in a few more times and it did the same thing every time... and wont turn on after it sitting there for hours. So its not holding a charge, and now its not charging (using stock charger/cable and others). ****!
[Nexus 4 General] efrant:
If you want help, you need to provide more details on what you did so far, errors you are seeing, etc.

Ok, let's keep trying here. First of all, a few things:

1) The N4 will not charge the batter when in fastboot mode, i.e., when booted into the bootloader.

2) Make sure the device is OFF, and leave it plugged into the wall outlet overnight.

3) Take it off the wall charger, hold volume down and then press power. This should get you into the bootloader.

4) Now that you are in fastboot mode, plug into your computer and let me know what you see in device manager, i.e., what pops up and if it installs/recognized anything.
[Nexus 4 General] GunninZombiesdown:
See here's the kicker though, its been plugged in for hours now and is still completely unresponsive. No matter how long I hold on the power button, nothing seems to happen. Do you think leaving it plugged in overnight will make a difference?
[Nexus 4 General] efrant:
I'm not sure. It needs to be off to charge.

If it doesn't work, I guess the only thing left to do is RMA... :(
[Nexus 4 General] GunninZombiesdown:
Yep, thats what I was thinking. I just tried holding the power button while it was charging for over 2 minutes, no dice. The only thing it does now is the little red light comes on. Which leads me to believe that something went wrong with the battery from the beginning (The battery drained itself over the period of 1 hour with everything off, battery page said Android OS. When I got home, I charged it for 8 hours and only got to 15% without any apps or anything else running and the CPU turned the whole way down).

So I guess here's my last question then- How should I do the RMA? The earpiece has the buzzing (but not when there isn't any juice, so they'll have to plug it in to test it and discover its rooted). Do you think theres anyway around getting burned for this one?
[Nexus 4 General] efrant:
I doubt you'll have a problem. Just tell them that you were having battery problems and now it won't turn on.
[Nexus 4 General] GunninZombiesdown:
Pretty good advise, thanks for all the help man, really appreciate it!
[Nexus 4 General] floepie:
Just out of curiosity, a couple questions for anyone in the know:

1. Why doesn't big G offer RUU executables for the Nexus devices? Sure would make life a lot easier.

2. Is it possible to wipe the cache partition only (not data) from the stock recovery, seeing as how the fastboot method doesn't work on the Nexus 4?

Thanks....
[Nexus 4 General] :
I was planning to flash the stock image because my SIM is not getting detected. I installed the driver you mentioned in step 2, from http://xdaforums.com/showthread.php?t=1996051. I then noticed that you mentioned it needs to be installed with USB Debugging enabled in Settings. I installed it without doing that. The driver now got installed in my computer (Windows 7 32-bit) and now my phone won't get detected. All I need to backup are some photos, so I decided I won't follow the C part of your instructions. So how do I get my computer to detect my phone again?
[Nexus 4 General] efrant:
1. No idea

2. Yes. That's mentioned in the first post.

Turn on USB Debugging, plug into your PC and update the driver if required. If all you want to do is backup photos, and you want to do it via MTP, then you don't even need that driver.
[Nexus 4 General] :
Worked. I just didn't know how to enable the USB Debugging option. I googled it and it helped.
[Nexus 4 General] juanluxxl:
Thanks for the info!
[Nexus 4 General] briggs81:
Mac / System.img

I've been at this for about 6 hours now. Originally just wanted to get on PA rom so went through the whole root thing etc. Something wasn't working at some point so I am sure I screwed it up.. which is how I ended up here, trying to get everything back to stock.

I am not sure if I am having the same issues as people here with mac / system.img or not, but basically I can get that far but when I try to flash system.img it just hangs there..

I am on Clockwork recovery.. my machine is a mac.

Is post #2 suppose to fix this "usb" issue? I was getting a usb_write failed with status e00002be message, then I'd try flashing again and it just hangs here for 15 minutes, again. If it does, is that file mentioned in step available anywhere else?

edit: I am still able to get into my device with the PA rom installed, if that matters.

edit: seems like I am not going to crazy.. many people having the same problem. I guess I need to use the toolkit and see if that works http://forums.androidcentral.com/ne...us-4-factory-image-restore-3.html#post2531155
[Nexus 4 General] sorcio91:
To flash the complete factory image can i use the Nexus 4 root toolkit by WugFresh? ---> http://xdaforums.com/showthread.php?t=1766475

Just to make the all thing easier and faster...
[Nexus 4 General] efrant:
Did you follow all the steps in post 1?

Are you using "./fastboot-mac"?

The toolkit executes the same commands, so if that works and this didn't, you missed something here.

Why don't you ask in the toolkit thread?

As stated in post 1, the object here is not to make things easier and faster. The object is to split out all the steps and do everything one step at a time so that we learn something.
[Nexus 4 General] briggs81:
I had fastboot installed previously, it was just the mac-fastboot which I renamed awhile ago apparently and stuck it in my platform-tools folder. All other fastboot commands have worked, but is there a difference if its in a tools directory compared to in your home directory with that file name?

edit: I don't even think I can use the toolkit anyways because I don't have anything installed anymore now that I think about it. So therefore can't turn on USB debugging. Tried some different steps and did a bunch of fastboot erase commands before trying to run through the process again.
[Nexus 4 General] efrant:
Not sure if there is any difference in the fastboot files from newer/older versions. Best would be to download the newest file from Google's developer page.

As for USB debugging, you do not need it turned on to do the steps in this thread. As for the toolkit, please ask in that thread. I'd rather not have toolkit related discussions in this thread.
[Nexus 4 General] briggs81:
I'd rather not either, I have put off trying to do it via toolkit. Fairly confident I have the latest fastboot for mac.

I guess no matter how many times I do this process or the process from http://forums.androidcentral.com/ne...3923-guide-nexus-4-factory-image-restore.html I just get total failure.

Kind of odd that I can't even do the following either..

Obtain a ROM of your choice, and note the location on your computer.

reboot your device into fastboot mode via one of the following options.

adb reboot bootloader (requires USB debugging to be turned on).

power off the device then back on with 'vol up' + power button.

Wipe your device.

fastboot -w

Update your ROM.

fastboot update </path/to/your/RomFile.zip>

Your phone will update and automatically reboot into the new ROM.

Basically tells me I need android.txt file after I try to use the fastboot update command on a CM or PA rom. Not relevant to this thread but I am finding it odd I can't even do this temporarily so I can use the phone.
[Nexus 4 General] efrant:
Unfortunately I have nothing Apple in my house, so I can't really test out anything. Maybe try booting Windows or Linux and using that?
[Nexus 4 General] -Asskicker-:
I can't find the Nexus 4 image on here?

Will these work?

Edit: Just noticed you pointed to the same website in the same link :)
[Nexus 4 General] briggs81:
Screw the mac. Once again my old crappy windows vista laptop saves the day. I recreated the sdk setup on the windows machine (it was old) and followed the same steps to a T again, and I am back to stock.

Screw. Mac.

Thanks.
[Nexus 4 General] -Asskicker-:
I can't get past the X, I tried clearing the cache again but that doesn't work either. How do I do a factory reset?

Do I install a custom recovery and do it there or?
[Nexus 4 General] undercover:
From recovery. From bootloader gonto recovery, then when you see broken DROID hold power and tap + vol.
[Nexus 4 General] -Asskicker-:
Thanks! Do I install everything again now or just reboot?
[Nexus 4 General] undercover:
Reboot. Then push recovery and reinstall your setup.
[Nexus 4 General] -Asskicker-:
Thanks, worked!
[Nexus 4 General] jackierobinson:
I'm trying to return my device to stock but can't because the link on the front page doesn't have the Nexus 4 stock image. Does anyone know where I can download the Nexus 4 stock image to return my device to unrooted stock? I need to sell my device and need it to be in original state.

Thanks!
[Nexus 4 General] thephantom:
Did you fully read C3 on page 1? Pretty sure there is a link there aside from the Google developer site
[Nexus 4 General] zevim2005:
did it now with my mac and all work flawless ;)
[Nexus 4 General] phaino00:
My gratitude to efrant for a concise description on what to perform for rooting the nexus and unlocking border. Work just as described.
[Nexus 4 General] jayeshrc:
weird, i seem to have ended up in a bootloop as well (stuck at the X). was on an unlocked bootloader, rooted and wanted to flash back to stock and start over.. here's what i did:

1. downloaded stock image, then extracted into a folder

2. placed fastboot/adb files in the same folder

3. ran "flash-all.bat"

4. bootloop :|

fixed it by going into recovery and doing a factory reset, but it doesnt make sense that this should even happen.
[Nexus 4 General] floepie:
Erfant, I've been posing questions in the Faux and Franco kernels threads regarding the relationship between kernel flashing and wiping cache. The paradigm is that the cache has absolutely nothing to do with flashing a kernel and that wiping the cache is 100% not needed. However, while on the stock ROM and migrating from the stock kernel to another kernel (and vice-versa back to stock), I cannot get past the boot anim without a "wipe cache" from recovery.

Do you have any idea as to why this would be? Thanks...
[Nexus 4 General] efrant:
It seems to be specific to the N4, and I can't figure out why it behaves that way.

Technically, wiping the cache shouldn't affect anything. If you flash a kernel, you theoretically shouldn't need to wipe cache. If you flash a radio, you theoretically shouldn't need to wipe cache. But, as we've seen in practice, for some reason which we haven't figured out yet, is that wiping cache clears up a lot of bootloops. I wish I had more insight.
[Nexus 4 General] heximing:
this thread help me a lot. thanks!
[Nexus 4 General] undercover:
Well, unless some process gets dumped in cache and gets loaded when booting. But that would have to be pretty low to affect kernels, radios and system flashes. Saying that, I flashed radio and had no problem. I'm not at pc, does flash all have

fastboot erase cache

in it?
[Nexus 4 General] efrant:
Are you referring to the flash-all script? If so, it includes the "fastboot update" command with the -w flag. As far as I understand it, the -w flag erases the userdata and cache partitions.
[Nexus 4 General] undercover:
Hmm, I wonder why he did it manually first and then used -w flag.

http://xdaforums.com/showthread.php?t=1907796
[Nexus 4 General] efrant:
Well, I would say that it probably is redundant. There shouldn't be a need to erase everything and then erase it again.

That said, as many have noticed, it seems that the "fastboot erase cache" command on the N4 doesn't have the desired result. (It seems to work fine on the GNex, but not on the N4...). What does seem to erase the cache though, is wiping cache via recovery, or using the -w flag while using fastboot update.
[Nexus 4 General] undercover:
Confusing. I wonder if this has anything to do with improved battery after flashing images and doing factory reset. I have a feeling that it's the factory reset after flashing that is doing it, not just reflashing images. I wonder if cache just gets full with crap that doesn't get deleted after ota or something along the lines (veeeeery long shot here).
[Nexus 4 General] El Daddy:
Is there a way to log the process when using the command "fastboot erase cache? Same goes for doing it in recovery.

I wonder if we could compare the two?
[Nexus 4 General] efrant:
Well, what a factory reset does is erase the userdata partition (and I think the cache partition). So, if you erase the userdata partition and the cache partition, in effect, it should be identical. The system partition which contains your ROM is not touched at all by a factory reset, and neither is the boot partition, which contains the kernel and ramdisk.

As I mentioned before, what is strange is that, while everything works as it should on the GNex, the N4 periodically has issues.

P.S. I was just going through your thread, and it is interesting. Although, I do think that, if you are using a stock ROM, a factory reset should be the same as flashing/erasing the userdata and cache partitions. At some point if I have some time, I will try it out as well.

When using fastboot, I'm not entirely sure. The misc partition (well part of it anyway) on the N4 acts as kind of a history log to some extent, but it's difficult to decipher. When using recovery, the history should be contained in the log files in /cache/recovery/ I think.
[Nexus 4 General] undercover:
I'm well confused why it works like that. People are finally starting to believe it and more of them are trying different ways, so we should be able to find the culprit at some point.

Re logging. Adb (fastboot) shows errors if any happen, and (I'm not sure about that) any other logging on that level only shows errors too AFAIK. So it might be pointless. This is the first time I have to deal with such a discrepancy when it comes to firmware, so I'm a noob at that as I never had to look into.
[Nexus 4 General] El Daddy:
Well I decided to flash stock (per undercovers thread) and I just ran the flash-all.bat and my phone booted up fine. It's odd that it works for some and others it bootloops. I know there is probably no way to fix the problem save for a bootloader update, but I'm very curious.
[Nexus 4 General] undercover:
Still do factory reset before returning to your previous setup. Just in case (for battery improvement) .

I will repeat process at some point soon and will see if NOW I can boot without reset, after flashing images once already.
[Nexus 4 General] studjuice:
I need to go back to stock, without USB, but the links in the second post don't work. How else should I go about doing it?
[Nexus 4 General] efrant:
I removed it because I was planning on making it safer to flash, and I haven't had time to do it yet.

What is wrong with your USB port?
[Nexus 4 General] studjuice:
It's the usb brick. It doesn't connect to anything, or respond. No matter what. It doesn't charge via AC anymore, only USB speed.

I just got my replacement nexus which works the way it's supposed to, now I need to send this one back.
[Nexus 4 General] efrant:
Flash the odexed version of this, and then remove root and busy box.
[Nexus 4 General] studjuice:
Alright. How do I remove root? is it just going in with root explorer and deleting files?

Also, shouldn't I use terminal to flash the recovery before I remove root, or does that include the recovery?
[Nexus 4 General] efrant:
I've posted the stock kernel here and the stock recovery here. You will need to flash those as well if the ROM from the other thread doesn't include them (which I think it doesn't).

Don't forget to use segv11's BootUnlocker app to relock your bootloader before you do all of this.

As well, instructions to remove the root/busybox files are in that thread, or you could just use Root Explorer or something similar to delete them. Just remember that, once you delete the root files and replace you custom recovery with the stock one, you will not be able to flash anything else on your device.
[Nexus 4 General] undercover:
SuperSU can remove itself iirc. But you have to uninstsll busybox before you lose root.
[Nexus 4 General] studjuice:
Got it about as stock as I can get it without usb. I documented my process here for future reference:

http://xdaforums.com/showpost.php?p=37064957&postcount=10
[Nexus 4 General] iron maiden:
thanhs..

sludos
[Nexus 4 General] adidas007:
Hi,

sorry for being such a noob. As i live in a country where N4 is not available, i dont want to take any risks.

Do we need to use the commands relating to radio and stuff as mentioned by efrant in the OP.?

all i want is a root access with CWM or TWRP...

Is just doing these step enough and safe?

Enable usb debugging

install the drivers as adviced by efrant

Download the fastboot files, open cmd and change directory to the folder having the files

Fastboot device

fastboot oem unlock.

Is there a need to use the reboot command or the phone restarts automatically, as i have seen in some tuts vids

Thanks in advance!
[Nexus 4 General] efrant:
As mentioned in the first post (specifically step C2), if all you want is root, all you have to do is unlock the bootloader and then follow the steps in part E.

There is very little risk if you follow the steps in the first post.
[Nexus 4 General] adidas007:
Thank you efrant!

One last question

So i can stop at D4 and continue to E or do i need to perform all the steps mentioned In D??
[Nexus 4 General] efrant:
Stop at D4.
[Nexus 4 General] adidas007:
thank you once again
[Nexus 4 General] adidas007:
You have mentioned in E that it wont flash a custom recovery. What do i have to do to flash the custom recovery, so that i can flash roms/kernels at a later stage! Thanks!
[Nexus 4 General] undercover:
Download custom recovery, put in adb folder. From the adb folder hold shift, right click, start command window

fastboot flash recovery recovery-image-name.img
[Nexus 4 General] efrant:
Change the command in step E5 to: fastboot flash recovery customrecovery.img
[Nexus 4 General] undercover:
I guess I should read into op a bit and start pointing in the right direction instead of spoon feeding :rolleyes::D

btw, efrant, did reflash make any difference?
[Nexus 4 General] Kazliux:
Hi,

What is the purpose of the action in fast boot mode: Restart bootloader? I have clockworkmod recovery.
[Nexus 4 General] chrone:
for the newly flashed bootloader and radio to kick in just as in PC BIOS after we change the settings it needs to be rebooted for the effects to kick in. :P
[Nexus 4 General] efrant:
I just did it late last night, so I can't really tell yet.
[Nexus 4 General] Domx92:
Stuck on the X -.-

please Help.

I used the tutorial of the first post

sry for noobiness didn´t read the entire post

shame on me !
[Nexus 4 General] trueblueram:
From op -

Note that some users indicate that they can't get past the X on boot. If this happens to you, reboot into recovery (hold power and press volume up when you are at the screen with the android and the red exclamation mark), and wipe cache. If that still doesn't work, boot back into recovery and do a factory reset.
[Nexus 4 General] i860:
Thank you !
[Nexus 4 General] gidil:
thank you very much!
[Nexus 4 General] monkeying. around:
Thanks for this thread.

On the Noyes section (in red) you said radio twice.

I have a question. Since I sort of lost you on step c. (Currently backed up phone) can I unlock boot loader and go straight to flashing cwm?
[Nexus 4 General] alltheway3:
Hi, complete noob here.

I extracted all 6 .img's and still couldn't get the command line to work. So I tried dropping the rest of the files within the .tgz into the same location and it worked a treat! It was this line that was confusing me as it implied to me I only needed the .img's in the folder and I could discard everything else:

Perhaps this is worth clearing up? It could be me just being stupid though.
[Nexus 4 General] Austin Ag06:
Trying to Unlock

For some reason, I've been having the worst luck trying to unlock my Nexus 4. After trying the toolkits without any luck, I decided to try doing everything manually. I've read through the OP several times, and I believe I am doing everything correct. As far as I know, the drivers I have installed are correct since Device Manager recognizes the N4 as Android Device > "Google Nexus 4 ADB Interface" when in ADB mode and "Google Nexus 4 Bootloader Interface" when in fastboot mode. Also, when I type "fastboot devices" my serial number appears same when I type "ADB devices"

Anyhow, here is the problem I'm having:

When I type "fastboot oem unlock", I get the following error:

I would really appreciate it if someone could help a noob out with this.
[Nexus 4 General] efrant:
Sorry, I didn't understand. What is the Noyes section?

Yes you can.

The only files you need from the .tgz are the 6 images. You can discard the other files, including the .tgz. But, you obviously need to have the files from the attachment in the first post... <-- maybe that wasn't clear.

Hmmm. Yes, it seems like your drivers are installed correctly. I'm not sure exactly what that error is from, but it could be that there is not enough power in the USB port you are using, or you have a bad cable. Try switching USB ports, and/or try switching cables. As well, try opening the Command Prompt window with Administrator privileges, i.e., go to Start->All Programs-> Accessories, and right click on Command Prompt and select "Run as Administrator", then swtich to the directory where you downloaded the files. For example, if you downloaded fastboot.exe to C:\junk, then type "cd c:\junk" without the quotes.
[Nexus 4 General] undercover:
I had that. Basically unplug, reboot pc and run again. Worked for me. adb kill-server didn't help.