Experimenting with Ubuntu Touch


01 December 2017 (Last updated: 23 April 2017)


Update: April 2017

Sadly, it seems that Canonical has decided to discontinue all official development on Ubunutu Touch devices and Unity 8. This announcement effectively renders much of this blog post useless, unless you have a fascination with what once might have been. Read the official announcement here.

Okay, so what's the deal..?

I'll put it bluntly, Android is pissing me off. I'm a happy owner of a Nexus 5X, my favourite phone to date, running a polished and easy to use operating system. But Android is pissing me off. What used to be a proud, open ecosystem that fostered creativity and development is increasingly becoming more closed, more Google. Google keeps pushing its APIs, and the third-party development community is becoming more about buzzwords and less about problem-solving — for this I blame the sheep at XDA.

I like a lot of things about Google — Google is huge, and they're the guys that provide funding for a lot of the things I enjoy in life. They're the guys behind my favourite programming language, Go. They're behind a whole host of free/libre/open source/whatever software I use on a daily basis. They made the web an easier, safer, more useful place. Just this past Saturday (November 26), I attended an awesome hackathon — made possible by Google — shout out to Terrible Hacks by the way!

I use Google products nearly every day, but I don't necessarily want the corporate giant to have all my browsing habits, my precise location, an indexable, graphable, trackable version of my personal life in a billion data points. I realise that I have to sacrifice some of my privacy for convenience, etc. and I'm relatively okay with that given an appropriate situation — however Android is pissing me off.

Android is pissing me off, not because it is bad, but because it is becoming less and less AOSP, and more and more Google. Most of the latest innovations that make Android appealing are proprietary-Google, not Android. I need something fresh and new.

Enter Canonical

  • Ubuntu Touch lock screen
  • Ubuntu Touch apps scope
  • Ubuntu Touch about screen

Canonical is the corporate figurehead behind Ubuntu — the most popular GNU/Linux desktop operating system. They do a lot of good things, and they do a lot of bad things, same as any other corporation. Same as Google. A few years ago they started a project called Ubuntu Touch — this was one of the good things. Canonical's operating system is different — it's free, it's libre, it's fresh. It hasn't gained a lot of ground yet, but it is as of yet the most promising alternative to Android that exists. It's not the only alternative, but it's the most promising. Once upon a time Sailfish OS looked great, but their entire UI is proprietary and I dunno, Jolla seems to have died or something.

Though the repository of applications is sparse, my experience with the mobile operating system has often been one of joy. The only headache I've had was caused by the fact that Ubuntu bundles some bloatware with the OTA tarballs... but it's really quite easy to remove. Obtaining root access to the system (explained below) is only marginally more difficult than Ubuntu's desktop counterpart, so you have the freedom to do what you want with your device. It's under your lock and key, not Canonical's.

In addition, the operating system is really quite beautiful! The gesture based UI was strange to grasp at first, but after a few minutes every motion seemed natural. Everything from a user experience standpoint is extremely polished, and I'm really impressed.

  • Ubuntu Touch phone app
  • Ubuntu Touch clock app
  • Ubuntu Touch contacts app

The UI is simple, uncluttered, and only shows what you need in view. Aesthetics is nailed even better than Apple can claim, as far as I'm concerned. I find this really impressive — especially since I actually think that Canonical's desktop version of Unity 7 is quite garish and ugly.

Ubuntu calls its design language Suru, and it comes in two variants: light and dark.

  • Ubuntu web browser
  • Ubuntu Touch music app
  • Dekko - Ubuntu Touch mail client

Ubuntu also claims to go "beyond apps" with the concept of scopes, and reimagines the idea of a notification drawer as a series of indicator shades. Scopes are somewhat similar to Google Now, Blackberry Hub, and iOS Spotlight search, with information being just a swipe away from your regular app grid. My favourite scope, and perhaps the most useful, is the "Today" scope which shows a summary of weather, news, calendar events, etc (pictured below).

  • Ubuntu Today scope
  • Battery and brightness shade
  • Date indicator shade

Caveats and issues

Both the stable and the developer channels come with gross amounts of bloat-ware. I assume this is because Canonical wants to demonstrate popular and functioning software to users, but this was nonetheless unpleasant to discover. Canonical, I do not want to play 'Cut the Rope'.

There is no easy way to uninstall a scope, as far as I can tell you have to either (a) search the app store for the name of the scope and hope it comes up in the results, then click "Remove", or (b) remove the click package manually via the shell.

Canonical doesn't seem to know how to license software. Many of the core scopes are listed as Proprietary on the store pages which is disappointing. In addition, many of the scopes encourage and rely on proprietary services. This doesn't bode well for an open platform.

