yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] suyoy.r@hotmail.com:
I'm having the same problem on my Nexus 4 after follow all steps above. Still my phone is unable to turn on, the worst is my phone is unable to enter any other mode but fast boot mode. Restart boot loader, recovery mode are suddenly black out after enter.
[Nexus 4 General] tanawitsu:
It's me, the same person as above. It was a mistake on Log in. Sorry for making mistake!:crying:
[Nexus 4 General] Swapnil Soni:
Help ! nexus 4 is soft bricked...

I have twrp installed in my device and i m in cm13 i tried to show my friend how to unlock bootloader with adb but i forgot it will wipe device when i turned on it automatically boot into twrp i saw everything got wiped all folders empty and internal storage is cleaned too. I tried adb push but it cant detect location also tried adb sideload its always giving error 7 with cm13 rom, now downloading factory image i hope it works please encourage devs...
[Nexus 4 General] efrant:
You need to boot into Android at least one time after wiping (or unlocking the bootloader) so that Android can create the proper directory structure on your internal storage. Then your "adb push" will work.
[Nexus 4 General] Swapnil Soni:
By the way thanks. Revived with flashing factory image.
[Nexus 4 General] MarceloEngelhardt:
Bootloop after following the steps

Hi guys, i'm new here. And i'm facing the same problem of the bootloop after follow the steps. i have google drivers intalled and My phone does recognize adb/fastboot in bootloader and when i'm stock recovery or twr recovery, even mtp is enable. I can root and unroot, unlock bootloader and lock, i can wipe everything, install everything again following the steps, or by clicking flashall.bat.

I already try the Nexus Root Toolkit, it installs everything and bootloops. Made the install in two different computers win7 and 10 and nothing seems to change.

And finely i try download mode, who is the last chance i have, and guess what, it says that i have the last system available, even if there's no system installed.

So, i'm stucked. Any idea how to proceed whit it??

Thanks
[Nexus 4 General] efrant:
I would suggest having a look at post #1977.
[Nexus 4 General] MarceloEngelhardt:
Yes I've already tried that. From fastboot, and twrp too, even with rooted device.

I have two situations here, first following the instructions and rebooting to the system the boot suddenly shutdown the phone and nothing happens.

Second the boot never ends, and entering the recovery mode it shows:

E:failed to mount /cache(invalid argument)

Already tried to flash the stock image-occam-lmy48t.zip from adb sideload, but we back again to first situation.

Then i do a wipe cache, and the first situation happens again.

Lock, unlock and lock bootloader changes nothing.

Maybe i'm missing some important step here, I Don't know.
[Nexus 4 General] efrant:
Try re-downloading the latest factory image and extract all the image files contained within. Then type the following commands into a command prompt window, and paste the output here in this thread:

Fastboot flash system system.img

Fastboot flash boot boot.img

Fastboot format userdata

Fastboot format cache

Fastboot reboot
[Nexus 4 General] audit13:
Try flashing the userdata.img file last. After flashing userdata in fastboot mode, use the buttons to boot into recovery, perform a factory wipe, and reboot.
[Nexus 4 General] MarceloEngelhardt:
So, there's the result.

C:\Users\marce\Desktop\adb\5.1.1>Fastboot flash system system.img

erasing 'system'...

OKAY [ 0.825s]

sending 'system' (834934 KB)...

OKAY [ 52.190s]

writing 'system'...

OKAY [ 51.284s]

finished. total time: 104.305s

C:\Users\marce\Desktop\adb\5.1.1>Fastboot flash boot boot.img

sending 'boot' (6448 KB)...

OKAY [ 0.408s]

writing 'boot'...

OKAY [ 0.380s]

finished. total time: 0.791s

C:\Users\marce\Desktop\adb\5.1.1>Fastboot format userdata

Creating filesystem with parameters:

Size: 14129561600

Block size: 4096

Blocks per group: 32768

Inodes per group: 8144

Inode size: 256

Journal blocks: 32768

Label:

Blocks: 3449600

Block groups: 106

Reserved block group size: 847

Created filesystem with 11/863264 inodes and 95427/3449600 blocks

erasing 'userdata'...

OKAY [ 0.606s]

sending 'userdata' (137438 KB)...

OKAY [ 8.595s]

writing 'userdata'...

OKAY [ 7.914s]

finished. total time: 17.120s

C:\Users\marce\Desktop\adb\5.1.1>Fastboot format cache

Creating filesystem with parameters:

Size: 587202560

Block size: 4096

Blocks per group: 32768

Inodes per group: 7168

Inode size: 256

Journal blocks: 2240

