Monthly Archives: March 2018

VIM: Disable autoindent

More and more often I find that Vim comes with auto indention enabled. I don’t want that.

Perhaps the best way to fix this annoyance is to add the following to your .vimrc file.

" Switch off all auto-indenting
set nocindent
set nosmartindent
set noautoindent
set indentexpr=
filetype indent off
filetype plugin indent off

I found these exact lines here.

Acer Chromebook R13: 3. As a Linux development workstation

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:

  1. Install things directly in ChromeOS
  2. Crouton: command line tools only
  3. Crouton: xiwi – run X and (for example) XFCE inside a ChromeOS window
  4. Crouton: X – run X side by side with ChromeOS
  5. 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

  1. CTRL-ALT-T : to get a crosh shell
  2. crosh> shell : to get a ChromeOS unix shell
  3. $ 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 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.

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.

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
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.

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:

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.

Acer Chromebook R13: 2. As a casual computer

I have got an Acer Chromebook R13 and I will write about it from my perspective.

1. Background
2. As a casual computer (this post)
3. As a Linux development workstation

As a casual computer

My general impressions of the Acer Chromebook R13 are positive. The display is good (I am not used to Full HD on a laptop) and the build quality in general is more than acceptable.

What works well, quite literally out of the box:

  1. English language with non-English keyboard
  2. Connect to 5GHz WiFi
  3. Editing Google Docs, Facebook, Youtube
  4. Google Play Store for Android Apps (required a restart for a system upgrade)
  5. Spotify App (in Mobile App format), streaming audio via Bluetooth to external speaker
  6. Netflix App (failed to mirror/play to external display)
  7. Netflix Web Page (could display video on TV over HDMI)
  8. Writing this blog post…
  9. Switch to tablet mode, use touch and type on virtual keyboard on display (well, it sucks compared to a real keyboard, but it works as could be expected)
  10. Printing to a local network printer: CUPS comes preinstalled (there are other options as well, but for me CUPS is perfect)
  11. Importing photos from a micro-sd-card taken with a camera. VERY rudimentary (crop/rotate/brightness) editing available.

The good
So far my impression is that the performance is very acceptable. I used some JavaScript-heavy web pages and it was surprisingly good.

The not so good
Compared to my MacBook Air the touchpad is not as nice. Scrolling web pages is more… jerky? I would have preferred if the keyboard was closer to the display and the touchpad more far away from me. At least the touchpad is nicely centered in the middle. To be fair, the touchpad is at least as good as on more expensive PC laptops.

Performance and Benchmarks
My own Web Worker Test indicates my MacBook Air (1.4GHz Intel i5) is about 2-3 times faster (both computers using Chrome browser). However, on OS X, Safari seems to be much faster than Chrome browser on some tests and outperforms the Chromebook up to 10x on some tests. This is quite pure JavaScript number crunching.

My own String Compare Test indicates the MacBook Air is about 50% faster (Chrome browser in both cases).

Things not quite there
I have been using my Chromebook more or less daily and there isn’t much I actually miss. But here is a short list (that may grow or shrink over time).

  • A graph plotter/calculator: Grapher in OS X is not amazing but better than what I found for Chrome OS. So far I have tried Plot and Graph Functions and Desmos Graphing Calculator

Developer mode
So far I have not touched the Developer mode. Everything is completely standard and I will leave it like that for a while.

Acer Chromebook R13: 1. Background

I have got an Acer Chromebook R13 and I will write about it from my perspective.

1. Background (this post)
2. As a casual computer
3. As a Linux development workstation

The last 20 years I have used OS X since 10.0, Windows since NT4, and many Linux distributions. These systems all have their pros and cons. Last years Chromebooks running Chrome OS (which is Linux) have appeared. They are typically cheap and built for the cloud. However there are two things that make them particularly interesting:

  1. Chromebooks (modern ones) can run Android Apps
  2. Chromebooks are much used in schools, so children of today will start looking for jobs in a few years, knowing perhaps only Chromebooks

I am too curious not to want one (perhaps mostly to be disappointed).

A few years ago I thought about getting a Chromebook, but at the time I felt it was not going to satisfy me. I bought a MacBook Air 11 instead, which is a great laptop for my purposes. However I less and less agree with what Apple does and I would rather have a native Linux laptop, than a Mac.

There are several reasons why I bought an Acer Chromebook R13 as my first Chromebook

It has got good reviews (although it is not the latest Chromebook in the market).

I like the quality aluminium build (it almost reminds me of my Titanium PowerBook G4).

It has a touchscreen and can be used as a tablet or in tent mode.

It should run Android Apps very will with its ARM CPU.

I am enthusiastic and curious about the ARM CPU for several reasons. I like an underdog and after Spectre/Meltdown I think that we need all possible alternatives to Intel. I am also curious to see if the ARM performs decently enough for my needs (and I might get disappointed).

I hope to get decent quality and some new opportunities compared to MacBook Air.

As a standard user
Most of the time I am a very ordinary computer user. I browse the internet, pay my bills, send and receive emails, watch Youtube, write something using Google Docs and I do some basic photo editing. I kind of expect the Chromebook to do this just as well as my MacBook Air.

As a programmer
I am a programmer. I mostly code JavaScript for Node.js and the web, but I also code C, C++, Lisp, Python, Bash, or whatever I feel like (mostly for fun, sometimes for work). I don’t use very advanced tools (mostly Vim, actually) and I really feel comfortable with a Linux shell. Even Mac OS X with its many package managers feels foreign. Not to talk about how I am lost in Windows.

I understand Chrome OS is Linux. It comes with a terminal. It has a Developer mode. And I can install almost anything I want using crouton (or so I have read).

My hope is that my Chromebook, for most practical purposes, will work like Linux the way I expect (more so than OS X). My hope is also that the ARM CPU will have reasonaable JavaScript performance. I may end up disappointed.