Rss

Archives for : Software

Installing Ubuntu Touch onto Nexus 7 2012 from Fedora 20 (in depth)

Ubuntu Touch on Nexus 7 (2012)

When I started looking at installing Ubuntu onto my rarely used Nexus 7 2012 edition tablet, I hadn’t considered how much of a right pain in the arse it would be if you weren’t running Ubuntu.

Turns out, if you’re running Ubuntu, it should be a walk in the park, if you’re running anything else, in my case, Fedora 20, it’s more complicated.

So, this is a guide to installing Ubuntu Touch onto a Nexus 7 2012 (mine is 8GB WiFi only, your mileage may vary).

What I will guide you through is the following.

I will show you how to install the AndroidSDK Tools
I will show you the steps to take a backup (if you so wish)
I will show you how to unlock your device
I will show you how to install the developer release of Ubuntu Touch

This is a collection of various guides and my own experiences, I had about 10 installs of it manually with it booting to a black screen before I turned to IRC and received some guidance, it was still not straight forward though. Most people in that channel had Ubuntu, so tough crowd. They were all nice though, not one told me to RTFM, maybe because there isn’t one?

{Before continuing, please read the disclaimer here: https://wiki.ubuntu.com/Touch/Install }

Some foolish assumptions:

1) You are happy to lose all the data on your Nexus 7 as it is now.
2) YOU ARE HAPPY TO LOSE ALL THE DATA ON YOUR NEXUS 7!
3) You are willing to risk bricking your device for a developer release of Ubuntu Touch
4) You have a working installation of Fedora (I’m only claiming this will work on 20 but should be fine on many previous releases)
5) YOU ARE HAPPY TO LOSE ALL YOUR DATA! Don’t come crying to me if you brick it too. I’ve installed this many times and it’s not bricked mine, if you manage to brick yours, sorry, you were warned.
6) You know your way around the Linux system a bit (this guide was getting huge, it starts off detailed, but tails off after I added this assumption.
7) $ means running as user, # means running as root

OK, with that out of the way, lets proceed, allons-y!

Step 1) Getting yourself the android gubbins, adb, fastboot, etc, in detail:

Download the SDK from here, http://developer.android.com/sdk/index.html

At the time of writing, it was around 475MB and there are two versions:

1) adt-bundle-linux-x86_64-20131030.zip for 64bit systems
2) adt-bundle-linux-x86-20131030.zip for 32bit systems

Unpack it in your home directory, then rename it to ~/AndroidSDK

Add into path variable ~/AndroidSDK in .bash_profile file in your home directory. So use your favourite editor to open up that hidden file to edit.
For example add to the end of your PATH list the following, you split the options up with colons ‘:’

$HOME/AndroidSDK:$HOME/AndroidSDK/tools:$HOME/AndroidSDK/platform-tools

So, it should look something like this:

PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HOME/AndroidSDK/sdk:$HOME/AndroidSDK/sdk/tools:$HOME/AndroidSDK/sdk/platform-tools

Keep the rest of the file unchanged, save it.

Now, you’ve done that for your user, however, we’re going to be using some other tools, such as sudo and the root users profile. So, make yourself root, either using sudo or su and edit their ~/.bash_profile too and add that AndroidSDK line, HOWEVER, you will need to make $HOME the full path to your home directory, otherwise it will use /root, which is wrong, unless you’ve installed it as root, which is also wrong (well, bad practice).

I mentioned sudo, if you’ve not already got it, install sudo:

# yum install sudo

Once that is installed, add your user account to the sudoers file in /etc/sudoers, again, bad practise to do this as it opens up the option to run any command as root under your account, but for purposes of this, put this into /etc/sudoers

lee ALL=(ALL) ALL

this would be near something looking like this in the commands section:

root ALL=(ALL) ALL

Once you’ve added that, near the top of the file, you also want to add the path to AndroidSDK like we did before, but this is so sudo works, it doesn’t use PATH it uses a SECURE_PATH variable which is defined in this file. So, add the path variables to that secure_path, for example, mine is:

Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/home/lee/AndroidSDK/sdk:/home/lee/AndroidSDK/sdk/tools:/home/lee/AndroidSDK/sdk/platform-tools