Label:

Blocks: 143360

Block groups: 5

Reserved block group size: 39

Created filesystem with 11/35840 inodes and 4616/143360 blocks

erasing 'cache'...

OKAY [ 0.040s]

sending 'cache' (10984 KB)...

OKAY [ 0.692s]

writing 'cache'...

OKAY [ 0.668s]

finished. total time: 1.406s

C:\Users\marce\Desktop\adb\5.1.1>Fastboot reboot

rebooting...

finished. total time: 0.001s

And the system suddenly shutdown while in bootloader.
[Nexus 4 General] efrant:
It's strange -- everything seems to flash correctly, but it won't reboot at the end. You could maybe trying flashing a TOT file in download mode (I think there files here on XDA). Or it could very well be a hardware issue.
[Nexus 4 General] MarceloEngelhardt:
Now i'm trying to flash from bootloader and wipe with twrp. I have downloaded the rom occam-jdq39-factory-345dc199, it flashed and work a short period of time. Like 2 min after reboot.

Maybe the download mode would be the last chance of getting the whole thing to work.
[Nexus 4 General] MarceloEngelhardt:
[/COLOR]

So far, so good.

I have downloaded Factory 4.2.2(occam-jdq39-factory-345dc199), and erase/format everything from boot, recovery, bootloader, cache, userdata and radio.

Then flash it all again with the files from the zip, the first boot the phone won't start. So enter recovery mode and wipe factory reset and wipe cache, the phone restart automatically and there is.

And i'm receiving Ota to 4.3 now and updating the stock apps.

So strange, i have a question, this "older" stock rom should work with the new bootloader?

I read somewhere that the update from 4.2 to 5.1 changes something like, where cache is installed and stuffs like that.

I'm afraid now to flash the "new" stock rom and get stuck again. :eek:

I think that i'll wait it all from ota.
[Nexus 4 General] fluk321:
when I did this twice, no response from my phone, still have TWRP recovery and 0 in my internal storage. And Yes I loaded the drivers correctly and everything point for point. when i Fast boot flash a command it says sending, okay, then fastboot stops i cancel searching for solution it goes back to command prompt. but through it all it seems nothing is going inside my phone internal storage. and TWRP wont mount anything. ADB dont work.
[Nexus 4 General] Mrkblo:
Hi Everyone, just entered fastboot, unlocked the bootloader and flashed TWRP, but now my phone has no system, and it says internal storage is 0 mb. Can anybody give me a hand?

EDIT

Solved. Didnt realize I had to allow a first boot before flashing twrp.
[Nexus 4 General] Ranadagr87:
You simply rock buddy....restored my bricked nexus 4 using the instructions you provided.
[Nexus 4 General] SnowiiSnowii:
Gents,

