Crouton and Chromebrew on Chromebook
After using Termux for six months (see my post here),
I switched to Crouton together with
Chromebrew.
My problem with Termux is that when things break after
pkg upgrade
, it’s hard to find solutions.
On the other hand, Crouton uses chroot to install a full-blown Linux OS (almost), making it much easier to maintain. Take Ubuntu for example, the solution to almost any problem is available online.
Then there is Chromebrew, a package management tool for the native ChromeOS shell.
It is similar to homebrew on Mac and its command is crew
.
So far I haven’t experienced any problems with its package upgrade.
After using them for several months, I have a strong inclination to use crew
whenever possible.
It has one less layer of indirection, and its graphics support feels more native.
The resolution of Crouton graphics is either too high or too low.
(Maybe it’s tunable by other means. The only way I know is to toggle the HiDPI
option in the Chrome crouton-integration extension.)
I routinely use the installtions of python
, go
, make
, git
, latex
,
ruby
, aws
, gcloud
, vim
, vscode
in Chromebrew, which all work great.
The only problem I ran into is with npm
and vue
. So I have them installed
inside the Ubuntu 18.04LTS in Crouton.
It’s totally possible that they work in Chromebrew too and I just didn’t
try hard enough.
As a side note, Google started Project Crostini to support native Linux apps inside Chrome OS. It uses container technology and does not even require developer mode. I may give it a try when my Samsung Chromebook Pro is officially supported.
Chromebrew
To install Chromebrew, run the following command (copied from their Github page)
curl -Ls git.io/vddgY | bash
The default installation includes quite many packages, for example,
python3
git
make
gcc/g++
ruby
I also installed a newer vim
using
crew install vim
For my Samsung Chromebook Pro, python3
and the new vim
are not exposed, and
I need to change my .bashrc
to alias them.
They are all in /usr/local/bin/
I also installed jekyll
and my blog runs locally at http://127.0.0.1:4000/
(unlike Termux).
gem install bundler jekyll
Note that some packages need extra configurations to be saved in the
~/.bashrc
file. These instructions are printed as blue text at the end of the
crew install <package>
execution.
For example, sommelier
is a prerequisite for code
(vscode) and it has
a few configurations to go into the bashrc
file.
So is the go
installation.
The vscode
installation didn’t work on my Chromebook. The Chromebrew team
gave me the following trick to resolve it.
crew remove eudev && crew install eudev
One annoying thing is that vscode crashes after closing the Chromebook lid. (Again it may be a result of other tuneups I did.) To restart, use
stopsommelier && startsommelier && code
Crouton
installation
For installation, I followed Miguel Grinberg’s post
One minor difference is that I installed Ubuntu 18.04LTS instead of the default 16.04LTS. To see the available Linux releases, use (assuming crouton script is downloaded)
sh ~/Downloads/crouton -r list
The output on my shell is
chronos@localhost / $ sh ~/Downloads/crouton -r list
Recognized debian releases:
potato! woody! sarge! etch! lenny! squeeze! wheezy jessie stretch buster sid
Recognized kali releases:
moto! kali! sana! kali-rolling
Recognized ubuntu releases:
warty! hoary! breezy! dapper! edgy! feisty! gutsy! hardy! intrepid! jaunty!
karmic! lucid! maverick! natty! oneiric! precise! quantal! raring! saucy!
trusty utopic! vivid! wily! xenial yakkety! zesty! artful* bionic*
Releases marked with ! are upstream end-of-life, and should be avoided.
Releases marked with * are unsupported, but may work with some effort.
Although Ubuntu 18.04LTS (Bionic Beaver) is listed as unsupported, it runs fine on my Samsung Chromebook Pro. Overall, my installation command is
sudo sh ~/Downloads/crouton -r bionic -t xiwi,xfce
xfce
is a light-weight desk manager.
xiwi
is a must-have to integrate the Linux OS better into the Chrome OS.
To make xiwi
work, one needs to install crouton extension to Chrome as well.
More tips on xiwi
can be found here.
Without xiwi
, the X11 rending is done by the xorg
method
(if you use my installation command above, xorg
is NOT installed).
With xorg
rendering, one can switch between Chrome OS and Linux OS using
ctrl+alt+<forward/backward (the keys next to escape)>
.
On my Chromebook, everything looks extremely small with the default xfce4
desktop setting.
It also seems to freeze very briefly every now and then.
Thus I opted out of xrog
.
With xiwi
, the Linux OS becomes an app (similar to the Android apps in Chrome OS),
making it much easier to switch OS.
One can even run a Linux GUI inside the Chrome browser tab.
The visual quality is worse than the xorg
rendering or the native Chromebook look.
To get high resolution rendering, click on the Crouton extension and check HiDPI.
But then everything looks too small again.
The brief freeze goes away with xiwi
rendering though.
In case you want to get rid of an installed release, run
sudo delete-chroot <name>
basic usage
If you just need a Linux terminal, run
sudo enter-chroot
For vim users, one annoying thing is that ctrl+w
is captured by Chrome as
closing the tab. The workaround is to expand the tab in full screen mode.
If you need a graphic desktop environment, use
sudo startxfce4 -b
Here -b
means “run in the background” so that the tab in the Chrome browser is still usable.
To run vscode in a browser tab, use
sudo startxiwi -T code
This vscode looks worse than the one in Chromebrew due to the graphics issue. I basically don’t use the graphic part of Crouton at all nowadays.