Saturday, April 13, 2013

Step by step guide to installing CM 10.1 on HTC One X using Ubuntu

While I think the HTC One X is a great bit of hardware I find HTC's changes to Android a little annoying.  I use Nexus devices for my day to day use and find the more pure Android implementation provided by Google much better and generally more attractive than the HTC version.  Fortunately you can use CyanogenMod to get an experience much closer to Android the way Google intended it.  In this guide I will be installing CyanogenMod 10.1 which is based on Android 4.2.2(the latest version at the time of writing).

DISCLAIMER: as usual with all these types of guides it may void the warranty and I am not responsible for any damage you may cause to your phone.  I tested this with Ubuntu Gnome 13.04 and a UK O2 HTC One X with Android 4.1.1.  This process is going to wipe all the data off your phone so make sure everything important is synced and backed up first.

The following is a step by step guide to installing CyanogenMod on your HTC One X using Ubuntu Gnome 13.04.  It should work for other versions of Ubuntu also but I have only tested it in 13.04.  This guide assumes you have a totally unmodified HTC One X, if you have already completed some of the steps previously, ie: unlocking the boot loader or rooting just skip those steps.


Step 1 -Unlocking the bootloader

First you need to install adb and fastboot.

If you are using an Ubuntu version lower than 12.10 then use the instructions here
http://www.webupd8.org/2012/08/install-adb-and-fastboot-android-tools.html

If you are using Ubuntu 12.10 or above then just run the following at the terminal:

sudo apt-get install android-tools-adb

sudo apt-get install android-tools-fastboot

Fortunately HTC have made it really easy to unlock the bootloader on the One X.  The instructions on the HTC website are mainly based around using Windows  so I will detail exactly what I did for Ubuntu.  Simply follow this link and follow the instructions but refer back to here when the instructions are Windows specific.

NOTE:  at the time of writing the HTC One X is not in the devices dropdown so just select "All Other Supported Models".  You will also need to sign up for a HTC Developer account if you don't already have one.

You will need to follow the directions on page 1 of the "Unlocking Bootloader Instructions" but step 2 is only relevant to Windows so you can just skip straight to Step 3.

On step 3 you need to get the identifier token by entering the following at the terminal:

sudo fastboot oem get_identifier_token

The example given on the HTC site is for Windows but you essentially do the same thing for Ubuntu, just copy the text as shown in the screenshots and paste it into the form at the bottom of the page.

After submitting your identifier token you will be sent an email with further instructions on unlocking your bootloader and a attachment named Unlock_code.bin.  Download the Unlock_code.bin attachment and then open a terminal and change to the directory that you placed the downloaded file in.

Run the following command in the terminal:

sudo fastboot flash unlocktoken Unlock_code.bin

Step 2 - Install ClockworkModRecovery

Download the img file for your HTC One X Variant from here:
http://clockworkmod.com/rommanager

Boot into fast boot by first turning off your device and then turning it on by holding the power and volume down buttons together.  Then use the volume buttons to move up and down and the power button to select "FASTBOOT" and then connect the USB cable.

Then in the terminal run the following command:

sudo fastboot flash recovery recovery-clockwork-touch-5.8.4.0-endeavoru.img

NOTE: the version number in the file name may be slightly different to my example above so adjust accordingly.

Now select "POWER DOWN" from the fastboot menu and disconnect your device from the USB cable.

At this point I strongly recommend making a backup of your current installation, to do this boot back into the fastboot menu(by holding power and volume down to turn the device on).  Then use the volume buttons to navigate to "RECOVERY" in the menu and then press power to select it.  Your device will now load the ClockworkMod Recovery menu.  Select "backup and restore" from the menu and then select "backup".  Once the backup has finished reboot the phone and connect it to your USB cable and open your phone storage in your file manager.  The backup should be located in the the "clockworkmod" folder, copy the backup to your computer so that you can do a restore if anything goes wrong.

Step 3 - Install CyanogenMod

Now download the latest CyanogenMod 10.1 nightly for the One X from here:
http://download.cyanogenmod.org/?device=endeavoru&type=nightly

and the latest Google Apps zip from here:
http://wiki.cyanogenmod.org/w/Gapps

Extract the file boot.img from the CyanogenMod zip file by running the following command:

unzip -p cm-10.1-*-NIGHTLY-endeavoru.zip boot.img >boot.img

Turn your device on and once it has booted connect the USB cable.

Copy the CyanogenMod zip file and the Google Apps zip file to the internal storage on the phone(I put them in the Download folder) then power off the device.

