natjohan's blog

Posted dim. 02 novembre 2014

Tip of the week 38

Install CyanogenMod 11 on your Samsung Galaxy S3 (i9300) from ElementaryOs/Ubuntu

This process is well tested on Ubuntu 12.04 (ElementaryOs), but it's the same approach in other distros

Download CyanogenMod image for your phone

Just go here and select your image to download. For the Samung Galaxy S3, I suggest to chose the latest snapshot which is more stable than the nightly builds.

Install Heimdall

Heimdall_ is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung mobile devices.

Installing Heimdall (no need the frontend part) :

$ sudo apt-get install libusb-1.0-0-dev

Download ubuntu12.10-heimdall_1.4.0-0_amd64.deb from and install it with dpkg (install with sudo aptitude install dpkg if needed)

$ sudo dpkg -i ubuntu12.10-heimdall_1.4.0-0_amd64.deb

Let's go !

Just boot your Galaxy S3 i9300 in download mode :

- Power off your Galaxy
- Boot the Galaxy S3 into download mode. Hold Home, Volume Down & Power. Accept the disclaimer on the device.
- Insert the USB cable into the device.

Download ClockWorkMod Recovery from (which is a ROM manager and installer)

Link for Galaxy S3 :

As CyanogenMod came without Google Apps, if you need them, just download it from

Now launch Heimdall in command line (replace recovery-clockwork- with the image that you just downloaded) :

Note that sometimes Heimdall command line output some errors like : libusb:error [op_open] open failed, code -1 errno 5 ERROR: Failed to access device. libusb error: -1 Just unplug/plug your phone and retry, it should be okay after several attempts

$ sudo heimdall flash --RECOVERY recovery-clockwork-
Heimdall v1.4.0

Copyright (c) 2010-2013, Benjamin Dobell, Glass Echidna

This software is provided free of charge. Copying and redistribution is

If you appreciate this software and you would like to support future
development please consider donating:

Initialising connection...
Detecting device...
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
RECOVERY upload successful

Ending session...
Rebooting device...
Releasing device interface...
Re-attaching kernel driver..
You phone should reboot, Be sure to reboot into recovery immediately after having installed the custom recovery (remove your battery for example). Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install)
=> Hold Home, Volume Up & Power

Normally you should see the ClockWorkMod logo (see under) with a menu

You can backup your actual system if you want Now Select wipe data/factory reset

Next, you have to install adb (Android Debug Bridge, it's a tool that allow you to open a terminal on your phone from an usb link) in order to put our zip files on your phone

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install android-tools-adb android-tools-fastboot

Plug your phone on your computer and launch an adb shell :

$ sudo adb shell

If you see a shell and you can execute command like ls, that's ok, just exit and under ClockWorkMod on your device just go under install zip => install zip from sideload

On your terminal launch :

$ sudo adb sideload

It will install the CyanogenMod ROM, just follow the same process for Google Apps (install zip => install zip from sideload) :

$ sudo adb sideload
Category: ToTW
Tags: linux ubuntu elementaryos cyanogenmod android