Update 20190904: Everything finally works now!
Update 20190730: Crostini seems to work now, this post is mostly about using Acer R13 with Crouton (which you probably dont want if you can use Crostini instead).
Update 20190409: My experiments with Crostini are not giving good results, and I am back with Crouton. So This post is still the most relevant I have written if you want to do development on your Acer R13.
Update 20190216: This post describes how to run Linux on a Chromebook the old way: Crouton. There is a new more supported way: Crostini, which officially is now in the stable channel for the Acer R13. However my experience so far is very bad.
I have got an Acer Chromebook R13 and I will write about it from my perspective.
1. Background
2. As a casual computer
3. As a Linux development workstation (this post)
As a Linux development workstation
I switched my Chromebook to Development mode and everything that follows depends on that.
In ChromeOS you can hit CTRL-ALT-T to get a crosh shell. If in Development mode you can run shell to get a regular “unix” shell. You now have access to all of ChromeOS. It looks like this:
crosh> shell
chronos@localhost / $ ls /
bin dev home lost+found mnt postinst root sbin tmp var
debugd etc lib media opt proc run sys usr
chronos@localhost / $ ls ~
'Affiliation Database' login-times
'Affiliation Database-journal' logout-times
Bookmarks 'Media Cache'
Cache 'Network Action Predictor'
Cookies 'Network Action Predictor-journal'
Cookies-journal 'Network Persistent State'
'Current Session' 'Origin Bound Certs'
'Current Tabs' 'Origin Bound Certs-journal'
databases 'Platform Notifications'
data_reduction_proxy_leveldb Preferences
DownloadMetadata previews_opt_out.db
Downloads previews_opt_out.db-journal
'Download Service' QuotaManager
'Extension Rules' QuotaManager-journal
Extensions README
'Extension State' 'RLZ Data'
Favicons 'RLZ Data.lock'
Favicons-journal 'Service Worker'
'File System' 'Session Storage'
GCache Shortcuts
'GCM Store' Shortcuts-journal
GPUCache Storage
History 'Sync App Settings'
History-journal 'Sync Data'
'History Provider Cache' 'Sync Extension Settings'
IndexedDB 'Sync FileSystem'
'Last Session' Thumbnails
'Last Tabs' 'Top Sites'
local 'Top Sites-journal'
'Local App Settings' 'Translate Ranker Model'
'Local Extension Settings' TransportSecurity
'Local Storage' 'Visited Links'
log 'Web Data'
'Login Data' 'Web Data-journal'
'Login Data-journal'
chronos@localhost / $ uname -a
Linux localhost 3.18.0-16387-g09d1f8eebf5f-dirty #1 SMP PREEMPT Sat Feb 24 13:27:17 PST 2018 aarch64 ARMv8 Processor rev 2 (v8l) GNU/Linux
chronos@localhost / $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 1.6G 1.4G 248M 85% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmp 2.0G 248K 2.0G 1% /tmp
run 2.0G 456K 2.0G 1% /run
shmfs 2.0G 24M 1.9G 2% /dev/shm
/dev/mmcblk0p1 53G 1.3G 49G 3% /mnt/stateful_partition
/dev/mmcblk0p8 12M 28K 12M 1% /usr/share/oem
/dev/mapper/encstateful 16G 48M 16G 1% /mnt/stateful_partition/encrypted
media 2.0G 0 2.0G 0% /media
none 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 128K 12K 116K 10% /run/crw
This is quite good! But we all know that starting to install things and modifying such a system can cause trouble.
Now, there is a tool called Crouton that allows us to install a Linux system (Debian or Ubuntu) into a chroot. We can even run X if we want. So, I would say that for doing development work on your Chromebook you have (at least) 5 options:
- Install things directly in ChromeOS
- Crouton: command line tools only
- Crouton: xiwi – run X and (for example) XFCE inside a ChromeOS window
- Crouton: X – run X side by side with ChromeOS
- Get rid of ChromeOS and install (for example) Arch instead
I will explore some of the options.
#2. Crouton command line tools only
For the time being, I don’t really need X and a Window Manager. I am fine (I think) with the ChromeOS UI and UX. After downloading crouton I ran:
sudo sh ./crouton -n deb-cli -r stretch -t cli-extra
This gave me a Debian Stretch system without X, named deb-cli (in case I want to have other chroots in the future). Installation took a few minutes.
To access Debian I now need to
- CTRL-ALT-T : to get a crosh shell
- crosh> shell : to get a ChromeOS unix shell
- $ sudo startcli : to get a shell in my Debian strech system
This is clearly a sub-optimal solution to get a shell tab (and closing the shell takes 3x exit). However, it works very well. I installed Node.js (for ARMv8) and in a few minutes I had cloned my git nodejs-project, installed npm packages, run everything and even pushed some code. I ran a web server on 127.0.0.1 and I could access it from the browser just as expected (so this is much more smooth than a virtual machine).
For my purposes I think this is good enough. I am not very tempted to get X up an running side-by-side with ChromeOS. However I obviously would like things like shortcuts and virtual desktops.
Actually, I think a chroot is quite good. It does not modify the base system the way package managers for OS X tend to do. I don’t need to mess with PATH and other variables. And I get a more complete Debian system compared to just the package manager. And it is actually the real Debian packages I install.
I installed Secure Shell and Crosh Window allowing me to change some defaults parameters of the terminal (by hitting CTRL-SHIFT-P), so at least I dont need to adjust the font size for every terminal.
#4. Crouton with XFCE
Well, this is going so good that I decided to try XFCE as well.
sudo sh ./crouton -n deb-xfce -r stretch -t xfce,extensions
It takes a while to install, but when done just run:
sudo startxfce4
The result is actually pretty nice. You switch between ChromeOS and XFCE with CTRL-ALT-SHIFT-BACK/FORWARD (the buttons next to ESC). The switching is a little slow, but it gives you a (quite needed) virtual desktop. Install crouton extensions in ChromeOS to allow copy-paste. A good thing is that I can run:
sudo enter-chroot -n deb-xfce
to enter my xfce-chroot without starting X and XFCE. So, for practical purposes I can have an X-chroot but I dont need to start X if I dont want to.
screen
After a while I have uninstalled XFCE and I only use crouton with cli. The terminal (part of the Chrome browser) is a bit sub-optimal. My idea is to learn to master screen, however:
$ screen
Cannot make directory '/run/screen': Permission denied
This is easily fixed though (link):
mkdir ~/.screen
chmod 700 ~/.screen
# add to .bashrc
export SCREENDIR=$HOME/.screen
# and a vim "alias" I found handy
svim () { screen -t $1 vim $1; }
I found that I get problems when I edit UTF-8 files in VIM in screen in crouton in a crosh shell. Without screen there are also issues, but slightly less so. It seems to be a good idea to add the following line to .vimrc:
set encoding=utf8
It improves the situation, but still a few glitches.
Now at least screen works. It remains to be seen if I can master it.
lighttpd
I installed lighttpd just the normal Debian way. It does not start automatically, but the normal way works:
$ $ sudo service lighttpd start
If you close your last crouton-session without stopping lighttpd you get:
$ exit
logout
Unmounting /mnt/stateful_partition/crouton/chroots/deb-cli...
Sending SIGTERM to processes under /mnt/stateful_partition/crouton/chroots/deb-cli...
That stopped lighttpd after a few seconds, but I guess a manual stop is preferred.
Performance
I have written about NUC vs RPi before and to be honest I was worried that my ARM Chromebook would more have the poor performance of the RPi than the decent performance of the NUC. I would say this is not a problem, the Acer R13 is generally fast enough.
After a few Nodejs tests, it seems the Acer Chromebook R13 is about 5-6 times faster than an RPi V2.
A C-program (some use of 64-bit double floats, little memory footprint) puts it side-by-side with my Celeron/NUC:
s
RPi V1 142
RPi V2 74
Acer R13 12.5
Celeron J3455 13.0
i5-4250U 7.5
Benchmarks are always tricky, but I think this gives an indication.