Tuesday, January 3, 2017

Travels with a Chromebook

Two years ago I wrote A Note Of Thanks as I switched my disposable travel laptop from an Asus Seashell to an Acer C720 Chromebook running Linux. Two years later I'm still traveling with a C720. Below the fold, an update on my experiences.

As I wrote two years ago, I started by replacing ChromeOS with HugeGreenBug's port of Ubuntu 14.04. This gave me almost exactly the UI I was then running on my desktop, so I was happy with one exception:
I'm still not used to the much bigger touch pad, and keep accidentally moving the cursor by touching the touch pad with the balls of my thumbs.
This turned out to be a permanent irritation (but see below for what I should have done to fix it). Although the combination of the C720 and Ubuntu 14.04 gave sterling service for a long time, I started noticing an occasional crash. One of them was a very spectacular snow crash, which caused me to suspect a hardware problem. It was a day and a half before a trip, so I resorted again to Amazon's same-day delivery for a second C720. By the time it arrived all seemed well again with the first one, so I left with it and had no problem on the trip.

Now I had two C720s, so I could experiment with alternate Linux ports. I installed GalliumOS on the second one, and worked with it for a while. It was totally crash-free, being based on Xubuntu 16.04 was significantly more up-to-date, and it was certainly lean-and-mean. Derrick Diener's GalliumOS: The Linux Distro Specially Designed for Chromebook is a good review of GalliumOS.

But I just couldn't come to terms with the XFCE desktop and the way the touchpad had been configured to mimic the ChromeOS touchpad. I'd traded one irritation for two. Then I found Mark Solters' Ubuntu 16.04 on the Google Pixel 2, which reported:
I hit upon trying Linux Mint 18 “Sarah”, currently beta. This version of Mint is 16.04 based, and the installer boots on the Pixel 2!
So I downloaded Linux Mint 18.1 "Serena" - Cinnamon (64-bit), wrote the .iso to a USB drive, popped it into the first C720 and powered up. The Mint live system came right up! I played with it for a while. Everything seemed to work, and the Cinnamon UI was a lot more to my taste than XFCE. Worth a try. After backing up my files from 14.04, I double-clicked on "Install Linux Mint".

After you answer the questions about keyboard and time zone and so on, the install starts with a worrisome long pause with the spinning cursor, but then things proceed normally with a progress bar. After it finished and I rebooted, I had a default Linux Mint system with 19GB of free space.

My next step was to connect to my WiFi network and
sudo apt-get update
sudo apt-get upgrade
which updated 12 packages. I have no travel for the next month and a working if slightly irritating environment on C720 #2, so I can take the opportunity to clean things up and customize a nice fresh environment on C720 #1. For the programming environment I needed:
  • git - the LOCKSS Program is converging on gitlab.com and gitlab CE.
  • emacs - which I still use for programming although I also use vi.
  • The JDK, ant, libxml2-utils and junit - needed to build the LOCKSS software.
  • Docker
For more general needs I added:
  • TeX Live- still my favorite environment for writing papers.
  • KeePassX - everyone should use a password safe.
  • gnucash
  • zoom.us - a program committee I'm on uses this for distributed meetings, it works really well.
So far, everything else I need is in the default install. At this point I have 17GB free. Not a lot, but as in the 14.04 days I will travel with an external SSD that holds my development environment.

Then I closed the lid, had a cup of tea, and opened the lid again. Things seemed to be working but, as I quickly discovered there was a problem. It turns out that the Mint kernel shows symptoms that appeared on Chromebook Linux wikis back in 2014:
  • Suspend/resume works the first time, but the next time the screen locks but the processor keeps running indefinitely. Shutdown behaves similarly.
  • And after a resume /var/log/kern.log is continually spammed with messages from ehci-pci saying resume error -19.
Not good. I tried various fixes found by Google-ing but none worked. Then I had an inspiration. I had two machines:
  • C720 #2 with a working kernel and a userland I didn't like.
  • C720 #1 with a broken kernel and a userland I liked.
All I needed to do was to get C720 #1 to boot the GalliumOS kernel not the Mint one. I re-installed vanilla Mint 18.1 on C720 #1 then here is what I did to it.

Stage 1 was to get the GalliumOS fixes relevant to the suspend/resume issue into the Mint userland:
  • Check out the CalliumOS config files for Haswell by:
    git clone https://github.com/GalliumOS/galliumos-haswell
    
  • Copy each of the files into its appropriate place.
Stage 2 was to get the GalliumOS kernel installed on C720 #1:
  • Create a file /etc/apt/sources.list.d/additional-repositories.list containing the line:
    deb http://apt.galliumos.org/ xenon main
    
  • Copy the file /etc/apt/trusted.gpg.d/galliumos.gpg from C720 #2 to C720 #1.
  • Run synaptic, reload, search for linux-image-galliumos, mark it for installation, apply.
  • Set the grub bootloader to display its menu by default so that if something goes wrong you can boot the Mint kernel using the "advanced options" menu item. Edit /etc/default/grub to read:
    #GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=false
    GRUB_TIMEOUT=15
    
  • Run update-grub to make the changes take effect.
  • Reboot, and the system comes up:
    $ uname -r
    4.7.2-galliumos
    $ 
Now suspend/resume works just the way it does on GalliumOS!

Three years ago redditor SuccessInCircuit posted List of fixes for Xubuntu 13.10 on the Acer C720. Some of these fixes still seem to be relevant:
  • GalliumOS follows SuccessInCircuit's advice to optimize for the C720s SSD. So I edited the root file system entry in /etc/fstab to be:
    /dev/mapper/mint--vg-root / ext4 discard,relatime,errors=remount-ro 0 1
  • I find it necessary to disable the touchpad while typing. SuccessInCircuit says to do this with syndaemon, but there is a better way for Ubuntu 16.04, installing a touchpad control applet in the tray:
    $ sudo add-apt-repository ppa:atareao/atareao
    $ sudo apt-get update
    $ sudo apt-get install touchpad-indicator
    
  • Brave souls have upgraded the M.2 SSD, reinstalled ChromeOS, then installed Linux, but I'm not yet up for that despite the lack of space.
I'm now working on building the nice fresh environment on C720 #1 before my next trip. If I encounter anything else interesting I'll comment on this post.

Update 4th May 2018:
After another strange crash on C720 #1 which corrupted its disk, I found C720 #3 refurbished for $129.99 on Amazon. This time I also got a 128GB M.2 SSD to replace the stock one.

Update 9th May 2018
I installed the 128GB SSD, recovered Chrome OS, installed Mint Cinnamon 18.3 and now have over 100GB free space on disk. To install the SSD I:
  • Turned the C720 over and removed the 13 screws holding the back cover on.
  • Cracked the case open using a small screwdriver to get a front corner open, then slid a guitar plectrum along to free up the the rest of the clips. This step is a bit scary!
  • Removed the screw holding down the original SSD, replaced it with the new one, and replaced the screw.
  • Put the back cover back in place, pressed down on it to get most of the clips seated.
  • replaced the 13 screws, tightening them gently to seat the remaining clips.
So now I have 3 functional C720s, albeit one with a habit of occasional mysterious crashes, each with Mint userland and GalliumOS kernel.

Gratuitous copy and paste

I notice that the links to the instructions for installing Linux from A Note Of Thanks are now broken, so I'm cutting and pasting them from the Archlinux wiki so I can find them easily:

Enabling developer mode

Developer Mode is necessary in order to access the superuser shell inside Chrome OS, which is required for making changes to the system like allow booting through SeaBIOS.
Warning: Enabling Developer Mode will wipe all of your data.
To enable developer mode:
  • Turn on the Chrome OS device.
  • Press and hold the Esc + F3 (Refresh) keys, then press the Power button. This enters Recovery Mode.
  • Press Ctrl + D (no prompt). It will ask you to confirm, then the system will revert its state and enable Developer Mode.
Note: Press Ctrl + D (or wait 30 seconds for the beep and boot) at the white boot splash screen to enter Chrome OS.

Accessing the superuser shell

After you have enabled the Developer Mode you will need to access the superuser shell. How you do this depends on whether you have configured Chrome OS or not.

Accessing the superuser shell without Chrome OS configuration

If you have not configured Chrome OS, just press Ctrl + Alt + F2 (F2 is the "forward" arrow on the top row, →), you will see a login prompt.
  • Use chronos as the username, it should not prompt you for a password.
  • Become superuser with sudo, use the command sudo su -.

Accessing the superuser shell with Chrome OS configuration

If you have configured Chrome OS already:
  • Open a crosh window with Ctrl + Alt + T.
  • Open a bash shell with the shell command.
  • Become superuser with sudo, use the command sudo su - to accomplish that.

Enabling SeaBIOS

If your Chrome OS device did not ship with SeaBIOS or you prefer to install a custom firmware, then continue to Flashing a custom firmware.
This method will allow you to access the pre-installed version of SeaBIOS through the Developer Mode screen in Coreboot.
  • Inside your superuser shell enter:
# crossystem dev_boot_usb=1 dev_boot_legacy=1
  • Reboot the machine.

Booting the installation media

  • Plug the USB drive to the Chrome OS device and start SeaBIOS with Ctrl + L at the white boot splash screen (if SeaBIOS is not set as default).
  • Press Esc to get a boot menu and select the number corresponding to your USB drive.
I'll update this post again after I've tried replacing the SSD.

21 comments:

David. said...

After several trips with the GalliumOS kernel and the Mint user-land everything is mostly fine. Suspend has worked almost always· But it is important to note that suspending takes a very variable amount of time, sometimes several minutes. And interrupting the process while it is underway, for example by plugging or unplugging the power, seems to trigger the catatonic state. This may be because the machine decides to hibernate rather than suspend; I still need to figure out how to completely disable hibernate mode.

David. said...

One more anomaly. The power brick is rated 1.7A on the AC side. With the system charging the battery and in use playing a YouTube video, it actually draws 0.56A 36W from a 110V supply (measured with a Kill-A-Watt meter). But if you plug it into some sockets, such as the sockets on hotel lamps (claimed to supply 4A), and some of the seat power sockets on United, it appears to trip the current limiter and it doesn't get power. Plug a USB charger into the same socket and it gets power. I don't understand why supplying a bit over half an amp causes a problem.

David. said...

At Ars Technica, J. M. Porup has a review of two ways to run Linux on a Chromebook, Crouton and the one I use, GalliumOS.

David. said...

While I was on the road in New Zealand, the power brick failed. When I got home, I replaced it with a much better one, smaller, lighter, with an indicator light, only two pins not three.

David. said...

Recently I've been plagued by a failure of the Cinnamon screen lock program to allow me to type my password after the machine wakes up. The only way out seems to be power-cycle, which is annoying. So I've replaced Cinnamon with Mate, which uses a different screen lock, on one of my machines and will use it for a while to see if the problem recurs.

David. said...

I should have known better. The ZTC 128GB SSD, Model ZTC-SM201-128G that I bought from Hot Deals 4 Less(!) on Amazon lasted 7.5 weeks of light usage in C720 #3 before failing with a massive outbreak of bad blocks. I sent a message to the vendor via Amazon, but after two business days have yet to hear back from them. A few more days of no response and they'll get a 1-star review for crappy product and lousy customer support.

David. said...

The good news is that, so far, MATE's screen lock has performed flawlessly.

David. said...

The saga continues. I replaced the ZTC 128GB SSD with an ADATA 128GB SSD. It, and C720 #3 have been working fine except that #3's touchpad suffers an annoying jitter, so it was only comfortably usable with a mouse.

So, having overcome my qualms about opening C720s' cases, I upgraded #2 with a Transcend 64GB SSD.

The one remaining issue is that, very occasionally, when they are asleep each of the C720s appear to have a nightmare and wake up. This drains the battery, and if they're in the bag at the time, can get them quite hot.

