Linux on ChromeOS, a.k.a. Crostini, has been out of beta and available for quite some time. Users that want to leverage the flexibility and power of a Linux environment have access to a Linux terminal that opens the door to a plethora of executable packages that aren’t readily available on ChromeOS proper. Whether you’re looking to install an alternative browser or install powerful app development software, Linux on ChromeOS makes that chore a breeze.
By default, the Linux container on ChromeOS runs the stable and secure distro known as Debian. More specifically, Debian 11 or “Bullseye.” While Debian offers many of the tools that Linux users are looking for, other distros offer up more flexibility and access to a wider range of packages without the need to add extra repositories.
So far as popularity is concerned, Debian takes second place in market share and is very popular due to its secure, stable nature. At the top of the list with a whopping 34% of the market share, Ubuntu is responsible for running more than a third of the internet’s websites. Despite the recent decline in use over the past few years, Ubuntu still holds 30% of the Linux desktop market as well.
Whether you’re a developer or you’re like me and you just like to tinker, the in-built Linux environment of ChromeOS is a powerful tool. If you’ve avoided the move to a Chromebook because of the default Debian Linux container, I have some good news. You aren’t fettered to Debian if you really need or want to use Ubuntu. While this may sound like a daunting endeavor for those not familiar with the Linux environment, I assure you that the steps are relatively straightforward. As a matter of fact, you can have an Ubuntu container up and running on your Chromebook in fifteen minutes or so and I’m going to show you exactly how to do it.
Before we begin replacing the Debian container with Ubuntu, there is one prerequisite that must be fulfilled. You will need a ChromeOS device that supports the Linux developer environment. Don’t worry. If your Chromebook hit the market after 2019, it is almost guaranteed to have Linux app support. If your Chromebook is older than that, you can check the list here to see if Linux support is available. Alternatively, you can just head to the settings menu on your device, scroll down, and click the Advanced tab in the left-hand menu. If your device supports Linux, you should see a “Developers” option directly beneath the Print and Scan menu. If it’s there, click the Developers tab and click the button that says “Turn on” to enable Linux.
You’ll be asked to set the amount of storage you want to use for Linux. Set it to whatever you prefer from the available storage space. Just remember that the amount you use for Linux will be taken from the overall storage space available to ChromeOS. To learn more about setting up the Linux environment on ChromeOS, check out our Command Line article here. Once you’re all set up, we can get started with installing Ubuntu on your Chromebook.
Create the Ubuntu container
We will start this process by creating the Ubuntu container. To do this, you will need to open the Chrome shell also known as crosh. This looks similar to the Linux terminal app that was installed when you enabled Linux but it is not the same thing so make sure you are working in crosh, not the terminal. To open a crosh window, press Ctrl+Al+T on your keyboard. Crosh should open in a new Chrome tab. At the “crosh>” prompt, type or paste the following command and hit enter.
vmc start termina
It may appear that nothing is happening but give it a minute. You should soon see the prompt change to “(termina) chronos@localhost ~ $” and then, you’re ready for the next step. The default container on ChromeOS is named penguin. We are going to stop that container and rename it so we can install Ubuntu in the default container. To do this, run the following two commands – one at a time – at the new prompt in crosh.
lxc stop penguin --force lxc rename penguin debian
Next, we will install Ubuntu in the penguin container. For this tutorial, I used Ubuntu 20.04 but you can use whichever flavor you like so long as the images are available from the Linux container website. To create the Ubuntu container, run the lxc launch command in crosh along with the image name and the container name. For Ubuntu 20.04, the command would look like this. (If, for example, you wanted to use Ubuntu 22.04, simply replace the image below with ubuntu:22.04)
lxc launch ubuntu:20.04 penguin
Enter as root
Next, we need to enter the new container as the root user. This will give permissions needed to install all the necessary packages and utilities that will allow Ubuntu to play well with the ChromeOS host system. To enter the container as the root user, type or paste the following command in crosh and hit enter. The result will be a command prompt that looks like this: root@penguin:~#
lxc exec penguin -- bash
Now we need to update and upgrade any available packages for Ubuntu. Do this by running the update and upgrade commands below in the crosh window. You can run them together or one at a time. If prompted, hit “Y” or enter to proceed with the package updates.
apt update apt upgrade
Since Linux on ChromeOS has its own, custom repository, we need to add those repos and keys to our newly minted container. This will add the repo to the sources.list.d file and add the necessary server keys all at the same time. Copy the commands below and paste them into your crosh window at the command prompt. Paste them all at one time and hit enter. If you don’t see any errors, you should be good to move to the next step.
echo "deb https://storage.googleapis.com/cros-packages bullseye main" > /etc/apt/sources.list.d/cros.list if [ -f /dev/.cros_milestone ]; then sudo sed -i "s?packages?packages/$(cat /dev/.cros_milestone)?" /etc/apt/sources.list.d/cros.list; fi apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B apt update
Now we need to install a workaround package that allows Ubuntu to be integrated with ChromeOS. First, we need to install the “ar” command which allows us to extract and modify archive files. To do this, we need to install the binary utilities package. Use the following command in crosh to install the package.
apt install binutils
Next, we will install the workaround package cros-ui-config. You can paste all of these commands into crosh at once and hit enter. You will likely see a warning message that states “Download is performed unsandboxed as root as file.” You can ignore this message and continue with the installation process by hitting enter if prompted.
apt download cros-ui-config # ignore any warning messages ar x cros-ui-config_0.13_all.deb data.tar.gz gunzip data.tar.gz tar f data.tar --delete ./etc/gtk-3.0/settings.ini gzip data.tar ar r cros-ui-config_0.13_all.deb data.tar.gz rm -rf data.tar.gz
Once the workaround is unpacked, we can install it using the command below. You can then use the second command to remove the cros-ui-config file as it is no longer needed.
apt install cros-guest-tools ./cros-ui-config_0.13_all.deb rm cros-ui-config_0.13_all.deb
Last but not least, we need to shut down the container and reboot ChromeOS. You can stop the container using the command below. Once you’ve done that, power off your Chromebook entirely and reboot to move on to the next steps.
shutdown -h now
Your default Linux container is now running Ubuntu and you can access it using the default Terminal app in the ChromeOS launcher. The first time you attempt to launch the container, it may fail. Just try again and you will see the terminal open with the command prompt ubuntu@penguin:~# To verify that you are running the Ubuntu image you installed, simply paste the following command into your Linux terminal and hit enter.
Your default user in the new container will be Ubuntu. Next time, we’ll cover how to set a new default user and delete excess users and groups. Google is working on a method to manage multiple containers on ChromeOS and it’s actually possible to install Ubuntu in one container alongside Debian in a separate container. It requires some flags at the moment but it will be a very useful way to run multiple Linux distributions at the same time on your Chromebook. Now that you know how to make Linux on ChromeOS Ubuntu instead of Debian, the world is your oyster and you can tinker to your heart’s content. Stay tuned for more as I dive deeper into Linux, container, and virtualization on ChromeOS in the coming weeks.
Note: To move back to Debian, you can just disable Linux in the ChromeOS settings menu and start from scratch. You will lose any files inside the Ubuntu environment but you’ll get a clean, fresh install of Debian in your default container.