What will you learn from this article?

What a Chromebook is.

What happened with delete and caps lock keys on the Chromebook keyboard.

How to run the Linux subsystem in Chrome OS.

How to recognize Linux version and distribution.

How to install NodeJs, NPM and other necessary apps.

How to create the first React app.

How to install XAMPP — Apache local server.

How to solve “couldn’t connect to display error” permanently.

How to add your own scripts to Linux startup.

How Linux subsystem performs on Intel Celeron N3350 processor and 4 GB RAM Chromebook.

Chromebook short review

Let’s start with a short Chromebook review. What in fact a Chromebook is?

Quoting Wikipedia:

A Chromebook is a laptop or tablet running the Linux-based Chrome OS as its operating system. The devices are primarily used to perform a variety of tasks using the Google Chrome browser, with most applications and data residing in the cloud rather than on the machine itself.

Originally installed Chrome OS is not the only distinctive feature of Chromebook. Having bought a Chromebook you better get ready for completely new keyboard layout. For me it was the biggest surprise — especially missing delete key replaced with power on/off button. It’s because Google UI designers decided to add some special keyboard keys to improve web browsing — to make more space for these new ones they have deleted the delete. The same happened to caps lock — not everyone is lucky…

Chromebook keyboard

Does it make sense? In my opinion, it’s like reinventing the wheel. Chromebooks were supposedly meant for people who often browse through the internet — like me — but I’m accustomed to using the traditional keyboard for that purpose, and nobody ever asked if I wanted to change my habits…

BTW… the equivalent of the delete key on a Chromebook is alt + backspace. All Chromebook keyboard shortcuts you will find here.

Another surprise — this time 100% in plus— is multi-gesture touchpad. What I liked the most was scrolling with two fingers. All Chromebook touchpad gestures have been described here.

Scrolling on Chromebook touchpad. Source: Google

What more can I say about Chromebooks? They are really tinny, lightweight and not that expensive. My ASUS C223NA 11'6 Chromebook weighs less than 1 kg and I paid less than $200 for it. It makes a very good and handy device to take for a backpack journey — and this feature pays you back the inconvenience of having been forced to learn new Chromebook keyboard layout.

OK, let’s get started with Linux

Go to Settings/Linux and press the Turn on button.

Settings/Linux

Installing Linux on Chromebook

Linux subsystem (called Crostini) included in Chrome OS is still in beta version but available on stable channel. It means that every device released in 2019 should have the possibility to run Linux Beta. You can also find the list of older devices which Crostini supports.

If you want to be sure that you will get 64-bit Chrome OS, choose a device with an Intel processor. ARM architecture processors are not fully supported by Chrome OS yet — here is the story of a certain unlucky guy who once bought Lenovo C330 Chromebook with 64 bit MediaTek processor and… 32-bit Chrome OS. Well, shit happens...

In the meantime, the installation of Linux has been completed. Let’s check…

What do we see?

Linux console opens automatically after installation completed

We see just the empty console — no information about Linux version, distribution, etc. Let’s try to obtain some data.

How to recognize Linux version and distribution:

Type command:

hostnamectl

press enter… and…

hostnamectl command output

It’s Debian!

Crostini runs Linux in the container. It works similar to running Linux on a virtual machine with Vagrant but it’s easier and more powerful — we can install and use Linux desktop applications, pin them to Chrome OS taskbar or easily share files between Linux and Chrome OS. When you open Chrome OS files manager you will find a directory called Linux files — that’s the folder shared between Linux subsystem and Chrome OS.

So, let’s install something!

In the beginning, I suggest it be some Linux files manager, like Nautilus. It will allow you to explore easily the whole Linux subsystem.

sudo apt-get update

sudo apt-get install nautilus

All Linux applications installed we can run by console or just by clicking an app’s icon from the Linux apps folder — like other applications on the device.

Linux apps folder

Nautilus installed on Chromebook’s Linux subsystem

Let’s install more tools, e.g Atom code editor.

Download Atom deb package from atom.io, move it to Linux files folder and just double click to install.

Included deb packages installer is very useful. Bravo Google!

Now lets’s install NodeJs and NPM using NVM (Node Version Manager):

Following line of code will start NVM installation:

sudo curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

before using NVM we have to reload system environment:

source ~/.profile

now we can list available NodeJs versions:

