Well, I’ve really done it. I’ve taken a pure and unsullied Google Pixelbook, which at one time was fast and secure in all ways, and made it into a crashy mess. My crime? The desire to code.
I’m going to walk you through my process for converting this machine into something that’s marginally desirable for programming, but I just wanted to warn you before I begin: this isn’t easy, clean, intuitive, or practical. There are rumors that Google is working on better ways to make Chrome OS a host for other flavors of Linux or Linux apps, but right now we’re basically working with hacks, and hacks hurt.
Because these hacks hurt, I’d implore you to read this entire guide before attempting any of the steps so you know what you’re getting yourself into, and if you, in fact, desire the results.
Step 0: Turn on “Developer Mode”
Every Chromebook manufacturer can implement the Developer Mode switch differently, but the Pixelbook does it the same way as Google’s Chromebook Pixel: you hold the Esc, Refresh, and power button for a little while and the laptop reboots into Recovery Mode. Once you’re there, you hit Ctrl-D to boot into Developer Mode.
This wipes your machine! (Also, it takes a while.)
The beauty of Chrome OS is that most of the “state” of your system is in the cloud, attached to your Google Account, but if you have any local documents those will be gone. This is because Developer Mode basically destroys the physically secure design of Chrome OS. Now you’re in Linux land, and local security is your job, not Google’s.
Every time you boot up now, you’ll have the option to press Space bar and wipe the system again and return to the safety of vanilla Chrome OS. Press Ctrl-D to continue into the unknown.
Step 1: Get Crouton
This is where the magic happens. Crouton creates a “chroot” (an isolated file system) and installs a guest OS (like Ubuntu) that runs inside that chroot, but shares a lot of resources with the host operating system (Chrome OS). You don’t have to fully understand what Crouton is doing to use it, I certainly don’t, but it’s good to be aware of the fact that you’re not running a virtualized OS in a perfect sandbox. What you do in Crouton, even if it looks like Ubuntu, is in many ways entangled with Chrome OS and therefore not everything will work exactly how you expect it to.
The other day, I crashed an application I was running in Ubuntu on my Chromebook, which crashed all of my Android apps somehow, and I had to restart to get everything working again.
Okay, so now that you know you definitely don’t want to do this, head over to the Crouton GitHub repo to learn how to do it. If the extensive options and possibilities detailed in Crouton’s README make you nervous, the rest of this guide covers the steps I took to get the setup I was looking for.
For starters, get Crouton:
Download the latest Crouton release. (Just click on the link.)
Open a terminal window (Ctrl-Alt-T), then type in shell and hit enter.
Type in sh ~/Downloads/crouton and hit enter. This command runs the script crouton, which is inside your Downloads folder, which is inside your home directory. If you don’t trust your typing, you can paste into the terminal with Ctrl-Shift-V.
Running that command doesn’t actually do anything but list the help text. But it’s good terminal practice anyway! Now it’s time to get dirty.
Step 2: Install Ubuntu
Because Crouton installs “guest” operating systems that share some stuff with Chrome OS (the host), you can’t just run and grab any given distro. I went with Crouton’s default Ubuntu 16.04, which is installed with this command:
sudo sh ~/Downloads/crouton -t xfce
Now, sit back and watch the terminal scroll with all the nerd shit you just put on your Pixelbook!
Once the scrolling stops, you’ll have a chance to set a Linux username and password. You’ll need this password for certain sudo commands going forward.
Step 3: Become the hacker god you were always meant to be
Now you have Ubuntu on your system, you can enter that chroot with the convenient command:
That gives you an Ubuntu command line. From there, you can go crazy installing Linux software with apt-get. I grabbed git and curl right away:
sudo apt-get install git
sudo apt-get install curl
If you close the terminal browser tab you’re in, remember you can get another terminal up with Ctrl-Alt-T, then you need to enter the shell with shell, and then you can sudo enter-chroot once again.
If you ever get stuck somewhere, try Ctrl-C. It’s a bit like “force quit” for Linux.
Step 4: GUI hacks!
Here’s where things get wild, but also kind of gross and extra hacky. If the command line is all you need, turn back! But if you want access to a full Linux desktop, or windowed Linux GUI apps, here’s what you need:
Then add Xiwi to your chroot. If you went with the default install, your chroot is named xenial (one of those catchy Ubuntu names). If you went off script and don’t remember what your chroot is called, you can look inside your folder of chroots (cd /mnt/stateful_partition/crouton/chroots then ls) to see what you have wrought.
Now you run sudo sh ~/Downloads/crouton -t xiwi -u -n xenial, replacing xenial with your chosen chroot name if you have something custom. This installs Xiwi and makes it the default method for displaying a desktop or app.
Now, instead of sudo enter-chroot, you can run sudo startxfce4 (just plain startxfce4 if you’re already in the chroot) and get a whole entire Linux desktop that looks really bad on your high DPI display! If you check the “HiDPI” box in the Crouton integration extension everything is crisp but small, or you can leave it unchecked and work in blurry land.
Xiwi is basically a bridge between Linux and the Chrome browser. Xiwi connects to the Crouton Integration extension and pipes a view to be displayed in a browser tab or new window. If this sounds like it would be laggy or fragile, you’re right, it is! But it totally works. Often.
If you want to run a GUI application inside your chroot, instead of the whole desktop, you precede its name with xiwi. Like, in my case, all I really want to run is Visual Studio Code. So I…
Ctrl-Alt-T (open a new terminal tab), type shell, hit enter, navigate to the folder of code I want to open, then type xiwi code . (the period means “do it right here”), and blammo it opens up a new window with Visual Studio Code. If I put in xiwi -t code . that -t flag tells it to open my app in a Chrome tab instead of an independent app window.
Step 5: Customize and break everything
Now you’ll probably want to fix up the DPI, which is messy and non-obvious. I’ll share my current setup in the comments. Or maybe you’ll find Ubuntu 16.04 unacceptable and decide to try a whole new chroot. (You can have more than one chroot!) Or maybe you’re like me and Visual Studio Code and a terminal is all you ever wanted. Installing Visual Studio Code was also non-obvious, so I’ll share my secrets on that one as well. We’ll have a lot of fun in the comments, I swear.
Step -1: Don’t do any of this
One of the best ways to do development work on Chrome OS is to ditch these Crouton shenanigans and just set up a virtual machine in the cloud somewhere and SSH into it. That’s what iPad-based developers usually do, and they seem happy enough. You don’t get to use any GUI apps, but you get a real Linux distro, and there are a lot more things that “just work.”
Or you can be a rebel and use the actual Linux distro that Google gave you. There’s a project called “Chromebrew” that packages Linux utilities for Chrome OS. It even has crowd favorites like neovim, node, and yarn, so you might be able to get your whole ideal setup running locally. I had trouble with my own particular use case (running Rust code), and it doesn’t have Crouton’s magical Xiwi for GUI apps. But it’s something!
How do I feel?
To be honest with you, I hated my first couple days with this setup, but it’s been growing on me. For a while there, VS Code would crash every time I tried to scroll horizontally. Then an update came out for VS Code, and those crashes stopped happening. I still have to kill my Xiwi apps every once in a while and relaunch them, but I haven’t managed to destroy all of Android recently, so that’s nice.
There’s something kind of comfortable about having the simplicity and speed of Chrome OS running next to a laggy but flexible instance of Linux. It feels like the right combination of stripped-down and endlessly powerful. Plus the Pixelbook does this, and people are always impressed: