Nexus S - Root your phone with Ubuntu Linux



If you want to root your Google Nexus S, a lot of stuff is available on the net from different sites and forums.


But most of the stuff you get on the net is oriented toward using Windows tools.

Obviously you can handle all the needed steps from an Ubuntu workstation.

But all different steps are not trivial to setup and follow.

This article will explain all the steps needed to :
 * have your phone properly recognised by udev
 * OEM unlock it
 * install TWRP touch recovery
 * root it

The complete procedure has been tested on a Google Nexus S with Ice Cream Sandwich 4.0.4 and Jelly Bean 4.1.1 from a Ubuntu Precise 12.04 computer.

As a pre-requisite, you need to Install Android Tools on your Ubuntu box.

You have to understand that rooting your phone is always a little bit risky.
So, if you go further, do it at your own risk !

1. Create Udev rule for Nexus S

By default, Google Nexus S is not recognised as it should be under Ubuntu.

We need to declare some very simple udev rules for the Nexus S.

# sudo gedit /etc/udev/rules.d/51-android.rules
# sudo chmod 0644 /etc/udev/rules.d/51-android.rules


# Google Nexus S
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e21", MODE="0660", OWNER="yourlogin" #Normal nexus s
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0660", OWNER="yourlogin" #Debug & Recovery nexus s
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e20", MODE="0660", OWNER="yourlogin" #Fastboot nexus s

You should replace yourlogin by your standard Ubuntu login.

Once done, udev service has to be restarted.

# sudo service udev restart

2. OEM Unlock your phone

First main step it to unlock your boot loader.

This is a standard process on a Google phone.

But, as a safety feature, it will wipe all your data.

Your phone will be fully erased.
All your data will be lost.
So if you follow next step, your phone will be factory reset !

To do so, you need to come into fastboot mode by pressing Vol UP + POWER buttons at the same time while starting the phone.


Once you get this screen, just connect your phone to your computer with a USB cable.

Next, type the following to unlock your Nexus S/Nexus S 4G :

# ./android-sdk-linux/platform-tools/fastboot oem unlock

Your phone will display the following screen :


Hit the Volume Up button once to select Yes and then the Power button to validate and unlock your Nexus S.

Your screen should go back to fastboot and display a red line LOCK STATE – UNLOCKED.

3. Install TWRP recovery


TWRP is a new generation of recovery.

Its main advantage over ClockworkMod Recovery is to be usable straight from the touch screen.

You don't need anymore to use Volume or Power keys.

You can do all the job from the comfort of your touch screen !

Latest version is available from TeamWin Recovery Project site.

Select Nexus S device and follow the links to download the proper .img file.

If not already in fastboot, start your phone by pressing Vol UP + POWER.

Once ready, from your Ubuntu computer, flash a new recovery with this command :

# ./android-sdk-linux/platform-tools/fastboot flash recovery openrecovery-twrp-
sending 'recovery' (3612 KB)...
OKAY [ 0.524s]
writing 'recovery'...
OKAY [ 0.546s]
finished. total time: 1.070s

The last step is to root the Nexus S.

4. Get SuperUser files

You will have to download files from

These are the file that will be flashed on your phone to allow the super user privilege elevation.

At the time of this article the latest file is

5. Copy files with TWRP

Once done, we need to copy the file at the root of the phone SD card. We will do it using TWRP recovery.

Restart your phone under fastboot & select recovery menu by pressing Vol UP or Vol Down and selecting with POWER.

Your phone will now restart under TWRP recovery mode.

Select Mount menu and then Mount USB Storage. Your phone memory will be mounted as a USB disk.

Copy the freshly downloaded at the root of the mounted drive.

Once copy is over, select Eject on your computer to unmount your Nexus USB drive.

Select Unmount menu on the phone.

6. Flash the phone

Select Install menu and choose the newly copied archive.

Once finished you will get the following message :


Select Reboot system.

Once you've rebooted, you should get the Superuser icon in your applications list.


You're done, your Nexus S is rooted !

To access your TWRP recovery at anytime, you should also follow the procedure Android - Get rid of Recovery boot failure.

Hope it helps !

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus