Saturday 31 January 2015

Expanding The Chromebook

Chromebook

Running Linux on a Chromebook isn't hard, as Chris Salter demonstrates

Introduced in 2011 by Google, the Chromebook was designed as a thin client to run Google web services, such as Google Documents. Chromebooks are low-cost laptops that run Chrome OS, a modified version of Linux with the Chrome browser installed on top. The devices have Google Drive installed on them, allowing users to create files using the offline Google Document editors and have them sync back to Google Drive when connected to the web. Additional apps and extensions can be installed to the Chromebook from the Chrome Web Store that allow the Chromebook to run a variety of programs online and offline. Chromebooks could therefore be viewed as something of a cross between a standard laptop and tablet - the laptop form factor but a restricted number of programs that can be run.


However, because Chromebooks run Linux as an underlying operating system, they can be hacked to run a full version of it too. By doing so, you can expand the Chromebook to run a full desktop Linux operating system. This allows you to run any program you want that runs on Linux, depending on the Chromebook you have (some of the Chromebooks have ARM-based processors and therefore run programs compiled for those rather than x86 chips, the standard CPU type for desktops). This includes running Dropbox or a desktop email client, so you can use the machine exactly how you might use a standard Linux installation.

Most Chromebooks have a reasonable specification and price, so this method allows for a cheap Linux laptop that will allow you to perform any task you want. This guide explains how to download and install Linux on your Chromebook.

Installing Linux


Chromebooks can boot quickly - from switching on to a fully working desktop in under ten seconds. Part of this is achieved by not including the standard BIOS screen that you might see on a laptop or desktop machine. However, due to this, it's not simply a case of selecting a boot device and installing Linux alongside or over the top of the Chrome OS. Yet there are workarounds, as Chrome OS itself is built on Linux.

Chromebooks are designed to be secure. Google is keen to extol the secure nature of the Chromebook and the ease and simplicity of any updates that it might need; everything is done automatically and the user doesn't have to update manually. While this is the case for the Chromebook in its standard mode, they can be switched into a developer mode. By doing so, this allows you greater flexibility to edit the software of the Chromebook itself, as it disables checks on the security of the software and allows you access to programs such as the command line (or terminal) and programs that you wouldn't normally be allowed access to as a standard user. Developer mode has to be enabled for the installation of Linux on the Chromebook.

There are two ways to run a full Linux desktop. The first is to dual boot the Chromebook, running a version of Linux from a USB stick or SD card attached to the system. This will boot a version of Linux from the device, and you have to choose to boot either Linux or Chrome OS on start-up, although this is done by selecting the operating system using keyboard shortcuts, as there isn't a boot menu like GRUB to select which operating system you want to boot. To select the operating system you want to use, you need to shut down the Chromebook and restart to choose.

The other method is to run Linux within a 'chroot' environment. This means that Linux will run alongside Chrome OS, in a vaguely similar way to that of a virtual machine. The chroot can be opened and started at will, so you boot into Chrome OS as normal and then open Linux while within Chrome OS. This means you still benefit from the quick start-up of the Chromebook and don't have to reboot to use a full Linux program.

Instructions


This guide will use the chroot version of installing Linux - it's a bit less involved than dual booting and can be done fairly quickly. Note that this will wipe everything from your Chromebook, so make sure all your downloads are saved (as Chrome OS backs up your settings and documents to the cloud but not the Downloads folder). One thing to note is that even though this chroot runs in Chrome OS, it isn't synced to Google Drive or the cloud. Therefore, anything within the chroot remains only on the Chromebook itself (unless you install a file syncing/backup program at a later date within the chroot itself).