Save the file.

Now, as root, run this command to invoke the paths in your bash_profile:

source ~/.bash_source

as yourself, run the same command. This avoids having to log out and back in again.

Now, running the following commands should output something familiar:

$ echo $PATH
# echo $PATH
$ sudo echo $PATH

Happy, good.

Now, what we have should be the Android bits in our paths as root, ourselves and running as sudo, so to check that, you can type into a terminal, this:

$adb version

my output is: Android Debug Bridge version 1.0.31

#adb version

$sudo adb version

they should all be successful and return information.

For thoroughness, also check this returns something, as it is also used:

$fastboot help

#fastboot help

$sudo fastboot help

This is the safest way to check fastboot, none of the above should return “command not found” if it does, then you’ve set one of the paths wrong in the above, go over it again, verify where your SDK tools etc are and amend as needed.

Editing your udev rules for device detection:

For ease, I’ve provided my udev rules here: http://pastebin.com/yvsCsXcH

Please append or copy this to the directory /etc/udev/rules.d/ you will need to be root to do this, or at least running the command as sudo

Enable debugging mode in your Nexus 7:

If not enabled, enable developer mode, by tapping Settings -> About phone -> Build number (x 7 times)
If not enabled, enable USB debugging in Settings -> Developer options -> USB debugging
Power on your Nexus 7, and plug it into your computer.

Run this command to check that you can see your device after a minute:

#adb devices

You should see something like this:

List of devices attached
012a2509bb200c12 device

2) Backup your Nexus 7 (if you want to, if you don’t care about returning to this state, skip this step)

To do this, navigate to a directory you want to save your backup to and run this command:

$adb backup -apk -shared -all

You will need to accept the prompts on your Nexus 7 screen and allow the backup to happen.

This will then backup to your directory for later if you want to restore your Nexus 7.

3) OEM Unlock your device to allow the custom bootloader and recovery to be installed:

If the device is already unlocked, skip this step. These steps will wipe all personal data from the device. If you want to keep this, then backup yourself, AND do step 2. If step 2 doesn’t work, or you can’t restore from it, this isn’t my fault.

With the device powered off, power on the device by holding the Power button + volume up + volume down.
The device will boot into the bootloader. Android lying on it’s back.
Plug the device into the computer via the USB cable.
On your computer, start a terminal. Type sudo fastboot oem unlock, followed by Enter

On the device screen, accept the terms of unlocking.
Boot the device by pressing the power button (pointed by an arrow with Start on the screen).

Device factory reset

If you get stuck in a bootloop rebooting the tablet after unlocking the bootloader… Here’s what you do:

During the bootloop.. hold the power button + volume up + volume down button simultaneously to get yourself back into fastboot mode as you were previously.
In fastboot mode.. use the volume keys to scroll to Recovery and the power button to select it.
In Recovery (Android robot on his back with a red triangle)… tap the volume up button and the power button simultaneously which will bring you into stock recovery. Again.. Don’t hold the buttons, just tap them simultaneously. Also make sure you’re holding the correct volume button. Up will be the volume key on the right.
Once you’re in Recovery.. perform a factory reset/data wipe and then reboot your tablet… you should now be back to the Welcome Screen.

4) Enable Debug mode and start adb:

Follow these initial steps on your device:

If not booted, boot the device into Android
Enable USB debugging on the device

on Ice Cream Sandwich (version 4.0) go to Settings and turn on USB Debugging (Settings > System > Developer options > USB debugging).
on Jelly Bean (versions 4.1 and 4.2) you need to enter Settings, About [Phone|Tablet] and tap the Build number 7 times to see the Developer Options.

on 4.2.2, (settings > about > tap on build number 7 times to activate the developer options menu item).
On either Android version you must then enable USB debugging via Settings > Developer options > USB debugging. You will also need to accept a host key on the device.

On the workstation-> adb kill-server; adb start-server
Plug the device into the computer via the USB cable.

Depending on the installed Android version, a popup will show up on the device with the host key that needs to be accepted for the device to communicate with the workstation.