Now boot your phone into fastboot mode by holding power and volume down at the same time and selecting "FASTBOOT" from the menu and then connect your phone to the USB cable.

Flash the new boot image by running the following command in your terminal:

sudo fastboot flash boot boot.img

Once the command has run select "HBOOT" to return to the main menu.

Select "RECOVERY"

Select "wipe data/factory reset" and confirm

Select "install zip from sdcard"

Select "choose zip from sdcard" and then choose the CM nightly zip and then confirm that you want to install it.


Select "choose zip from sdcard" again but this time choose the Google Apps zip file and confirm.

Navigate back to the main menu and select "reboot system now".

The first boot after the CyanogenMod install will take a little longer than usual so give it a few minutes to boot up.  After that you should see all the first run Android stuff like adding your Gmail account etc.

I hope this helps, I struggled to find a concise step by step guide for doing this on Ubuntu so I figured I would document the process for the benefit of all.

Sources:
http://reviews.cnet.co.uk/mobile-phones/how-to-root-the-htc-one-x-50010022/
http://www.android.gs/update-htc-one-x-to-android-4-2-2-jelly-bean-cm-10-1-nightly-rom/
http://www.ibtimes.co.uk/articles/414645/20121213/install-android42-jellybean-htc-onex-cyanogenmod10-cm10.htm



Friday, April 12, 2013

Create New Document context menu item missing in Nautilus 3.6.3

I recently installed the new Ubuntu Gnome 13.04 which comes with Nautilus(Files) 3.6.3.  While I am loving Ubuntu Gnome one annoying thing missing from Nautilus(Files) is the ability to right click and create a blank file(previously called "Create New Document" in the context menu) .  It was decided that this feature would be removed in the newer versions of Nautilus which seems like a strange feature to remove to me as it is incredibly useful.

If you would like to add the option back in you simply need to run the following command at the Terminal:

touch ~/Templates/Text\ File.txt

NOTE: you can add other types of files to the templates folder and they will also appear n the context menu.

Sunday, April 7, 2013

Install LAMP in Ubuntu 13.04 Raring(Apache, MySQL, PHP)


This is a short guide to installing a basic LAMP(Linux, Apache, MySQL, PHP) development environment on Ubuntu 13.04 Raring Ringtail.

First install lamp:
Open a terminal and run the following:

sudo apt-get install lamp-server^

After the lamp server installation you will need write permissions to the /var/www directory.  Follow these steps to configure permissions.

Add your user to the www-data group

sudo usermod -a -G www-data <your user name>

now add the /var/www folder to the www-data group

sudo chgrp -R www-data /var/www

now give write permissions to the www-data group

sudo chmod -R g+w /var/www

now log out and log back in to see the changes reflected in nautilus.

Some extra things to install
The following are not essential but they are things I almost always need as part of a LAMP install so I have included instructions on installing them.

Curl:

sudo apt-get install php5-curl

Mod rewrite:

sudo a2enmod rewrite

To enable mod rewrite you also need to do some apache configuration:

sudo gedit /etc/apache2/sites-available/default

and change AllowOverride from None to All:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

sudo /etc/init.d/apache2 restart

GD2 Graphics Lib:

sudo apt-get install php5-gd

Turn on error messages
If you are setting up a dev environment then you will want to turn on error messages too. To do this run the following:

sudo gedit /etc/php5/apache2/php.ini

then find the line that looks like this(around line 480):

display_errors = Off

and change it to

display_errors = On

There are a bunch of other error reporting variables you can turn on in the php.ini file for development purposes, they are well commented so just turn on any that you think will be useful.

I also highly recommend making the same changes to the php.ini file that is used when running php scripts from the command line(this includes cron jobs), just run the following command to open it and make the same changes you did above.

sudo gedit /etc/php5/cli/php.ini

And that's it, how easy was that?  Ubuntu rocks!

Saturday, April 6, 2013

Can't install Chrome on Ubuntu 13.04

Having just installed the Ubuntu Gnome 13.04 Beta 2 one of the first things I went to do was install Google Chrome.  Unfortunately after opening the chrome deb file in the software center I was greeted with the following message:

Dependency is not satisfiable: libudev0(>=147)

libudev0 has been removed from the 13.04 repositories so until a patch is issued for Chrome you will need to download and install the deb files before installing Chrome.  I imagine that there will be a patch issued for Chrome very soon but in the meantime choose the appropriate file below and install it and then try installing Chrome again.

for 32 bit:

http://launchpadlibrarian.net/132294322/libudev0_175-0ubuntu19_i386.deb

for 64 bit:
http://launchpadlibrarian.net/132294155/libudev0_175-0ubuntu19_amd64.deb