1. Firstly, you'll need to put the Chromebook into developer mode. This can be done by holding the Esc+Refresh keys and pressing the power button. This will bring up a screen saying that Chrome OS is missing or damaged (it's not, but just ignore it). Press Ctrl+D, and this will tell you you're about to turn off OS verification. You need to do this. It'll then warn you that OS verification is off and to press Space to enable. Unfortunately, this screen will appear every time the machine boots up now (until you turn developer mode off, but you'll need this on at all times to run Linux). This boot process stays here for 30 seconds, but the screen can be skipped by pressing Ctrl+D again. This is a security feature so people can't use compromised Chromebooks without knowing. The Chromebook then formats the device and sets up the developer mode.

2. Boot up the Chromebook. You'll be asked to sign in as if it was a brand new installation.

3. Download the Crouton script. This can be downloaded directly from goo.gl/fd3zc. Keep it in the downloads folder, as this is where the rest of the tutorial will expect to find it.

4. Open the command shell. This is done using Ctrl+Alt+T, which brings up the Chrome Developer shell. However, to run Crouton, we need to then type in shell to open the Linux Bash shell that runs underneath Chrome OS.

5. With the shell open, you can then run Crouton. It supports a number of Linux distributions. You can see the full list by running the command 'sh -/Downloads/crouton -r list'. You can choose any from this list. For example, you would then run the command to create a new chroot with the argument '-r wheezy' to install Debian Wheezy.

6. As an example, I'll install Ubuntu with the XFCE desktop. This can be done by using the command 'sudo sh -/Downloads/ crouton -t xfce'. This will install the default Linux distribution, which is Ubuntu Precise Pangolin (12.04) with the XFCE desktop environment. You can change the desktop environment by changing the target - a list can be seen by using the command 'sudo sh -/Downloads/crouton -t list'. This will let you select what environment to install. Selecting Unity will install the default Ubuntu with the standard Ubuntu Unity environment. To install a version of Debian, you would use 'sudo sh -/ Downloads/crouton -r wheezy -t x11'. This guide will use XFCE.

7. This then runs and downloads the information for Linux from the web where needed. Depending on the speed of your internet connection, this could take a while. Grab a cup of tea (or two) while it does its thing.

8. It'll ask for a username and password for the Linux you're installing. This will be the super user for the chroot installation and can be used later within the Linux installation to download further programs from the repository.

9. Once that's done, the Linux installation is able to be started. It'll print on the screen the command for starting the chroot. If you only have one chroot installed (you can have more than one), simply put in the command to start the desktop manager of your choice. In this instance, we'll use the command 'sudo startxfce4'. If you installed Ubuntu with Unity, this would be 'sudo startunity'.

10. The installed Linux chroot should pop up and let you use it just like a normal Linux installation. If you have an Intel x86 powered Chromebook, you'll be able to install any software available in the repositories and any other software you find. For example, you can happily installed Dropbox (or any other backup/sync service that works on Linux) on the Chromebook to download your files! Likewise, if Chrome isn't your cup of tea, then you can happily download and install Firefox and browse using that. You can update the downloaded Linux through the normal means on this system, and the default Chrome OS will update normally.

11. If you don't like having Linux about and just want to reset your Chromebook, it's simply a case of restarting the Chromebook and selecting to re-enable the disk verification. This will reformat the machine, wiping all the changes and putting the Chromebook back into a factory fresh condition.

The downside to installing Linux into a chroot like this is that the chroot doesn't have access to the root file system. However, you shouldn't need to access this while in the Linux chroot, as doing so could potentially damage the Chrome installation. However, the one folder that Linux does have access to is the Downloads folder of Chrome OS. This provides a handy method of sharing data between Chrome OS and Linux.

Most Chromebooks only come with a small internal drive; the one used in this tutorial only has a 16GB solid-state drive. After installation of the Linux chroot alongside Chrome OS, there's approximately 7GB left of storage space. Obviously, attaching a small USB stick can increase the space available for data, but you might have to be keep an eye on the drive space if you're downloading a lot of large programs. If you're heading out to buy a Chromebook specifically for installing Linux on, it might be worth finding one with a larger hard drive; this will give you more flexibility when you download. However, these are likely to be hard drive rather than SSD Chromebooks, so you'll sacrifice some speed.

As the chroot is running using some of the same files as Chrome OS, there isn't a performance hit as if you were running Linux on a virtual machine on a computer. The resources of both operating systems are shared between each other, so Linux should actually feel as smooth as if it was installed on a normal machine. It should mean that it'll run on older Chromebooks without as much RAM as the current models.

Conclusion

By installing Linux onto a Chromebook in a chroot, you open up the ability to install and run any software alongside the default Chrome OS installation. For example, you can even download Wine and run Windows programs on the Chromebook (assuming you have an x86-based Chromebook). This means that you can benefit from the low price of the Chromebook and install Linux, knowing that you shouldn't have any problems with the hardware and software. You're also not paying for a Windows licence that you might not use if you wanted a complete Linux laptop but had to buy one off the shelf; not many manufacturers market new laptops without an operating system.

Hopefully this guide will have instructed you through the steps necessary to install Linux on your Chromebook. Crouton is in constant development to keep up with the releases in Ubuntu, so it's worth checking it in the future to see what changes have been made and what distributions are supported.