visit
A couple of months ago I’ve written about my experiences setting up a development environment in the Google Pixelbook. Back then the Linux (beta) feature was only available in the development channel, but nowadays this feature has been released on the stable channel as well.
While I did manage to write some decent amount of code on the Pixel, some system update killed my VS Code installation. I was able to launch the application, but the window just didn’t render… looking at the logs the application seemed to be working though, but in a “headless” state. I don’t have the skills to debug it further, so I almost gave up. But since the feature I’ve needed was released in the stable branch I decided to power wash the device and start over again, this time on the stable channel. Just as a side note: before resorting to that I’ve also tried to run the Pixelbook in developer mode, but I didn’t like the user experience at all. Every time I started XFCE it messed completely my resolution and colors on the Chrome OS, making switching between both worlds impracticable. If you have different experiences regarding that please let me know. After the power wash I’ve setup the VS Code and Go binaries again. I won’t repeat the steps here, but you can refer to my previous article or the official website for the step by step:This time I went a little further and installed Docker as well. Here I document my experiences.
First, you need to install some pre-requisites:$ sudo apt-get update
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
Then add the Docker repository (output omitted for brevity):
$ curl -fsSL //download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \ "deb [arch=amd64] //download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Update: after this article was published some people reported having a better experience with the Debian’s repository instead of Ubuntu’s:
$ curl -fsSL //download.docker.com/linux/debian/gpg | sudo apt-key add -
$ sudo add-apt-repository \ "deb [arch=amd64] //download.docker.com/linux/debian \ $(lsb_release -cs) \ stable"
Then install Docker:
$ sudo apt-get update$ sudo apt-get install docker-ce
Everything should be working right now, so we issue a docker run hello-world
to test the installation:
Update: this problem seems to have been solved by ChromeOS 71.0.3578.98. If that’s your case just skip to the next section.
This changed in the newest versions of ChromeOS… the last time I’ve tried to run docker it worked just fine. With a little investigation, I’ve found this issue: And this reddit post summarizes the solution: I don’t have the background even to pretend I’m actually understanding what this is about, but basically, we are messing with some system privileges here.The workaround is to launch the Chromium Shell (Ctrl+Alt+T) and unset a blacklisted syscall. After pressing Ctrl+Alt+T you should see the crosh>
prompt on a new Chrome tab. Type the following commands:
Update: if you want to get rid of sudo you can perform the Linux post-installation steps to create a docker group and add your user to it:
$ sudo groupadd docker$ sudo usermod -aG docker $USER
Thanks for everyone that pointed that out in the comments.
So, we have hello-world
working, but what does that says about more complex docker environments. Luckily we have a wide range of prebuilt container images to pick from.
Messing around with Apache Spark is something I like to do often so I decided to try the jupyter/all-spark-notebook
image. You can just docker pull
it as usual:
For those who are not familiar with docker, the -p
parameter will map the port of the container to some port in the host. In this case, I’m just exposing the 8888 port.
Please note that for accessing the localhost:8888
interface for the first time you need to pass a token. You may find it at the first lines of the log output from the docker run
command. In my case it was:
Regarding the localhost
actually pointing to the container, I had a slight impression that this wasn’t working that way a few releases ago, but I’m not 100% sure. Nevertheless, it was a great surprise.
Note: in subsequent runs the localhost mapping seemed to get lost somehow, so it seems to be unstable at this moment. One trick is to run ip a
in the container and figure out the eth0
ip address and use it in place of localhost instead. I’ve only managed to restore the localhost mapping with a reboot.
I’m using wget
to download it to the container, but you could just save it to the “Linux files” in Chrome OS since it ends up in the home of your user in the container. wget
isn’t installed by default, so we have to install it first and then get the file:
To run our workload I’m creating a notebook with an Apache Toree (Scala) kernel. I’m using the sys.process
package to help us navigate inside the container.
So the big.txt
file is there. Now let’s try the classical word count algorithm:
Here I’m using a to split words using white space and punctuation. Now let’s print the most frequent ones:
Since I haven’t filtered any stop words I guess that’s expected.
I’m first converting it to a data frame to get a better interface, then on cell nine, I’m using a trick to import spark.implicits._
on Jupyter notebooks.
I’m not sure why binding to localhost works sometimes and doesn’t work at others, but diagnosing that would require some systems and networking knowledge that I’m currently lacking. One workaround is to ignore localhost
and figure the IP address of the Linux penguin
container and just use it instead. If comes to this, this Reddit may come in handy for you:
During the writing of this article, I’ve had to reboot the Pixelbook at least once and kill the termina
container (from within crosh
) a few times because the launch terminal shortcut became irresponsible. Please note that if you do reboot your Chromebook you need to run the remove blacklist step again.
I’m still working my head on understanding this architecture and how to diagnose platform issues. At this moment I’m using crosh
to debug termina
and termina
to debug penguin
, but the relationship between those is not perfectly clear to me. I guess that will come with time, nevertheless, it has been a fun experience to explore all of this.