[HOWTO] n4root - Root your Nexus 4 [ROOT, BUSYBOX, SU]

cyr0s

Senior Member
Apr 28, 2012
84
88
0
n4root - Nexus 4 rooting application
by @Complex360 (cyr0s on XDA-Developers)


THIS HAS NOT BEEN TESTED. BEFORE USING THIS, YOU ACKNOWLEDGE THAT IT COULD POTENTIALLY HARM YOUR DEVICE.

If there is a bug or issue you've found, post it here or preferably PM me.
(If this tool works for you, please comment below so I can remove the obnoxious banner about reliability)



Code:
#include 
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at me for messing up your device, I will laugh at you.
 */
Description:
Sadly, I was unable to get my hands on a Nexus 4, regardless, it's a bloody awesome device and anyone lucky enough to own one deserves a quick and easy rooting method. This is it.

This uses the insecure boot.img method
1) Unlocks Bootloader
2) Boots with insecure boot.img (root access)
3) Installs Busybox
4) Installs SuperUser and su binary

If you've already unlocked the bootloader in anticipation for rooting solutions, you can just go through the bootloader stage, the application assumes you're telling the truth, regardless of whether you are.

Changelog:
Code:
V1.2 ([URL="https://github.com/compl3x/android/commit/3522237659aaf790e9cbd23df43aa354d950a42a"]1[/URL]) [URL="https://github.com/compl3x/android/commit/9bd487fa73fd650e4a61a020c9161d3f71f0512c"](2)[/URL] - Merged improvements of Kumouri
[URL="https://github.com/compl3x/android/tree/8b264c1b693452abfc6b6a70aa40f47071a6b1ab"]V1.1[/URL] - Fixed boot.img freeze bug
V1.0 - Initial release
Alas, it is here that I must shake my digital, Github markdown formatted donation box.
If this has worked where the needlessly convoluted alternatives didn't, please consider donating to me via Paypal:

Feeling generous?


 
Last edited:

zander145

Senior Member
Oct 3, 2010
451
51
0
28
Wilmington
Due to the I guess you could say availability of this phone, I would need somebody to test this out before using it... Really don't want to turn the wonderful N4 into a really good paper weight.

Sent from my Nexus 4 using xda premium
 

cyr0s

Senior Member
Apr 28, 2012
84
88
0
Well, its using the tried and tested method manually posted earlier in this section, I mean more if there was an error with the actual application
 

USSENTERNCC1701E

Senior Member
Sep 21, 2010
1,259
289
0
Logan
Due to the I guess you could say availability of this phone, I would need somebody to test this out before using it... Really don't want to turn the wonderful N4 into a really good paper weight.

Sent from my Nexus 4 using xda premium
Just look at it. There's nothing in there that could brick the phone.
 

OverTheBelow

Senior Member
Nov 27, 2011
73
25
0
Cheshire, UK
I'll test it when/if I manage to get a Nexus 4 from an O2 store later today.

--

Bootloader unlocked fine using the program, although I had a bit of trouble rooting the phone with it. I'm not sure what happened, it just didn't root and I wasn't sure how to get back to that stage in the prompt again without going through the bootloader process again. Ultimately I gave up and rooted it myself.
 
Last edited:

cyr0s

Senior Member
Apr 28, 2012
84
88
0
Are there any instructions for how to use this?
How do you install su binary?
Just run the application, it'll do everything for you.


Thanks for the work. I'll try it after I get me Nexus 4.
Thanks mate, please report back how it went.

I'll test it when/if I manage to get a Nexus 4 from an O2 store later today.

--

Bootloader unlocked fine using the program, although I had a bit of trouble rooting the phone with it. I'm not sure what happened, it just didn't root and I wasn't sure how to get back to that stage in the prompt again without going through the bootloader process again. Ultimately I gave up and rooted it myself.
Odd, did you save the output? it should' have sorted root out. Btw, bootloader stuff assumes you're telling the truth, you could have just skipped it.


Testing today after I get off from work thanks ! I'll make sure to donate as well ! :)

Sent from my Nexus 4 using xda premium
Thanks! I look forward to the donation or angry messages depending on your success :p
 

OverTheBelow

Senior Member
Nov 27, 2011
73
25
0
Cheshire, UK
Yeah, I tried skipping through it but it wouldn't let me get past the "Attempting to unlock bootloader (when a prompt appears press YES)" bit regardless of what I did. That was after I had already unlocked the bootloader using it previously.

Great effort nonetheless, I'm sure others will get it to work. I was a tad impatient tbh because I was so excited to get the phone set up. :p
 
Last edited:

Kumouri

Member
Feb 20, 2011
48
6
0
Rapid City
This is not working for me.

It works up to the "Booting into insecure boot.img", but once it gets there it never reboots and when I manually reboot it nothing happens. There is no su binary or busybox when I manually reboot.

Thanks for the help unlocking the bootloader, though ;)
 

cyr0s

Senior Member
Apr 28, 2012
84
88
0
This is not working for me.

It works up to the "Booting into insecure boot.img", but once it gets there it never reboots and when I manually reboot it nothing happens. There is no su binary or busybox when I manually reboot.

Thanks for the help unlocking the bootloader, though ;)
Thanks for saying exacting where it failed, I think I've fixed the issue (tool was waiting for fastboot to do something it'd never do)

If anyone can test now, please do :)

-Fixed boot.img freeze bug​
 

Kumouri

Member
Feb 20, 2011
48
6
0
Rapid City
Well it still isn't working.

I looked through your code and everything seems in order, more or less, although I would change "Booting into insecure boot.img" to "Loading insecure boot.img." and then when it is done "Reboot phone now."

I tried rebooting using "fastboot reboot" (from a command prompt) but it said "<waiting for device>" even after the phone had completely loaded. I assume this is the line you took out.

Assuming there is a way to get the phone to reboot from fastboot, then I think it should be all good.

For some reason it did not correctly load Superuser or any of that, though. I ended up doing it manually from the commands in your code and that seems that have worked (although not for busybox :( ).

I'll look through your code some more tomorrow, but I have 2 programs and a test due in the next 2 days (Yay CSC major :D), so I'm not sure how much time I'll have. On Wednesday, though, I might write up a little C# GUI to go along with this if you don't have a problem with it :)

Thanks for everything!

---------- Post added at 02:22 AM ---------- Previous post was at 02:19 AM ----------

I tried rebooting using "fastboot reboot" (from a command prompt) but it said "<waiting for device>" even after the phone had completely loaded. I assume this is the line you took out.
I just tried it again one more time before I went to sleep and that seemed to have worked perfectly fine. I'm going to make a couple of quick changes and see what happens.
 

Androidclub

Senior Member
Oct 4, 2012
121
11
0
Bangkok
n4root - Nexus 4 rooting application
by @Complex360 (cyr0s on XDA-Developers)


THIS HAS NOT BEEN TESTED. BEFORE USING THIS, YOU ACKNOWLEDGE THAT IT COULD POTENTIALLY HARM YOUR DEVICE.

If there is a bug or issue you've found, post it here or preferably PM me.
(If this tool works for you, please comment below so I can remove the obnoxious banner about reliability)



Code:
#include 
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at me for messing up your device, I will laugh at you.
 */
Description:
Sadly, I was unable to get my hands on a Nexus 4, regardless, it's a bloody awesome device and anyone lucky enough to own one deserves a quick and easy rooting method. This is it.

This uses the insecure boot.img method
1) Unlocks Bootloader
2) Boots with insecure boot.img (root access)
3) Installs Busybox
4) Installs SuperUser and su binary

If you've already unlocked the bootloader in anticipation for rooting solutions, you can just go through the bootloader stage, the application assumes you're telling the truth, regardless of whether you are.

Changelog:
Code:
[URL="https://github.com/compl3x/android/tree/8b264c1b693452abfc6b6a70aa40f47071a6b1ab"]V1.1[/URL] - Fixed boot.img freeze bug
V1.0 - Initial release
Alas, it is here that I must shake my digital, Github markdown formatted donation box.
If this has worked where the needlessly convoluted alternatives didn't, please consider donating to me via Paypal:

Feeling generous?


Umm...sorry if i am noob
But where can i flash it or do with it
Thabks

Sent from my GT-N7000 using xda premium
 

Kumouri

Member
Feb 20, 2011
48
6
0
Rapid City
Okay, I think I have gotten it working, although I am not sure if busybox installed correctly. There seemed to be a typo in that line, it was "busybox -- install" instead of "busybox --install". I could be wrong about it being a typo, but Windows and Android (tried it from cmd and in a shell) both complained about it :p

I will message you the modified code so I don't screw up anyone's device on accident. You can look through it and let me know if there are any problems or modify it yourself. It is your code, after all :)

Cheers

---------- Post added at 02:58 AM ---------- Previous post was at 02:51 AM ----------

Umm...sorry if i am noob
But where can i flash it or do with it
Thabks

Sent from my GT-N7000 using xda premium
All you have to do is download the zip file on the first page (There is a huge DOWNLOAD button at the bottom of the first post), and download n4root-windows.zip from the good man's github account.

Then you extract the files and run "n4root.exe".

There are a couple of bugs right now, though, so I would wait until the OP updates :)
 
  • Like
Reactions: cyr0s

cyr0s

Senior Member
Apr 28, 2012
84
88
0
Okay, I think I have gotten it working, although I am not sure if busybox installed correctly. There seemed to be a typo in that line, it was "busybox -- install" instead of "busybox --install". I could be wrong about it being a typo, but Windows and Android (tried it from cmd and in a shell) both complained about it :p

I will message you the modified code so I don't screw up anyone's device on accident. You can look through it and let me know if there are any problems or modify it yourself. It is your code, after all :)

Ah What a good set of eyes you have! I've pushed your modifications (and added brackets :))

BTW, good luck with tests and sure, I have no problem with you making a GUI of this :) (stick on github so I can fork)

V1.2 (1) (2) - Merged improvements of Kumouri​
 
Last edited: