///TITLE///
Jono Bacon shows us how to run the Ubuntu Desktop on a Nexus 7 tablet, just for fun.

///HEADLINE///
Running Ubuntu On Your Nexus 7 Tablet

///NAME///
Jono Bacon

///COPY///
Most of you who are reading this will be familiar with Ubuntu, even if you don't use it. This familiarity is most likely due to the Ubuntu desktop distribution that has been popular since it's introduction in 2004. Some of you may also be familiar with Ubuntu for servers and the cloud, and Ubuntu has since become the most popular Operating System in use on the cloud today.

What may be less clear is the wider vision of Ubuntu; an ubiquitous Operating System that delivers convergence across multiple devices and the cloud. So what does 'convergence' mean in this context? In a nutshell, the goal of Ubuntu is to create a single Operating System that can run on any device you own, delivering a consistent and simple user interface across these devices. This consistent user interface was one of the goals of the at-times controversial Unity user interface that debuted on the Ubuntu desktop a few years ago. Unity makes a lot more sense when you see it within the context of running on these different devices.

Ubuntu started focusing on devices when it introduced Ubuntu for Android at CES in 2012. This provided a means to run Android on a phone handset, but when docked with a screen, keyboard, and mouse a full Ubuntu desktop would boot with integration of apps, contacts, and messaging from Android inside the system. This was followed up by Ubuntu for TV which provided a full TV and media management interface designed for set-top boxes and smart TVs.

The most recent addition to this line-up is Ubuntu for phones that was introduced on the 2nd January 2013 and featured at this year's CES event in Las Vegas.

// Focusing On Performance

Ever since Mark Shuttleworth announced this convergent strategy a few years ago, the Ubuntu Engineering team have been working to get different parts of the Ubuntu stack in shape for running on these devices.

When you run Ubuntu on a phone, tablet, or TV, the same core system is used but there are quite different hardware and performance requirements for these special devices. As an example, when we release Ubuntu for desktops, we produce a general purpose image that can be installed on a range of different hardware. When you need to run Ubuntu on a phone, tablet, or TV, the hardware requirements are typically much more limited and specific. There are fewer processors targeted, and commonly these embedded processors are specialized ARM chips. There is also a limitation on memory, often between 512MB and 1GB, and there are specialised hardware components such as cellular radios, accelerometers, and other devices that need support.

Ever since Ubuntu has focused on these devices there has been an effort to optimize the platform to run efficiently. One key piece of work here has been picking a common hardware device to target and optimizing the system within the community for that device. The device of choice was the Nexus 7 tablet and in this article I am going to show you how to get the Ubuntu Desktop running on your Nexus 7 tablet.

// Optimizing For Devices

The Nexus 7 tablet was chosen for a few reasons.

Many phones and tablets are typically locked and prevent you installing an alternative Operating System. In these cases, anyone who wants to run a different OS either needs to hack the device or enter into a commercial arrangement with the manufacturer to use the device. The Nexus 7 is a device that can be unlocked easily, and thus made it a sensible choice so our community could participate in getting Ubuntu to run too.

The Nexus 7 is also reasonably powered, but not so beefy that we get lazy optimizing Ubuntu for it. The device is also relatively inexpensive and available in different parts of the world.

One thing that is very important to stress here is that the goal of getting Ubuntu running on the Nexus 7 was NOT to create a tablet version of Ubuntu. The goal here was to get the Ubuntu Desktop to run efficiently on the device, and it should be remembered that the desktop is designed for a keyboard, mouse, and large screen, not a small touchscreen. As such, the Ubuntu team are intimately aware that the user experience of Ubuntu on the Nexus 7 is sub-optimal; the goal instead is to get the lower layer, non-graphical components such as the kernel, display server, network stack and other elements working with low memory and power consumption. If you are expecting to get a sexy tablet version of Ubuntu after following this article, you will be disappointed; this article is more about playing with getting the Ubuntu Desktop running on a different kind of device for fun.

// Installing on the Nexus 7

To set up Ubuntu on the Nexus 7 you will need (spoiler alert) a Nexus 7. Fortunately you can use either the 8GB, 16GB, or 32GB models. It is important to note that while you can always revert back to the Android system that came with the device, when you either switch to Ubuntu or switch back to Android you will lose all your data and settings. As such, be sure to back up any important settings. I recommend you simply put data that you care about into the Ubuntu One personal cloud (this makes it easy to re-install your content); there are Ubuntu One clients for both Ubuntu, Windows, Mac, iPhone and Android. For more details on this, see the 'Using Ubuntu One' box for details.

In addition to the Nexus 7 you will also need a Micro USB cable. You use this cable to connect the Nexus 7 to your laptop and install the software to the Nexus 7 from there. Optionally you can also use a host cable to connect a keyboard and mouse via USB to the Nexus 7, but you will most likely use the touch-screen instead of the mouse and use the on-screen keyboard instead of a hardware keyboard.

To install Ubuntu on the Nexus 7 you will need to have Ubuntu 12.04 or newer installed on your laptop/desktop. You first need to install the PPA that contains the Nexus 7 installer. To do this open a terminal by clicking the Ubuntu button, typing 'terminal' into the dash and clicking the icon.

Now enter the following commands:

	sudo add-apt-repository ppa:ubuntu-nexus7/ubuntu-nexus7-installer
	sudo apt-get update
	sudo apt-get install ubuntu-nexus7-installer

These commands will install the PPA that the Nexus 7 developers are using, update your package list, and then install the Nexus 7 installer.

You now need to unlock the Nexus 7 so we can perform the installation. Fortunately, this is a simple process and remember, you can always revert back to Android if you choose to, but you will lose your data, files and settings, so be sure to back up the device first.

First, plug the Nexus 7 into your laptop via USB and reboot the Nexus 7 so it shows the Android boot loader. To do this power down the device by holding down the power button and selecting power off; this will switch the tablet off. From this off state, hold the volume down button and press the power button. Continue holding the volume down and power buttons until you see the boot loader user interface which shows an android character with it's front lid open and a large Start button.

Now run 'fastboot' to ensure the device is listed:

	sudo fastboot devices

You should see the following displayed:

	1234567891234567        fastboot

Now start unlocking the bootloader of the Nexus 7 by running:

	sudo fastboot oem unlock

You now see a screen on the Nexus 7 that asks if you want to unlock the bootloader, complete with a chunk of text in the form of a caveat. Tap the 'Yes' option to continue.

Now complete the process by running:

	sudo fastboot reboot-bootloader

You can also press the power button to do this. When the Nexus 7 reboots you should see 'LOCK STATE = UNLOCKED' in small red print shown. You are now unlocked and ready to install Ubuntu!

To install Ubuntu on the Nexus 7 you should first ensure that no other devices are plugged into your laptop/desktop via USB; only the Nexus 7 should be plugged in. Now click the Ubuntu button and search for 'nexus' in the dash and you will see the 'Ubuntu Nexus7 Installer' listed.

Click the icon and follow the instructions in the dialog box that pops up. The release of Ubuntu for the Nexus 7 will be downloaded and installed to the device.

With Ubuntu now freshly installed on your Nexus 7, you can restart the device and the desktop will load.

// Touchy

Although you might see Ubuntu on your tablet, remember that the core goal of the project of getting Ubuntu on the Nexus 7 is not to optimize the desktop for a tablet, but to get the lower level layers of the Operating System running efficiently. The desktop does work though, but there are a few things you will need to know while using it.

Firstly, touch is obviously enabled on the tablet. As an example, you can use your finger to slide the Launcher on the left side of the screen up and down and tap to load an application.

There are a number of gestures that are currently supported on the Nexus 7. Firstly, single finger taps are the equivalent of a mouse click and will select and enable items. Likewise, a single-finger drag will move an item around as if you clicked with a mouse and moved the mouse.

Getting a little more exotic...a single finger double tab will select a word or item, but a single finger triple tap will select a paragraph or related set of items.

If one finger just isn't enough for you, the Nexus 7 supports multi-touch too. As an example, load an application so that the window appears on the screen. Now tap the window with three fingers. You will now see some grabbing handles appear around the edge of the window and a handle in the middle. You can use these handles to resize the window and the handle in the middle can be used for moving the window around.

You can also perform a four finger tap and this acts as a shortcut to loading the dash.

// The Keyboard

With the Ubuntu desktop running on your Nexus 7 and not a special tablet user interface, you may be wondering how exactly you type when there is no keyboard attached.

Fortunately, Ubuntu has long come pre-installed with a range of accessibility features, which include an on-screen keyboard. If you want to see these features on your normal Ubuntu desktop, load the Ubuntu Settings and select the Universal Access section. There you can enable the keyboard. Fortunately, on the Nexus 7, the keyboard is already enabled by default and should appear whenever you need to enter text. If for some reason the keyboard doesn't exist, you can tap the icon in the panel with the four squares and select 'Show Onboard' and the keyboard will appear.

The keyboard operating like a normal keyboard, but there are a few special tricks you will want to know when using it. Firstly, the 'X' icon in the corner is how you can dismiss the keyboard when you don't need it. You can also use the four-arrows icon underneath the 'X' button to move the keyboard around if it gets in the way.

The keyboard also provides some useful functions for using the mouse. As an example, right-clicking is difficult to do when you don't have a mouse, let-alone a right mouse button. To right-click, first tap the arrow button in the top-right part of the keyboard and you will see some additional buttons appear. Now select the arrow button that appears that is facing the right (it should appear next to the button you just tapped). Now tap the area of the screen that you want a right-click to happen at. You should now see the effects of the right-click (such as a right-click menu).

// Other Ways Of Controlling

If you are experiencing some bugs or problems using the on-screen keyboard and touch you can also control the Nexus 7 in a few other ways.

The first and most simple approach is to use a Micro USB Host Cable (OTG Cable). You should be able to find the cable on Amazon or another electronics retailer. Simply plug the cable in and your keyboard can be connected.

Another approach is to use VNC to control the Nexus 7. VNC is a network protocol that you can use to export the screen to a different device. To get started, run 'Vino' on the Nexus 7 and in the window that appears check the 'Allow other users to view your desktop' box as well as the 'Require the user to enter this password' box and enter a password. You can uncheck the other boxes and at the bottom choose 'Only when someone is connected'. Now close the window and the VNC daemon will now be running.

You can now use the remote desktop viewer on your computer to connect to the Nexus 7 and control it. One box you may want to check in the viewer is the 'Use JPEG Compression'; this should speed up performance quite a bit.

// Installing Software

With your Nexus 7 set up you can use it like any other Ubuntu desktop.

One area you will want to be a little careful though is installing software. You should only use software available in the archive, and you should not enable the -updates and -security archives if you are using an earlier than 13.04 release. These updates may break some of the updates designed for the Nexus 7.

If you are running 13.04 on the Nexus 7 it is recommended that you regularly perform a system upgrade to ensure that bugs and issues that are fixed are downloaded. You can do this by loading a terminal (four finger tap to access the dash, type in 'terminal', and click the icon) and then running:

	sudo apt-get update
	sudo apt-get dist-upgrade

When it asks you for your password, the default password is 'ubuntu'.

You can also use the Ubuntu Software Center, which is included in the system to install software. Be careful when installing applications though; not everything that you expect to work will either run or run smoothly. As an example, at the time of writing, some games (particularly 3D games) and applications don't run particularly well on a limited resource machine such as a Nexus 7.

// Reverting Back To Android

If you decide that you don't want to keep Ubuntu on the Nexus 7 and want to revert back to Android, you first need to download the latest version of the image for your device from https://developers.google.com/android/nexus/images#nakasi and save it to your disk.

Before you re-install Android be sure to back up any settings and files that were on the Nexus 7. Now plug the tablet into your laptop/desktop with the Micro USB cable (be sure this is the only device plugged into your laptop/desktop), and restart the tablet and hold down the volume down button while it restarts. Now put the device into fastboot mode by running:

	sudo fastboot devices

Now unzip the tarball that you downloaded. For example:

	tar zxvf nakasi-jro03d-factory-e102ba72.tgz

Now run the flashing program:

	cd nakasi-jro03d/
	sudo ./flash-all.sh

You may get the following warnings, which you can ignore, the restoration will continue anyway.

	archive does not contain 'boot.sig'
	archive does not contain 'recovery.sig'
	archive does not contain 'system.sig'

Then you may lock the device again after another reboot into the fastboot mode:

	sudo fastboot oem lock

Android will now be installed and ready to go!

// Wrapping Up

As Ubuntu heads into it's brave new world of running on desktops, phones, TVs, tablets, the cloud and possibly your toaster one day, the Nexus 7 has played an important role in helping the developers to optimize the system for running on these special low memory, limited resource devices, often with specialized hardware requirements.

It should be emphasized again that although I showed you how to get up and running with Ubuntu on your Nexus 7 in this article, the Ubuntu desktop is really not designed or intended to be run on a tablet. In the future there will be a dedicated tablet user interface, but the goal of getting the Ubuntu desktop running was more to optimize these lower level layers of the system. As such, if things don't work in the desktop layer of Ubuntu as you expect, don't be surprised if the Ubuntu developers are not that interested; their focus is on the kernel, X server, and other lower level layers.

In the meantime though, enjoy playing around with Ubuntu on the Nexus 7 and be sure to report bugs if you experience some issues lower down the stack. You can report a bug by running the following command in a terminal:

	ubuntu-bug

Good luck!

///BOX TITLE///
Using Ubuntu One

Ubuntu One is a personal cloud built into Ubuntu and available for other systems too. Ubuntu One provides a place to store your files, music, videos, photos, and settings. The content that you put into Ubuntu One is then synced across your different devices. As an example, if you save that picture of your dog riding a skateboard into your Ubuntu One personal cloud, the picture will then automatically appear on all of your other devices with Ubuntu One connected. Ubuntu One comes with 5GB space for free, and if you need additional space you can buy it when you need it. It is a great system for syncing your files and other content between your Ubuntu machines.

Ubuntu One also includes features such as publishing files, photos and other content online and streaming the music from your Ubuntu One account to devices. As an example, if you keep your music collection in Ubuntu One you could stream it to your phone without having to download your music library to the phone.

Ubuntu One is built natively into Ubuntu but is also available for Windows, Mac, Android, and the iPhone. You can download the software for these other systems from http://one.ubuntu.com.

If you are running Ubuntu, you can register with Ubuntu One from the application included; just search for 'ubuntu one' in the dash.
///END BOX///

///BOX TITLE///
The Ubuntu Convergence Story

In recent years Ubuntu has been expanding to more and more devices. This is the roster of devices so far, each which shares the same Ubuntu experience, just tuned to each form factor.

desktop.jpg
The elder statesman of the group, Ubuntu has long been available on desktops.

android.jpg
For higher powered super-phones, Ubuntu for Android lets you run a full Ubuntu desktop right from the phone itself.

tv.jpg
Ubuntu for TVs provides a media player and smart TV user interface for watching and recording TV and other types of media.

phone.jpg
The most recent addition, Ubuntu is now available as a native Operating System to replace Android.
///END BOX///

//BOX TITLE//
Warning!

Installing Ubuntu on your Nexus 7 will erase any data you had on there, so be sure to back everything up before you go ahead!

Also, Ubuntu for the Nexus 7 is designed to optimize the lower level layers of Ubuntu on the device and not for presenting a special tablet user interface, so don't follow these instructions if you are expecting an Ubuntu equivalent of the iPad, you will be disappointed. If you are curious about fiddling with an Ubuntu desktop on a tablet though, let's roll!
///END BOX///

///PIC///
fig1.png

///CAPTION///
The Nexus 7 supports multiple Operating Systems easily.

///PIC///
fig2.png

///CAPTION///
You can always revert back to Android if you need to.

///END COPY///

///BIOG BIT///
Jono Bacon is the Ubuntu Community Manager, author of The Art Of Community, and founder of the annual Community Leadership Summit.