It seems that Canonical's partnership with Amazon and eBay isn't coming to an end anytime soon — scopes for both services can be found, I haven't yet figured out how to remove them (as they aren't installed as click packages) and I don't know what data they collect in the background.

The clock/alarm app has no timer built in. The best available timer in the store uses the alarm API and thus is not able to set timers that are less than 60 seconds in length (I don't know why, but the disclaimer is on the store page).

There is currently no CalDav/CardDav support in the Calendar and Address Book applications — you have to rely on using a Google account, or else use the syncevolution command line utility.

The small collection of software is not great, there are few quality apps, and many of them are simply wrappers for mobile or desktop websites — hardly a native experience.

In order to change the clock from 12 hour to 24 hour time, I had to change the display language to English (United Kingdom) and reboot. There is no intuitive or easy toggle for this setting.

"Rebooting" seems to just power off the device without it coming back online.

Awesome things

The System UI is gorgeous, and the operating system feels quite polished even if far from finished.

Native QML apps actually look great and work great. I'm hoping to see these outnumber the HTML5 "apps" that are currently running amok in the software centre.

Not only do you have the Ubuntu Touch user experience, but you have full access to a Linux shell, including root access, and powerful package management via click and apt.

Ubuntu Touch is free/libre and open source software, sharing much of the same code-base as the desktop version of Ubuntu. When Unity 8 becomes a thing, platform convergence might actually be achievable.

It's not Android!!

I want an Ubuntu phone!

It happens that Ubuntu Touch runs on very few devices. They have official hardware partnerships with BQ and Meizu, but among other things, they have huge issues with (a) producing and distributing the phones and (b) actually keeping stock. Ubuntu Touch is in its infancy as a viable mobile operating system, and unfortunately big hardware manufacturers just don't seem to see the value in making Ubuntu phones. The good news is that there are community ports to several devices (of various stages of err... working-ness), and some Nexus devices are officially supported by Canonical.

Community supported devices are found over at UBports, and follow slightly different installation instructions from official devices. You can use this blog post as a guide, but refer to the community page for your device where it is indicated that instructions differ.

Installing Ubuntu Touch

You got yourself a phone somehow that works with Ubuntu, awesome! Now there are a few things you need to do.

I recently acquired an officially supported Nexus 4 (mako) for cheap, and got to work. The following guide will work for the Nexus 4 (mako) and the Nexus 7 2013 (flo). Instructions differ slightly for BQ, Meizu, and community ported phones.

  1. Install phablet tools

    You'll need an Ubuntu desktop to get started — you can download an image here, and install it alongside your existing operating system really easily. Once you've done that, let's open a terminal and run some things:

    sudo add-apt-repository ppa:ubuntu-sdk-team/ppa
    sudo apt-get update
    sudo apt-get install device-flash phablet-tools

    Note that phablet-tools is like adb for Android, and in fact uses adb in some of its operations.

  2. Become a developer

    Before you can get running with Ubuntu Touch, you're going to make use of the adb and fastboot tools. To do this, you need to be a developer on your Android device.

    Go into Settings > About device and tap on the Build number seven times fast. This will enable Developer options. Go into Settings > Developer options and enable USB Debugging. If you are running Android 6.0 or higher, you may need to also enable OEM/Bootloader Unlocking.

    Connect your phone to your Ubuntu desktop with a USB cable, and open a terminal prompt.

  3. Unlock the bootloader

    At this point, it might be a good idea to back up important files from your Android, since we will be overwriting all of its storage (except for the external SD card if you have one).

    Disclaimer: I take no responsibility for what you do to your device. If something goes wrong following this guide, it is at your own fault and you must accept the consequences.

    To continue, execute:

    adb reboot-bootloader
    sudo fastboot oem unlock

    And follow the prompts to unlock your bootloader. This will allow you to modify the system. Wait for the device to reboot, then re-enable USB Debugging and get back to the bootloader with adb reboot-bootloader.

  4. Flash Ubuntu

    Next you need to pick a channel. I originally picked stable/ubuntu, and have since changed to rc/ubuntu-developer since I want to try building some apps and experiment with the Ubuntu SDK.

    For the Nexus 4 and Nexus 7 2013, we'll be using the ubuntu/stable channel. phablet-flash will automatically detect which board your device has, and deal with it appropriately.

    Note: this is where instructions differ slightly, see the Ubuntu reference to pick the correct channel for your BQ or Meizu phone — they do not use the same channel as the official Nexus devices. See your device page at ubports.com for instructions for community ports.

    Execute:

    ubuntu-device-flash touch --channel=ubuntu-touch/stable/ubuntu --bootstrap

    Your phone will reboot and install a custom recovery, after which point it will be begin to install Ubuntu. Be patient as this process takes a while. Go make yourself a coffee, relax, and wait for the phone to boot up.

Become a developer (again)

If you want to make use of your Ubuntu device truly beyond apps then you may want to enable Developer Mode so you can access your phone via adb or phablet-shell. Swipe from the left of your screen and select settings from the dock, from there go to Settings > About this device > Developer mode.

  • Ubuntu Touch dash
  • Ubuntu Touch Settings
  • Ubuntu Touch Developer Mode

To get to the shell on your Ubuntu Touch device, you can either open the terminal app on the device, or go to the shell via your desktop computer (a much better idea in my opinion):

phablet-devices # verify your device is connected
phablet-shell   # start an actual SSH session

Now, the shell is great for looking at stuff in the system, and you can learn a lot from just exploring and reading... but that's not very fun. Let's change the system to read-write. With your Ubuntu Touch device connected to your desktop, run:

phablet-config writable-image

Wait for your phone to reboot, and start-up another SSH session with phablet-shell.

At this point your Ubuntu Touch device is about as powerful as your desktop, with a full shell and read/writable system with root access. Just run sudo -i and enter your lock PIN/passcode for an interactive root shell.

Note: Enabling system rw mode will disable automatic OTA updates. This isn't a big deal though, because you can always manually update your system by running this command from your computer with your phone connected:

ubuntu-device-flash touch --channel=CHANNEL

Where CHANNEL is the channel you picked from before, or another compatible channel.

What are some fun things I can do?

You can install your favourite text editor, run a web server, route all your traffic through Tor, or block ads with a custom hosts file. The universe is yours!

Set up your mobile hacking suite

Okay, you know the deal here. Start up an SSH session with phablet-shell and let's get cracking.

Install all your favourite tools and command line utilities with:

sudo apt install <your favourite software>

For your mobile hacking set-up, you might want to install some typical network and security utilities. In no particular order, here is a short list:

  • vim
  • python
  • clamav
  • chrootkit
  • curl
  • whois
  • dnsutils
  • traceroute
  • netcat
  • tcpdump

Note: Be cautious about file system space. You may be tempted to treat your phone like a desktop, but storage is much more limited on a mobile device. I accidentally filled up the 2GB root partition (/dev/loop0), and apt (among other things) became unusable. Avoid filling partitions to the maximum allowed limit, you still need space to work.

Touch/Libertine

Libertine is a sandboxed environment for running deb-packaged X11 apps on Unity 8's Mir server. Ubuntu Touch comes with Libertine installed, so you can get started with running your favourite desktop applications directly on your phone. Put your device in read-write mode, and from your desktop (important!) run:

phablet-shell
sudo apt-get update
sudo apt-get install libertine libertine-scope xmir python3-libertine-chroot
libertine-container-manager create --id vivid --type chroot --name 'Libertine'

Now install X11 apps from the Libertine app on your Ubuntu Touch device. A mouse and keyboard might be nice for using X11 apps, since probably none of them were designed with mobile form factors in mind.

Hack the system

With full root access, you can do basically whatever you want with the system. The first thing I did was globally disable ads through a custom hosts file. Some people will get mad at me for doing this, but what can you do? I don't like ads.

Explanation: I'm basically using Adaway's method of ad blocking, to block adservers system wide. I grabbed some lists of hosts from Adaway's wiki, located here, here, and here, concatenated the files and installed them to /etc/hosts. This works by permanently redirecting all requests to a list of known adservers to localhost, making the ads unreachable.

You can save yourself some work by running the following:

wget https://krourke.org/files/phablet-hosts
scp -P 2222 phablet-hosts phablet@localhost:/home/phablet
phablet-shell
sudo cp /etc/hosts /etc/hosts.old
sudo cp ~/phablet-hosts /etc/hosts

Note: The above assumes that you have already started an SSH session via phablet-shell, and then killed it without disconnecting your device from your Ubuntu desktop.

Or download the hosts file below and copy it to /etc/hosts manually.

downloadDownload

Once you've done that, reboot and enjoy ad-free web browsing.

TL;DR

I've spent too much time messing with Ubuntu Touch over the past few days; it's a cool, new(ish) mobile operating system that has a lot of potential for growth, but big shoes to fill. It runs smoothly on my Nexus 4, and looks to be a good platform for development. You have full access to the underlying system, just as you do with a regular GNU/Linux desktop, so you can do pretty much anything.

This said, there are a lot of issues with Ubuntu Touch. The system is innovative, but it comes bundled with some bloated, proprietary scopes that I don't want or need. I still like it though. I think if the platform is to succeed, then it needs to get more users and run on more devices — it can't just be for the hobbyist. Perhaps if someone upstream gets their head in the right place, these issues can be resolved.

... But while Canonical figures out how to do that, I'm going to get started looking at their SDK, revisit some C++, and get learned up on QML. I have for the most part de-bloated the system, and now I want to make an app for my shiny new toy.