Developing for Ubuntu on a tablet

With the arrival of my loaner Nexus 10, I’ve been having fun getting a good development environment up and running for some definitions of fun: there are a few weird spots in the process. A lot of this comes from the wiki, but I think it’s good to have a list of steps handy for getting the environment up and running all in one place.

1. Get set up for accessing the tablet

First, you’ll need to get all of the tools handy for accessing the tablet from your development box. This includes the phablet tools as well as the tools for working with an Android device.


sudo add-apt-repository ppa:phablet-team/tools
sudo apt-get update
sudo apt-get install phablet-tools android-tools-adb android-tools-fastboot

Make sure that you can see the device from your computer:


$ adb devices
List of devices attached
XXXXXXXXXXX device

If it isn’t showing up, make sure that the adb server is up and running as root:


adb root

Next, flash the device with the latest daily build of Ubuntu for tablets (this presumes that the tablet came with Ubuntu already on it, as mine did. There are instructions for starting from Android). Note, the tablet must be up and running in the OS, not recovery or bootloader mode!


phablet-flash -b -l

The -b flag bootstraps the device – if you have already done this, you may leave it off. This will pull down all of the images needed for the tablet and install them onto the device.

2. Setting the tablet up for remote control

You’ll have to get SSH running on the tablet to effectively develop on the tablet, as logging in with the ‘phablet’ user allows you to start programs as that user. This takes a few steps:


adb root # make sure the adb server is running as root
adb shell
ubuntu_chroot shell
su - phablet

This will get you into the tablet’s shell and the ubuntu container, and then running as the phablet user. From here, you can install openssh-server:


sudo apt-get install openssh-server

Once openssh is installed, grab the IP address with ip addr show wlan0 and then log out of the tablet (ctrl+D three times to get out of the nested sessions). Now you can ssh into the tablet with ssh phablet@[ip_addr] and the password “phablet”.

3. Developing on the tablet

The reason for setting the tablet up like this is so that you can use the Browser inspector tool. To do so, log into the tablet through ssh as above, and then run the browser app with the following command:


webbrowser-app --inspector http://uistage.jujucharms.com:8080

This will open UIStage (or, more usefully, you can provide the link to your current branch) in the browser and run the inspector. Pay attention to the command’s output, as it will give you a link for the inspector. You can visit that link in a browser on your development computer and use something very similar to Chrome’s developer tools.

Good luck, happy tablet-ing!