As any mobile device without root access is pretty useless I decided to unlock and root my new Nexus 7 with 3G as my live isn’t complete without root access on all my devices 🙂

Update for android lollipop, http://www.childsplay.mobi/blog/?p=274

 

Warning: you can screw your device, and the rest of the standard bla bla

But lets be honest, a device without a root shell is basically screwed in the first place so lets go ‘unscrew’ your device 🙂

As the unlocking is somewhat drastic, it will basically reset the device to the factory state, it’s best to do it as soon as possible.
Everything you put onto the device will be removed.

On the upside, Nexus devices are very easy to unlock, nothing special about it as Google considers removing root just a way to protect stupid users from themselves so there’s no need for real hacking.

We will just use regular developers tools.

Unlocking bootloader

Here we go:

First you must have the adb tool which is part of the android-sdk.
http://developer.android.com/sdk/index.html

Now get your “developer options” back under ‘settings’ on your device.
With android 4.2 the dev options are hidden but they are easy uncovered:
Go to Settings -> about tablet -> Now hit ‘build number’ 7 times. For real, no joke, lets say the guys at Google still have a sense of humor 🙂
You now have “developer options” back in your settings menu.

In settings -> developer options -> enable USB debugging.

Now go into the SDK -> platform-tools.

First check to see that the device is found:

~/android-sdk-linux/platform-tools$ ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
015d4**********    device

Unlock bootloader:

~/android-sdk-linux/platform-tools$ ./adb reboot bootloader

Use the power button on the nexus to say yes.

Now we can talk to it with ‘fastboot’. (Do this only once unless you want to reverse it)

~/android-sdk-linux/platform-tools$ sudo ./fastboot oem unlock
[sudo] password for stas: ...
(bootloader) erasing userdata...
(bootloader) erasing userdata done
(bootloader) erasing cache...
(bootloader) erasing cache done
(bootloader) unlocking...
(bootloader) Bootloader is unlocked now.
OKAY [ 24.176s]finished. 
total time: 24.176s

It’s now unlocked and stays unlocked, no update will lock it again.

When you device get unresponsive or whatever, hold down the power button for some time until the device switches off.
Then restart it by holding down the volume down button and powerbutton at the same time until you are back in the bootloader

Now we must wipe the data.

Use the volume down to select “recovery mode”
Use the power to select it.

You will see a android with a red exclamation mark.

While holding down Power, press Volume Up.

Use the volume keys to scroll to “wipe data/factory reset” and press Power to select it.

Installing clockwork recovery image

Download the correct image for the Nexus 7 to the adb directory: http://download2.clockworkmod.com/recoveries/recovery-clockwork-6.0.2.3-tilapia.img
(the touch variant didn’t work on my device)
Download to the adb directory the ‘root’ binary, SuperSu : http://download.chainfire.eu/310/SuperSU/UPDATE-SuperSU-v1.04.zip

Now connect device again to your computer as a ‘camera’ because my Linux system doesn’t handle the default “MTP” protocol very well.

Copy the SuperSu program to your device:
I use the adb as the Nexus doesn’t expose itself as a usb device so the mormal access to the device filesystem is limited from a computer.

~/android-sdk-linux/platform-tools$ ./adb push UPDATE-SuperSU-v1.04.zip /mnt/sdcard/Downloads/UPDATE-SuperSU-v1.04.zip
761 KB/s (899752 bytes in 1.154s)

Shutdown the device and restart it into recovery mode (powerdown and volume down)

Flash the recovery image:

~/android-sdk-linux/platform-tools$ sudo ./fastboot flash recovery recovery-clockwork-6.0.2.3-maguro.img 
sending 'recovery' (5990 KB)...OKAY 
[  0.722s]writing 'recovery'...OKAY 
[  0.635s]finished. total time: 1.357s

Reboot it into bootloader again:

~/android-sdk-linux/platform-tools$ sudo ./fastboot reboot-bootloader

Go into recovery:

Choose:

Install zip from sdcard -> choose zip from sdcard -> 0/ -> Downloads -> UPDATE-SuperSU

Check the output for errors.

Choose Go back -> reboot system

Install a terminal app, Android Terminal Emulator from Jack Palevich is a good one.

Start the terminal and type at the prompt “su”

The program SuperSu should ask you if you want to grant superuser permission, say yes.

And you have a root shell 🙂

Yeahhh a black screen with a # as prompt, now your live is complete again 🙂

 

What to install when your root ?

Make sure you never ever download apps from outside the googleplay store, remember you can become root now and so can some apps.

First of all rommanager from clockworkmod.com. It’s the same stuff  you flashed as a recovery. From this app you can easily reflash recovery images from your device itself.

Titanium backup. It’s been a real livesaver for me a number of times. I myself have purchased the pro version it’s much quicker and it’s a must have app on any rooted device.