don't really know where else to put this Q so I'll try here. I unlocked my Nexus 4, put in TWRP 3.1.1 and tried flashing Lineage, Unlegacy and Carbon with the same result always and that is that the phone gets stuck on the initial booting animation. Only weird thing I can see is that TWRP always gives an error at the end of the flashing saying it was unable to mount data folder (but having flashed a few other devices it seems there is always something twrp is unable to do and all works anyways...). Anyone any ideas? Thanks a lot!
[Nexus 4 General] diretouch:
about these 6 img`s ?!

I download occam-jdq39-factory-5880aa93

When i open it and open the next folder i see

bootloader-mako-makoz10o.img

radio-mako-m9615a-cefwmazm-2.0.1700.48.img

and in image-occam-jdq39 find 4 imgS:

boot recovery system userdata

I have to put these 4+2 files in 1 folder or ?!

Thanks
[Nexus 4 General] popcomm:
tryed all this your links bring you to a site that does not seem to work pops up a thing to accept terms and conditions i click and click and click and click and nothing happens on either 3 tabs thanks for false hope.
[Nexus 4 General] Vladimyr:
my command line is:

rcupdate.rcu_expedited=1 console=ttyMSM0,115200,n8 androidboot.console=ttyMSM0 earlycon=msm_serial_dm,0xc1b0000 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.enable=1 swiotlb=2048 androidboot.configfs=true androidboot.usbcontroller=a800000.dwc3 buildvariant=user veritykeyid=id:7e4333f9bba00adfe0ede979e28ed1920492b40f root=/dev/dm-0 dm="system none ro,0 1 android-verity /dev/sda6" androidboot.verifiedbootstate=orange androidboot.keymaster=1 androidboot.veritymode=enforcing androidboot.bootdevice=1da4000.ufshc androidboot.serialno=3528da82 androidboot.baseband=msm mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_td4302_dsc_wqhd_cmd:config2:1:none:cfg:single_dsi androidboot.slot_suffix=_a skip_initramfs rootwait ro init=/init

should I put it entirely?
[Nexus 4 General] Alfonso1999:
Need some help here...

Hello to everyone and to the author of this thread. I hope you can give some guidance. This is my case.

I have a Nexus 4, which in the last 2 years, (since 2018) I have had to flash the images and factory reset every one or two months. I haven't had the money to buy a new phone, so I have keep prolonging his life with this maneuver. Everything started after one year of a battery replacement. The new battery lost his charge really fast, and I assumed this was caused for a defective battery.

Lastly it was happening more often, constant reboots, error messages, that made me reboot the phone every day, so I decided to buy a new battery. This one was better than the previous one, and it looks LG original. So I was very happy with the new battery, until after one month of the battery change, the Nexus bricked. It hangs with the X.

I proceeded, as usual, to flash the images and factory reset, the same way is described here, which it has worked for me very well in the last 2 years, but this time the phone doesn't start, it hangs with the X logo.

I have tried everything: Flash-all.bat, fastboot the images one by one, format cache, factory reset in recovery mode, etc, and nothing seems to work as it used to work before.

What happened? Is the hard disk of the Nexus too defective already? The Ram memory? What can I do?

I know that the most logic answer will be: buy a new phone!, but if not what can be do? Is there a way with fastboot or ADB to scan and correct bad sectors in the hard disk?

Thanks in advance.
[Nexus 4 General] Jens Winslow:
Thank you 1024k times for this guide

1) There seems to be hope I can get my phone working again using this. :D

2) It really helped me understand the steps and what we are doing

You are so right when you say

I suspect a bad script was what got my phone messed up in the first place.
[Nexus 4 General] malikusmanrasheed:
Radio giving me trouble

Hi all,

I followed the guide in this sticky. I got root :)

Excellent guide, thanks.

However the radio is giving me some pain. Edge drops a lot. Sometime i have to power off/on the phone to get even GSM signals back.

can anyone suggest me a good radio that works with the stock ROM.

Thanks
[Nexus 4 General] efrant:
There are only two radios at the moment: 2.0.1700.24 and 2.0.1700.33, and I haven't seen anyone post the 0.24 radio anywhere.
[Nexus 4 General] houstonn:
Can someone pull ( dd if of ) of the old radio and upload it please... 2.0.1700.24 . thanks
[Nexus 4 General] houstonn:
Hey efrant: I extracted the 2.0.1700.24 and have uploaded it. I posted the link here on this thread.
[Nexus 4 General] efrant:
Have you tried flashing the odexed version of this rom: http://xdaforums.com/showthread.php?p=34564849

It's essentially stock. You just have to flash the stock boot image (I'll make a zip for you), and get rid of busybox and root.
[Nexus 4 General] al3b3d3v:
If you could make the zip for me that would be awesome
[Nexus 4 General] efrant:
I've tried re-packing the ROM and boot image. Try this zip in CWM. If it works, then flash the attached stock recovery. And don't forget to lock your bootloader before doing any of this.

Again, standard disclaimer: this has not been tested by me.

Edit: link removed.
[Nexus 4 General] efrant:
Ok, last thing to try: Flash the ROM I linked to a few posts ago. Let me know if that works. If it does, then I'll then get you a zip of just the stock boot image and tell you how to get rid of root and busybox.
[Nexus 4 General] malikusmanrasheed:
Hi, i wanted to clear things up.

The radio is working fine. It was the application "Easy battery save" that disconnected Edge and Wifi every time i locked the screen.

I changed the settings on the said application and its working fine now.

Thanks every one
[Nexus 4 General] Devzz:
Hey everyone I don't know if this is the right place to be posting this but I had a problem a few hours ago. I flashed LiquidROM and it got stuck on a boot loop. Needless to say, I panicked and used the "adb push" method because prior to flashing, I decided to delete the AOKP zip from my folder and replace it with liquid. Anyway, before flashing, I backed up my entire SD card onto my laptop as ADB backup wasn't working (odd as it always works) and I pushed the entire folder using the command "adb push sdcard /sdcard/". Next, I went into recovery (CWM) and when I go through the install from sdcard option, usually there were 3 options named 0/ and 2 others, however since I pushed the sdcard folder to /sdcard/ I get a 0/ at the top of the list which is what I would normally select but then underneath that I get all the folders I pushed! I think I may have changed the sdcard partition. Is there any way to sort this out? I could attach pictures at some point for those of you who find it hard to picture what I'm describing. Thanks in advance for any help! :)

Just to add a couple of other things, my NANdroid had a checksum error so I cannot revert to stock without having to manually flash it which I cannot do at the moment due to a lack of WiFi, is there any way to sort out a checksum error? And the other thing was that for some reason sdcard cannot be unmounted at all in cwm, is it meant to be like that or am I missing something? Afaik its supposed to toggle.

Thanks again!
[Nexus 4 General] al3b3d3v:
THIS WORKED!

the odexed rom was flashed successfully and my kernel is now stock mtv.corp.google #1
[Nexus 4 General] al3b3d3v:
efrant, the odexed rom worked for me. could you get me a zip of the stock bootimage and tell me how to get rid of root and busybox please?

thanks,
[Nexus 4 General] efrant:
Sorry, it slipped my mind. I'll get it for you tomorrow.
[Nexus 4 General] efrant:
I've attached a CWM-flashable zip of the JOP40D stock boot image.

To get rid of root and busybox, install Terminal Emulator from the Play Store and type the following in it:

su

mount -o remount,rw -t ext4 /dev/block/mmcblk0p21 /system

rm /system/xbin/busybox

rm/system/xbin/su

rm/system/app/Superuser.apk

exit

exit
[Nexus 4 General] LuisLAN:
Just unlock and root stock N4

Hello Efrant.

Thank you for making this this amazing guide.

I've read all the thread just to check if i got everything correctly, and for what I understand if my N4 is in an stock condition, and all I want is to unlock and root, then after installing the drivers and make the backup of my data, all I need to do is follow steps C1, C2, C7, C8, D1 to D4 and then to root all of the E section? Right?

I know you already answered a question similiar to this one (If not the same) somewhere in the thread, but I want to be really sure before starting the process and make a mistake.

Thank again for your help and efforts.
[Nexus 4 General] efrant:
Correct.
[Nexus 4 General] nightakhouse:
thanks a lot! I was flashed to aokp and discover that the wifi signal is not good no matter i flash to other rom...

I simply flash back to the stock one and return it to the retailer:D:good:
[Nexus 4 General] khanh1289:
Thank you! RMA-ing my device so this was a must. Definitely easier than I thought it might be.

Sent from my Blenzderz 9000
[Nexus 4 General] digitalramble:
rooting a nexus 4 using ubuntu 12.04 OS

I've searched extensively through this thread/forum and found very little on how to do this from linux based OS (preferably Ubuntu). I keep following links for auxiliary downloads ("get the drivers here!") only to find they are for windows or macs o.O. Can someone please confirm whether I can just plow through the instructions at the start of this thread on an actual linux OS rather than cygwin, and just use the "windows" drivers after all? Or what?

Thanks,

--Cindy
[Nexus 4 General] efrant:
If you are using Linux, you don't need drivers.
[Nexus 4 General] khanh1289:
Are there other ways to flash stock recovery? Will you please link or guide me when you have a chance? Thanks in advance.
[Nexus 4 General] thesebastian:
Its possible to root Nexus 4 without WIPE my data and without unlock bootloader?

(I just need root to restore some app data from titanium backup...)
[Nexus 4 General] efrant:
There are two ways that I've posted: instructions in the first post using fastboot, and flashing the stock recovery in a zip. Are you saying that neither work for you?

There have been reports that people's data had not been wiped with unlocking the bootloader, but I can't confirm that. You could always just to a backup (see the basics link in my signature for a link to a thread using adb), unlock the bootloader, and then restore the backup.
[Nexus 4 General] Kepler22b:
Efrant i need your help please sir! previously my phone was rooted and unlocked but i installed some dodgy apk and then the phone refused to boot (would go black after google logo and hang) i just followed your guide and my phone is currently stuck at the Google logo. i have CWM recovery flashed and i have tried wiping data/factory reset but it always brings me back to the google logo and goes no further! please help me dude
[Nexus 4 General] efrant:
A factory reset / wipe data in CWM is not a real factory reset. Boot the stock recovery (by typing "fastboot boot recovery.img" ) and do a factory reset using that.
[Nexus 4 General] Kepler22b:
ITS ****ING BOOTING! thank you sir!
[Nexus 4 General] kyogoku:
hi, i can't find occam or nexus 4 image from https://developers.google.com/android/nexus/images

can anyone advice?
[Nexus 4 General] kyokeun1234:
That's because Google pulled it out from their website. I believe there is a mirror link on the op
[Nexus 4 General] s2046:
I'm at a total loss here. I can't get my device to be recognised properly in fastboot mode.

It always says: The device cannot start. (code 10)

I've tried the SDK, the Naked Driver .72, and the standalone driver. Uninstalled and reinstalled the drivers several times. I've tried with 3 different USB cables, plugged straight into my PC, with all other USB devices unplugged. Tried in several ports.

What am I doing wrong?
[Nexus 4 General] erikieperikie:
This is one of the best threads on XDA. I'm a n00b myself, but I totally agree on your opinion that toolkits and magical one click root apps are dangerous. I want to learn to handle my phone the way I should, which is being able to root, flash roms, updates, etc.

Thanks a lot for this and I hope to learn much more.

As I come from a completelt rooted+modded HTC Desire, I already knew some of the steps involved, but seeing all the steps described in detail taught me new stuff. Even the shift-click in an Explorer window for a quick command prompt pointed to that folder was new for me and a great tip! The booting into a custom recovery also made a lot of sense to me, but I didn't know that before either!
[Nexus 4 General] efrant:
You're not installing the driver properly.

Boot your device into fastboot mode and plug into your PC. Does it show up in Device Manager?
[Nexus 4 General] s2046:
Yep, it shows in device manager, tries to find a driver and fails.

I choose "update driver"

then "pick from a list"

then "have disk"

select the location of the folder

click OK to the option it comes up (either Android Bootloader or Nexus 4 bootloader interface depending on which driver I try)

After that updates, it lists it properly in Device manager but has the exclamation mark and says device cannot start (code 10)

I reboot, and try plugging phone in again, but it's still the same.

Then I uninstall it, ticking the box "delete the driver software", reboot, and try the install process again
[Nexus 4 General] efrant:
Well, it seems like you are doing everything correct. Did you try the process on another PC? If you do, and it works, then there is something wrong with your PC.
[Nexus 4 General] floepie:
Why would Google have pulled the "occam" image from their site while keeping all the others?
[Nexus 4 General] El Daddy:
Licensing issues most likely.
[Nexus 4 General] s2046:
I haven't tried another PC yet, that's an idea. It's quite likely there's something wrong with this PC, my main PC is down, this one always had problems with USB2 I have to disable it and run USB1 otherwise it crashes the PC.

I guess I'll stay unrooted and completely stock for a while, after reading some threads today about Red LED issues I'd prefer to wait to see how it all pans out before messing with the phone. Thanks for the help (and guide).
[Nexus 4 General] GunninZombiesdown:
Ok, so maybe I missed my answer, but I will say that I read 25 pages and didn't find it, so here it goes...

I locked the bootloader, then used TWRP to flash JOP40D and in the process it got stuck on the Downloading page. So eventually I restarted the phone, and now it gets stuck at the Google logo page.

From here, I think I've tried everything. Fastboot to recovery=no command (which then I did Power+vol up = nothing, just shuts off and red led comes on).

For some reason, even before I tried to unroot, the phone would not recognize that it was plugged into a computer, so hopefully that answers any questions.

Man I suck.
[Nexus 4 General] efrant:
1) It got stuck on what "downloading" page?

2) Is your USB port busted? If not, you should you the instructions in post 1. I only posted the info in post 2 for those with broken USB ports. (And a driver issue does not constitute a busted USB port.) If people keep using those instructions when their USB port is fine, I will remove them.

3) What is "Fastboot to recovery=no command"
[Nexus 4 General] El Daddy:
I think they are referring to the lg utility which is similar to Odin mode on the gnex.

The "Fastboot to recovery=no command" probably means the stock recovery. Sometimes it says no command under the exclamation.
[Nexus 4 General] GunninZombiesdown:
Im pretty sure the USB port is busted, but there is no visible physical damage if thats what you mean by busted (I think its just internal). Yeah, I got this far by your awesome usb busted instructions, but it seems like the N4 doesn't want to play anymore.

El Daddy got it correct, the Download mode must be a LG attribute and the No Command is the exclamation page.
[Nexus 4 General] efrant:
Ok, let's see if we can get you sorted out. Rebbot into fastboot mode and plug into your PC. What shows up in device manager?
[Nexus 4 General] GunninZombiesdown:
Love the enthusiasm. Absolutely nothing. Could be because its stuck with the Google logo up, so its not showing up because its not fully booted up?
[Nexus 4 General] efrant:
But you shouldn't see the Google logo when booted in fastboot mode. You're holding volume down and pressing power, correct?
[Nexus 4 General] khanh1289:
would the command to relock bootloader in fastboot be "fastboot oem lock" or "fastboot oem relock"
[Nexus 4 General] thephantom:
The first one