Note, ‘adb devices’ should not show the device as ‘offline’. If it does, unplug the device, run adb under sudo on the workstation (sudo adb kill-server; sudo adb start-server), then plug the device back in.

In some cases, the device will continue to show offline, and the host key popup will not appear if the USB connection method is ‘MTP’ (default for some devices and versions of Android). Unchecking all options in the USB connection method (Settings -> Storage -> Menu -> USB computer connection -> MTP, PTP) seems to resolve this adb connection issue for some users.
Save the version of the current image on the device, if on Android, to use as a reference to revert back to. The version can be found by going to Settings > About Phone > Build Number.

5) Install Ubuntu flashing tool.

On the guide here: http://developer.android.com/sdk/index.html you will see many references to phablet-flash this is packaged in phablet-tools but is generally Ubuntu only, a helpful member of the Ubuntu community rewrote this Python tool into Go, another programming language which is easier to install.

So, firstly, install Go and Bazaar and any dependencies:

yum install golang bzr

Now, make a directory for your Go programs:

mkdir ~/gocode

then add it temporarily to your path:

export GOPATH=$HOME/gocode/

run this command to check it’s worked:

echo $GOPATH

Install Ubuntu-Device-Flash:

go get launchpad.net/goget-ubuntu-touch/ubuntu-device-flash

This, all going well, should download and install to gocode in your home directory, it doesn’t take long, seconds.

6) Flash your Nexus 7:

Change into the tool directory go the ubuntu-device-flash Go program:

$cd $GOPATH/bin/

Ensure your Nexus 7 is off, and plugged into your computer via USB.

Put your Nexus 7 into bootloader mode, with the device powered off, power on the device by holding the Power button + volume up + volume down.

Now, in a terminal, run this command to begin the flashing process, this should take care of everything, the whole process will take more then 10 minutes but should be less then 30.

./ubuntu-device-flash -bootstrap -channel=trusty

Now, it will go off to the website, download the trusty (developer version) of Ubuntu Touch for Nexus 7 (it detects your device) and install all the bits.

If successful, your Nexus 7 should reboot into recovery a couple of times, and reboot, once done, it should be at the Ubuntu Touch screen, if the screen is just black, and has been like that after rebooting, press the power once, it should wake up with Ubuntu Touch on your screen. If not, start again, probably from the bootloader screen mentioned above.

Thanks for reading, this is VERY VERY rough and too detailed in parts and not detailed enough in others, you might call it a brain fart. I’ll improve it if the interest is there.