nvm ls-remote

and install one:

nvm install v12.10.0

Making the firs App

There are millions web and mobile apps on this planet. It’s impossible to count them. At this moment Google Play store contains more than 2 million apps, the Apple Store offers not much less and moreover, we have Windows, Linux, and numberless web applications… So, let’s create another one.

Creating new React app:

npx create-react-app my-app

cd my-app

npm start

React App is served on http://localhost:3000/ address

React my-app opened in Atom editor

Everything works fine. We can just start to code.

Installing XAMPP

NodeJs server works nicely, so let’s check some Apache local server. Download the XAMPP installation file for Linux here and move it to the Linux files folder. Before starting installation we need to enable access to desktop by following command (without that the XAMPP desktop installer will not appear):

xhost local:root

Now we can run XAMPP installer:

sudo chmod +x xampp-linux-x64–7.3.9–0-installer.run

sudo ./xampp-linux-x64–7.3.9–0-installer.run

Command chmod +x makes the file executable.

XAMPP desktop installer

Now let’s create Xampp.desktop file, the shortcut to the XAMPP Manager:

sudo touch /usr/share/applications/Xampp.desktop

open it as administrator in a text editor:

sudo atom /usr/share/applications/Xampp.desktop

paste the following content:

[Desktop Entry]

Name=XAMPP

Comment=XAMPP Server

GenericName=Localhost server

Exec=sudo /opt/lampp/manager-linux-x64.run

Icon=/opt/lampp/htdocs/favicon.ico

Type=Application

StartupNotify=true

Categories=GNOME;GTK;Utility;Development;

MimeType=text/plain;

StartupWMClass=xampp

Name[en_US]=Xampp

and update apt-get:

sudo apt-get update

Shortcut to Xampp manager will appear automatically in the Linux apps folder. There is an issue with app icons, some applications are signed with missing icons replaced with default penguin image. Well, Crostini is still in beta version…

Desktop shortcut to Xampp manager in Linux apps folder

XAMPP manager

The XAMPP server is not available on http://localhost address (as I was expecting) but on some strange URL: http://penguin.linux.test. We could easily change it by editing /etc/hosts file on Chrome OS were it not be possible only in Developer Mode. This is what I really don’t like. There is a workaround for it — we can find penguin host IP address by command:

ping penguin.lxd



my output is:

PING penguin.lxd (100.115.92.201) 56(84) bytes of data.

64 bytes from penguin.lxd (100.115.92.201): icmp_seq=1 ttl=64 time=0.053 ms

So, instead of http://penguin.linux.test, I can use http://100.115.92.201 address.

Solving “couldn’t connect to display error” permanently

Before running XAMPP desktop installer I’ve suggested to type following command to open access to the Linux desktop:

xhost local:root

Without that we will see the error as below:

Unknown Error couldn’t connect to display “:0”

To solve this issue permanently we can add xhost local:root command to Linux startup.

Edit /etc/bash.bashrc file as administrator:

sudo atom /etc/bash.bashrc

and add the command mentioned before at the end of file:

xhost local:root

Editing /etc/bash.bashrc file in Atom

After restarting Linux you should see the output of xhost local:root command:

Output of xhost local:root command

Now the issue known as Unknown Error couldn’t connect to display “:0” is solved permanently.

Performance and final thoughts

My Chromebook is provided with the Intel Celeron N3350 processor and 4 GB RAM. I didn’t expect a very high performance of this configuration. For basic activities like web browsing, writing docs, etc. it is sufficient and everything works fine and smooth, but will such a device prove to be appropriate for developers? While installing Linux apps I stumbled upon some lags, e.g XAMPP installation took a lot of time. So I’ve made some performance tests.

Phoronix Test Suite auto-compare test results look similar to those provided by some good mini computers, like ASUS Thinkerboard or MiQi. The full test result is available here.

Phoronix Test Suite auto-compare command output

It does not look brilliant but it’s not that bad. ASUS Thinkerboard costs about $100 but goes without display, keyboard, and long-life battery, so in my opinion, a cheap Chromebook (about $200) is a better choice — there always remains the possibility to hack it and install some Linux distribution instead of Chrome OS.

Finally, I got to like my cheap Chromebook. For the price of Android tablet, I can have a fully functional Linux ultrabook without rooting or switching to developer mode.

Thanks for reading.