Rooting the Nexus S from Ubuntu
Previously I had posted how to unlock the android Nexus S phone from Ubuntu. This continues that process to completely root the phone. A follow-up entry will explain what to do with root once you've got it.
The general process is to replace the default 'recovery' mode on the phone with a custom one that will let you install packages, fix some permissions, and make it so that your changes don't get reverted later. This is not the same as replacing the OS with a custom version (or "Mod"), though it does make it so you can do that later if you so desire. Once the custom recovery image is in place, you simple install the "su" executable so that your apps can actually get root access.
- Download the "Touch Recovery" image for the Nexus S from Clockworkmod's website.
- download the "SimpleRoot" zip by xda-developer kibmcz. This contains 'su', 'Superuser.apk', and a copy of busybox. It also has some simple scripts to prevent the stock recovery from being restored on reboot, since that would revert all of these changes. I would love to have a non-mediafire link to this.
This process doesn't do a phone wipe, which is pretty awesome. I still did backups anyway, because you never know. If you accidentally flash the wrong recovery image, you can brick your phone, so don't do that.
- On your computer, rename the clockworkmod recovery image to be just "recovery.img".
- plug your phone into your computer using USB (should appear as a USB device after the udev changes from my last article).
- copy the SimpleRoot zip to your phone's sd card. Anywhere is fine, so long as you can find it on the phone later.
- "eject" or unmount the phone's sdcard drive from your computer - right click on the drive in the launcher and choose 'eject' works fine.
- power off the phone
- reboot the phone into 'fastboot' mode by holding both the volume-up and power buttons until it boots
- make sure the phone appears as a fastboot device. I had to use sudo for this for whatever reason.
- in a terminal, run:
sudo fastboot devices
- make sure at least one device ID shows up. Don't worry if it's just hexadecimal jibberish, so long as something appeared.
- if it doesn't show up, try unplugging and re-plugging the phone into your computer. I didn't have any problems.
- in a terminal, run:
flash the recovery image to your phone!
sudo fastboot flash recovery /path/to/recovery.img
The output should look like:
sending 'recovery' (4724 KB)… OKAY [ 0.656s] writing 'recovery'… OKAY [ 0.682s] finished. total time: 1.338s</pre>
- on the phone, navigate to and choose the 'recovery' option.
- the phone will reboot, and hopefully take you to the clockworkmod recovery screen!
- select the "install zip from sdcard" item
- select the "choose zip from sdcard" item
- browse the sd card to find "Simple-Root-1.0.zip" and select it
- confirm that you want to install it
- watch things scroll, it should say "Installation complete", plus details of what exactly it did
- select the "Go Back" menu item
- select "reboot system now"
- hope for the best….
- during the normal boot, it will claim "Android is upgrading", which is okay.
- at this point it should boot to your regular phone homescreen.
Test it Out!
Most of the guides out there fail to say how to check if it actually worked. Having a working phone is a good first step though.
One note, apparently the USB debugging got turned off along the way (?!), so I had to re-enable it to get the phone to show up in adb devices again.
- Load up Connectbot. Install it if you need to, it's very useful.
- choose a "local" connection type
- give the connection a nickname like 'localhost'
- once on a command line, enter "su"
- if it brings up a confirmation prompt asking to give connectbot permissions, then it worked!
- the prompt should change from a $ to a #, and you can now browse anywhere on your phone. Careful not to wreck anything though. :)
Here are some of the things that I plan to do with root access:
- remove the bloatware (not that there is much on a Nexus S)
- install an ad blocker
- install a firewall
- make full backups
- install busybox (most unix commands)
- disable the terrifying battery low sound
I mostly followed this article on rooting the nexus S, but ignored the OS-upgrade part, since I've already got the latest. This is also where I got the link to SimpleRoot.