Running Linux on the Asus C201PA Chromebook

I was recently looking for a cheap laptop to run Linux on, mostly for programming. I settled on the Asus C201PA Chromebook for two reasons: I have good experience with Asus Hardware, and there were many success stories of people running Linux on it.

Kali Linux have an image available for the Chromebook Flip, which is almost identical to the C201PA. Installation is really straightforward, but I’m going to detail how I did it here since I ran into a few issues.

First, put the Chromebook into Developer Mode (warning: this will erase all personal data in ChromeOS). This lets you boot other operating systems. To do this, hold down ESC + REFRESH (F3) and touch the Power button. When the Chromebook reboots, select Recovery, then press CTRL + D. This boots ChromeOS in Developer Mode.

Once booted, press CTRL + ALT + T to open the terminal. Write

shell

to get the shell, then

sudo su

to get root. In order to boot Linux from a microSD or USB drive, run the command

crossystem dev_boot_usb=1

which enables USB booting.

Now you need to prepare the MicroSD (or USB) drive with Kali Linux. Download the Kali Linux image to your computer (or Chromebook) and run

xzcat kali-$version-veyron.img.xz | dd of=/dev/sdx bs=512k

Substituting $version with the specific version you downloaded. /dev/sdx would be your MicroSD card or USB drive (be extra careful to get it right, as the dd command will erase your drive!).

This is where I started to run into a small issue: The Kali image is made for an 8 GiB drive, and I was using a 16 GiB. This meant 8 GiB completely unusable space on the drive. To solve this, you need to use parted and cgpt (cgpt is part of vboot-utils) to change the size of the root partition:

parted /dev/sdx
>print

Where /dev/sdx is once again your Kali drive. Parted will complain that not all the space appears to be used, and that it can fix it for you. Let it do so. Unfortunately, we are not done yet. If you try to boot Kali now, you will find that the drive is unbootable.

You’ll have to run

cgpt show /dev/sdx

And write down the number in the column Start at the row Sec GPT table. We need this number to calculate the size of the root partition for the next command:

cgpt add -i 2 -t data -b 40960 -s `expr X – 40960` -l Root /dev/sdx

