Chrome OS Linux Container (crostini) tips
The new Linux Containers available on some ChromeBooks are manna from heaven if you are a developer. Having a full blown Debian based distribution just a click away makes supported ChromeBooks very usable development platforms. And getting such a device can be cheap.
Here is a set of tips to help make things a little nicer.
Error trying to see “Linux Files” (added 2019-11-11)
If you go to Files > My Files > Linux Files, it is supposed to show you the files in your home directory in the linux container. However, you might also see something like
Error mounting crostini container: 15
The error number may change.
Here are some things to try to fix it.
chrome://flags and press “Reset all to default” in the upper right hand
corner and restart.
In the containers shell, type
sudo groupadd chromeos-access
Updating the Debian version (added 2019-10-08)
Currently, the bundled distribution is set to
stretch which is … old.
Updating to stable is just like updating debian on any system.
Edit the file
/etc/apt/sources.list and put in stable where ever you see
sudo vim /etc/apt/sources.list
deb https://deb.debian.org/debian stretch main deb https://deb.debian.org/debian-security stretch/updates main
deb https://deb.debian.org/debian stable main deb https://deb.debian.org/debian-security stable/updates main
Then it is the normal
sudo apt-get update sudo apt-get dist-upgrade sudo apt clean
Viewing Local Servers
Many systems these days come with a bundled local webserver to allow you test your changes without having to stage to a external host (think node.js, hugo, jekyll, etc). By default, these always want to listen on localhost (127.0.0.1). But the Linux container is a full-fledge VM and so localhost is, well, local. This means that you can’t use the “main” browser and point it to the localhost and have anything useful happen.
Solution 1 - Install browser in the VM
One solution is to install the browser of your choice into the VM and use that. But you have a perfectly good browser already installed, so why take up the space to install another?
Solution 2 - Switch VM Application to External Interface
In order to use the main browser, you need to coax the local webserver to
listen on the VM’s external interface. To get the external interface, you can
use the command
hostname -I (note the capital I).
As an example here are the commands to make hugo and jekyll use the external interface.
hugo server --bind `hostname -I` --baseURL `hostname -I` jekyll serve --server `hostname -I`
To view the server, point the browser to
ChromeOS points that synthetic domain to your Linux VM.
Solution 3 - Use a Port Forwarder
The Chrome App Connection
can set up rules so that when you try to connect to e.g.
localhost:1313 it is
Note that you still need to make the application talk to the VM’s external interface (solution 2). But now you can point your browser to localhost as you normally would.
Configure the terminal
While in the terminal hit
ctrl-shift-P. This will bring up a browser tab with
settings such a font and colors.
Force Shutdown the VM
In recent versions, there is actually a menu item to do this. Right click on the terminal icon and you should see a “Shut Down Linux (Beta)” item.
If not, you can do it in crosh.
Ctrl-At-T to bring up
Enter the command:
vmc stop termina
It will automatically restart when you start Terminal app.
- The default VM name is termina
- The default container is penguin
Access the distribution from crosh
Ctrl-Alt-T # open crosh vsh termina # start the VM and get a command prompt lxc exec penguin -- /bin/login -f <userid> # start the container