David. said...

Google has announced official Linux support for Chromebooks:

"Google today announced Chrome OS is getting Linux support. As a result, Chromebooks will soon be able to run Linux apps and execute Linux commands. A preview of Linux on the Pixelbook will be released first, with support for more devices coming soon."

Linux runs in a VM under ChromeOS.

David. said...
This comment has been removed by the author.
David. said...
This comment has been removed by the author.
David. said...

I deleted the two previous comments because further experimentation revealed they were wrong.

It appears that up-to-date Mint 19 (MATE) plus the GalliumOS userland fixes has two problems on the C720:

1) With the GalliumOS 4.8.17 kernel it suffers a GPU hang on resume from sleep that logs out the user.

2) With the Mint generic kernel 4.15.0-20 it suffers the same long-standing resume problem with ehci.

Mint 18.3 with the GalliumOS 4.8.17 kernel works fine.

David. said...

Also, installing Mint 19 with an encrypted disk works, but the second time the system starts from cold entering the disk passphrase you set does not successfully decrypt the disk.

David. said...

After some experimentation, I now have Mint 19.2 running on a C720 with the vanilla 4.15.0-54-generic kernel not the GalliumOS one. Instructions:

* git clone https://github.com/GalliumOS/galliumos-haswell
* Copy files into place
* Edit /etc/default/grub as above
* Run blkid to get the UUID of the swap partition
* Create a file /etc/initramfs-tools/conf.d/resume contents:
RESUME=UUID=
* Run update-grub
* Run update-initramfs -u -k all

This kernel does not have the GPU hang.

David. said...

MATE 19.2 works fine on the C720 but it can't use full-disk encryption. Selecting full-disk encryption during the install process works, but the first or sometimes the second restart corrupts the encrypted volume so that the passphrase set during installation does not decrypt it. Home directory encryption works fine on an unencrypted disk.

This problem does not happen on a PC; I have verified this by installing MATE 19.2 on an Intel NUC.

David. said...

Tim Anderson points out another reason to run Linux on your Chromebook in Buying a Chromebook? Don't forget to check that best-before date:

"It is unlikely to be printed on the box, but every Chromebook has an "Auto Update Expiration (AUE) Date" after which the operating system is unsupported by Google.

The authoritative document on the subject is here, where Google explains that it "provides each new hardware platform with 6.5 years of Auto Update support". While 6.5 years sounds reasonable, Google starts the clock ticking "when the first device on the platform is released". ...

What happens when the dreaded AUE date passes? This means there will be no more automatic software updates from Google, no technical support from Google, and "business and education customers... should not expect that they can manage their devices as expected using the Google Admin console"."

It is (deliberately?) hard to figure out what the AUE date is for your Chromebook, but it looks as though my Acer C720s AUE was last June. But they still work fine and get software updates because they run Linux!

David. said...

Another good source of C720 information is here.

David. said...

The C720's touchpad is one of its downsides, so you need to travel with a mouse. The Tracpoint is way the best travel mouse I've ever used, and one of my Kickstarter successes. It is tiny, yet the ergonomics are great - the grip looks strange but it feels like a pen. It is so small it is easily usable on the C720's space alongside the touchpad, which measures a scant 3.7" wide by 2.6" high.

David. said...

The battery in the first of my C720s expired. I ordered a Dentsing AP13J3K battery from Amazon ($32.69 including tax). I opened the case, undid the two screws holding the battery, replaced it and the screws, and reassembled the case. It works fine.

David. said...
This comment has been removed by the author.
David. said...

Mint kernels up to and including 5.0.0-32-generic go to sleep normally when the lid is closed, and wake up normally when it is opened. Subsequent kernels 5.4.0-42 and 5.4.0-48 appear to go to sleep normally when the lid is closed but when it is opened do not wake up, they do a cold boot. This is possibly related to the known problem in the latest Mint that prevents it working with encrypted swap, with which my C720s are configured.