where X is the number you just found. Careful, the “`” is the key to the left of the “1” (on UK keyboards).

Repair the partition layout using

cgpt repair /dev/sdx

Re-add the boot partitions by

cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/sdx
cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/sdx

And finally, expand the root filesystem by:

mount /dev/sdx2 /mnt/tmp

Assuming /mnt/tmp exits, and then

resize2fs /dev/sdx2

 

Finally, the microSD or USB drive is ready! Plug it into the Chromebook, power it on, and press CTRL + U at the white boot screen to boot from USB. Kali Linux should now boot and present you with the login screen. Username is root, password is toor.

You should change the root password with ‘passwd’, and if you decide to use Kali for everyday use, I’d recommend adding a new user with

useradd -m -s /bin/bash (username)
passwd (username)

And then install and use sudo for when you need elevated privileges.

 

Apart from Kali, it is also possible to install and run Arch Linux. I have it running on another microSD card, but have to solve some issues before I’m happy with it (probably related to the framebuffer).

I’ve also tried installing Gentoo Linux, and got as far as running it but was unable to get the network adaptors working. They need pre-compiled modules that I was not able to load. If I ever get it working, I’ll make a new blog post about it. Gentoo is what I’m running on my desktop and Raspberry Pi, and would prefer to run it on the Chromebook too.

I’m also debating whether to move Kali or Arch to the internal memory, wiping ChromeOS. I have still to make that decision, though.


Sources:

  1. https://www.chromium.org/a/chromium.org/dev/chromium-os/developer-information-for-chrome-os-devices/generic
  2. http://docs.kali.org/kali-on-arm/kali-linux-asus-chromebook-flip
  3. https://forums.kali.org/showthread.php?27350-Chromebook-expand-resize-grow-partition-rootfs

My Model Shipyard

For the past 15 years or so I’ve been building model sailing ships on and off. This has resulted in 2 finished kit models, one of them modified, and one scratch-built model still under construction.

I’ve had some pictures of my ship models on several websites, but what with the nature of the web, most of these sites no longer exist.  For that reason I’ve decided to leave a few pictures on this blog, with a brief description of the ships.

 

HM MORTAR VESSEL CONVULSION

This was the first kit model I finished, and while the subject is certainly not the most beautiful ship ever built, I was quite happy with the result. It’s a rather small ship and doesn’t have as many details as my later models.

HM Mortar Vessel Convulsion
Deck details

HM BOMB VESSEL GRANADO

Continuing my theme with bomb vessels, I then built the “Granado”, a British bomb vessel from 1756. This is also a kit model, but I have made several modifications such as the hand-carved stern gallery and figurehead.

HM Bomb Vessel Granado
Stern details – the gallery is hand-carved from Swiss pear.
Hermes decorating the stem – with a bomb in his right hand!
Rigging
Stern view

USS SYREN

The current ship I’m building – and have been building for the past 9 years or so – is the USS Syren, a 18-gun brig of the fledgling US Navy of 1803. This is a scratch-built model made from plans acquired at Model Ship World.  As can be seen from the photos, it is far from finished and will take several years more to finish, especially at my current tortuous pace…

USS Syren
Carronade details
Head rails
Progress as of writing

I’d like to say that my skills have progressed noticeably since my first ship; unfortunately, that has come at the cost of slower progress, especially since I have a large amount of other hobbies demanding my time.

 

In the future, I’ll detail some specific parts of the construction of the USS Syren, which may be of interest to other model ship builders.

If you have any questions or comments, please don’t hesitate to contact me (contact details in ‘about’ in the upper right corner)!

Audio Selector

I usually change a lot between speakers and headphones on my PC – Speakers when I watch movies or listen to music, and headphones when I’m at the desktop. I hate having to insert and remove the jack every time I want to change, so about a year ago I bought a cheap audio selector from Amazon. That worked for about half a year until one channel started to become lower volume than the other. So instead of just buying some new cheap selector, I decided to channel my inner maker and make my own.

I decided to go with 3 outputs so I could connect an extra pair of speakers in the future. I was able to get some 3-input 2-position switches at my local electronics store that I could just wire with 1 input and 1 output to get the desired off-on effect.

The circuit is rather simple: connect the centre of all the switches to the input jack (red wire right speaker (ring), white wire left speaker (tip), black ground (sleeve)), and one side of each switch to an output jack (the 3rd side will be empty, corresponding to OFF).

audio_selector_schem
Diagram shows only 2 switches, but can easily be expanded

Having taken some quick measurements (the box had to fit below my secondary monitor) I made a back-of-the-envelope draft of the design and collected the parts. For my design I needed 4 3,5mm female audio jacks, 2 male jacks (to connect the input side of the box to the PC), 3 switches and some cable.

Audio Selector - Pieces

I decided to go with American walnut for the box as I had several sheets lying around at varying thickness. I ended up using 4 mm thick sheets for the end pieces and 2 mm for the rest. The backside was problematic, the female audio jacks I had bought could only be screwed onto a plate of maximum 1 mm thickness, and walnut is rather brittle at that thickness. Eventually I found the lid of a plastic cookie box and used that for the back side. Cheap and easy!

Construction of the box was quick and straightforward:

Creating the box
Creating the box

Though soldering the switches and cables allowed me to practice some new swear words (I’ve never been good at soldering).

To finish the box I sanded it with some fine grit sandpaper and gave it a coat of linseed oil. In the future I might draw numbers or symbols over each switch on the front to identify it.

Audio Selector - Back
Viewed from the back. The red plate is from a cookie box.
Audio Selector - Front
Finished audio selector

All in all, this was a fun 2-day project for me. In total I think the parts cost me some 20€; I might have been able to get a finished box cheaper, though I’ve not had much luck finding any for sale, and the few on Amazon are either very expensive or poor quality.  I’m very happy with the result, the switches are nice to operate and the box is sturdy and looks good on my desk. And most importantly, you just can’t beat home-made electronics!

Arduino & Lego PF Motors

Working through the book Arduino Workshop by John Boxall I’ve finally come to the chapter describing how to build an Arduino Tank Robot. However, instead of buying a premade robot chassis I decided to make it out of Lego Technic instead, something I played a lot with as a child.

This presented me with some interesting challenges, first of all, how to interface the Lego Power Functions motors with the Arduino. Luckily, I’m not the first one doing this stuff, and I quickly found a great blog detailing how to cut the motor cables. As I didn’t want to permanently destroy the great Lego set I had just bought (the 42042 Crawler Crane), I bought some new cables and an extra motor from Lego.

Preparing the cables was easy: cut them, strip and tin the two outer wires for the battery pack (+9V and GND), and the two inner cables for the motors.

Jpeg
Cutting the cables (Lego fans should look away!)

To check if it all worked, I built a quick circuit with a TIP122 transistor according to this Arduino tutorial (though a bit simplified, I didn’t really need the switch). It worked perfectly, and I was able to control the motor speed with some simple PWM code. Next step was to run 2 motors off the Adafruit motor shield. As you can see in the video below, it all worked perfectly.

Stay tuned for a future post where I’ll talk about the design and functioning of my Lego tank robot.

Jpeg
Arduino Lego Tank Robot