Restoring Android (taken from: https://wiki.ubuntu.com/Touch/Install#Restoring_Android )
The Ubuntu Touch Preview image is not for everyone and may not suit your current needs (yet). The images can be found here. If you wish to roll back to an Android factory image, follow these steps:

Recall the version that was installed before flashing.
Download the factory image corresponding to your device’s model and version (initial table has links).
Ensure the device is connected and powered on.
Extract the downloaded file and cd into the extracted directory.
run adb reboot-bootloader

run ./flash-all.sh (use sudo if lack of permissions on the workstation don’t allow you to talk to the device).

If you want to lock the bootloader after restoring the factory image, follow these steps:

Power on the device by holding the Power button + volume up + volume down.
The device will boot into the bootloader.
Plug the device into the computer via the USB cable.
On your computer, press Ctrl+Alt+T to start a terminal. Type sudo fastboot oem lock, followed by Enter

Your device should boot into Android after the process is finished.

Once booted into Android, to restore your data you will need to do an initial setup of Android so you can enable the developer tools.

Once USB Debugging has been turned back on, plug it into you PC via USB if it’s not already and on your computer navigate to the folder where you stored your back and run this command:

$adb restore backup.ab

Follow the prompt on your tablet, press Restore my data.

Wait a while, if its a big backup, could take a long time.

That’s it. Hope this helped at least one person out there, even if it’s myself in a years time.

Site Resources:

http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development

https://wiki.ubuntu.com/Touch/Install

https://launchpad.net/phablet-tools/ubuntu-device-flash

https://developers.google.com/android/nexus/images

The value of teaching coding at a young age.

5 Reasons to Teach Kids to Code

by NowSourcing.
Explore more infographics like this one on the web’s largest information design community – Visually.

Odd Galaxy Nexus Data Usage Bug

I saw on a screenshot from a Galaxy S2 a dotted line predicting data usage based on current usage which I’d not seen on my Galaxy Nexus.

I had a look and it was true, it wasn’t there, I checked then menu to see if there was a way to turn it on, and stumbled across what seems to be a bug.

Here is how to repeat it, this is on my UK Galaxy Nexus running stock Android 4.0.4.

image

Go to settings and choose Data Usage

image

As you see, no prediction line.

image

Select Show Wi-Fi usage from the menu.

image

Press the Wi-Fi tab and then go back to Mobile

image

There you go, the dotted prediction line is visible.

Spotify Fedora Installer Script

A quick post just to put the installer script I’ve done for Fedora to get Spotify installed from the latest Debian packages available from their servers:

Tested on Fedora 16 32bit, Fedora 16 64bit, Fedora 17 64bit. All fine so far.
No uninstall script just yet though, I’ll likely incorporate it into this script anyway and have it as an option. -i install -u uninstall maybe.

#!/bin/bash
#
# This script will download the .deb packages, unpack them and put the bits where they need to go.
#
# This does not have an uninstall element to it, nor does it keep it up to date. Sorry.
#
# Updated to just work and grab everything required rather then searching out a specific
# This needs to be ran as root, because it extracts files into /usr/bin and /usr/share which is root only. sudo should work.

echo "Grabbing dependancies, say yes to this or Ctrl+C to cancel the script."

yum install binutils qt-x11 openssl nss nss-util nspr qtwebkit libpng-compat libXScrnSaver

mkdir -p packages/client/gnome
cd packages/client
lftp -e 'mget spotify-client-gnome-support;exit' http://repository.spotify.com/pool/non-free/s/spotify/
ar xv spotify-client-gnome-support_*.deb data.tar.gz
tar -C / -xf data.tar.gz
cd gnome

if [ "$HOSTTYPE" == "x86_64" ]; then
lftp -e 'mget amd64;exit' http://repository.spotify.com/pool/non-free/s/spotify/
ar vx spotify-client_*_amd64.deb data.tar.gz
tar -C / -xf data.tar.gz
ln -s /lib64/libssl.so.10 /lib64/libssl.so.0.9.8
ln -s /lib64/libcrypto.so.10 //lib64/libcrypto.so.0.9.8
ln -s /lib64/libnss3.so /lib64/libnss3.so.1d
ln -s /lib64/libnssutil3.so /lib64/libnssutil3.so.1d
ln -s /lib64/libsmime3.so /lib64/libsmime3.so.1d
ln -s /lib64/libplc4.so /lib64/libplc4.so.0d
ln -s /lib64/libnspr4.so /lib64/libnspr4.so.0d

elif [ "$HOSTTYPE" == "i386" ]; then
lftp -e 'mget i386;exit' http://repository.spotify.com/pool/non-free/s/spotify/
ar vx spotify-client_*_i386.deb data.tar.gz data.tar.gz
tar -C / -xf data.tar.gz
ln -s /lib/libssl.so.10 /lib/libssl.so.0.9.8
ln -s /lib/libcrypto.so.10 /lib/libcrypto.so.0.9.8
ln -s /lib/libnss3.so /lib/libnss3.so.1d
ln -s /lib/libnssutil3.so /lib/libnssutil3.so.1d
ln -s /lib/libsmime3.so /lib/libsmime3.so.1d
ln -s /lib/libplc4.so /lib/libplc4.so.0d
ln -s /lib/libnspr4.so /lib/libnspr4.so.0d
fi

# for some reason Spotify is linked against specific libraries, but we can fake it with symlinks.

echo "Done, you should now be able to excute the spotify command succesfully. If not, something went wrong. Sorry"

I’ll put up another download at some point, but for now, that should work if you put it in a script and execute it as root.

VMWare vSphere 5.0 and an HP X1400 NAS Server

I spent a good while debugging this not wanting to change too much incase it was something bizarre.

Turned out to be something simple.

OSTicket Invalid Source Problem

So, we use OSTicket at work, and for the most part it works well. However, there are parts which are a little buggy.

One of these appears to be that, when we were trying to create a New Ticket using the New Ticket option when you’re signed in, it would highlight the Source field and give the error “Invalid Source”.

This happened no matter what option from the drop down you would choose.

I had a look at the code, and made a guess at the problem, at it appears to work:

In the file: scp/tickets.php

Change

Line 319:

if($_POST['source'] && !in_array($_POST['source'],array('web','email','phone','other')))

to

if($_POST['source'] && !in_array($_POST['source'],array('Web','Email','Phone','Other')))

This appeared to resolve my problem and the ticket was logged successfully without error.

Honeycomb, the Windows ME of Android?

Is Honeycomb the new Windows ME?

I’ve been playing around with my Hannspree Hannspad that I bought a few months back, and sure, its a budget tablet, but I think Ice Cream Sandwich will make it much better.

I don’t know what I’m holding out for, something between Honeycomb and Gingerbread. I’ve used a Honeycomb ROM on my Hannspad, and I’ve also tried Froyo and Gingerbread ROMs, and I’ve come back to Gingerbread since trying all.

I suspect that with very few Honeycomb specific apps around and ICS (Ice Cream Sandwich) just around the corner, development on Android Honeycomb will halt and ICS will be its successor.

What do you think?

Quick and Dirty Plain text to ttx file generator.

I had the requirement for some tests to turn a big plain text file into a “more or less” formatted correctly ttx file.

Now, this is by no means something that you would want to open in Trados to start editing with etc, but it does surround the lines with Trados TTX tags in sufficient detail for me tests.

Get the script here: http://www.leenukes.co.uk/downloads/TXTtoTTX.py

Now I know, its messy, but I don’t care at the moment as it worked for me and saved me copying and pasting over 1400 tags to lines of text.

I also didn’t find anything online that would do this for me, hence me writing this. I’m not a programmer, and I know actually outputting XML using elementTree would be better, but it was more work to do that then I was willing to spend at the time.

This small piece of code would benefit from reading in language options from the user, and then slotting them into the tags and it would also benefit from a re-write to allow it to output XML correctly as at the moment it reads in the file stated, and outputs it wrapped.

Characters that are not valid XML still go through, for example if there is an & in the file, it will wrap that too, it doesn’t care. & isn’t valid XML amongst other characters and is commonly substituted with &

Call this script whatever you want, but I was calling it TXTtoTTX.py

So, what does it do?

Lets say you have a file with 3000 lines of text in it called mytesttext.txt, you would use this python script as follows:

python TXTtoTTX.py mytesttext.txt

this will then output it to screen for you to quickly check, then you can redirect the output to file like this to save it:

python TXTtoTTX.py mytesttext.txt > mytesttext.ttx

Wayland

Not long until Fedora and Ubuntu release their distress with Wayland instead of X.

I’m looking forward to it but my worry is with drivers. I like to use the proprietary drivers for the performance gains as I sometimes play 3D games and use 3D effects on the desktop.

Anyone else interested in Wayland and what it will bring?

Fedora 14

I recently installed Fedora 14 Beta Release 2 on my desktop PC at home and I’m going to go so far as to say its the best Fedora release I’ve used.

It was an upgrade of the existing Fedora 13 installation which in my opinion seemed pretty buggy, no specifics, it just didn’t feel very polished.

Totally the opposite for this release, just a couple of issues at present which are no problem really. The flash player is having some issue with creating crackling electronic noises when playing videos online such as YouTube etc but I’m hoping this resolves itself. I’ve tried reinstalling the plugin from Adobe but had the same issue. Same issue in Chrome as well as Firefox also.

It’s due out in a few days now. I also updated my netbook to Ubuntu 10.10, I’m not that impressed with this release though. Not a fan of the new Unity interface. Never really been a fan of sidebars. There is probably a way of getting the windows to overlap it, but for now I’m not impressed. They’re always breaking things those Ubuntu people. Grrr.