Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Arch Linux on Chromebook Pixel 2

=========================================== Installing Arch Linux on Chromebook Pixel 2

Contents

Overview

This guide will walk you through installing Arch Linux on the Chomebook Pixel 2 in a dual-boot configuration. This will not void your warranty (ie, you don't need to remove the write-protect screw). The general process is as follows:

  1. Use the resize script to resize the stateful partition
  2. Reboot and allow ChromeOS to repair itself
  3. Set up a chroot environment in ChromeOS
  4. Use the chroot to install Arch on the new partition

RECOMMENDATIONS: Make a Chromebook Recovery USB before starting. If you have access to another machine this is not too much of an issue, but if you only have the Chromebook, you'll want this just in case anything goes wrong and you want to start over or go back to ChromeOS only.

Enter dev mode

WARNING: backup any relevant data in your chromeos stateful partition (eg, downloads, etc)

  1. Enter recovery by holding down Esc and (the refresh key), then press the power button and release all three.
  2. The recovery screen will say "ChromeOS is missing or damaged". Don't panic, and press Ctrl+D (there's no prompt).
  3. Press enter to confirm, then let it reboot into dev-mode. This process will take 5-10 minutes.

Enable USB and legacy boot

  1. Once you're back in ChromeOS, start a terminal via Ctrl+Alt+T.
  2. Type shell to get a real bash prompt.
  3. Type sudo crossystem dev_boot_usb=1 dev_boot_legacy=1

Re-size the stateful partition

Reboot, and press Ctrl + D to boot into developer mode as usual.

Press Ctrl + Alt + to switch to the VT2 console.

Note: is the right-arrow key above the 2 key, aka F2

Log in as the chronos user with no password. You'll need to first shutdown the UI service in order to unmount the stateful partition:

$ sudo stop ui

This will log you out -- simply log in again using the chronos user.

Decide how much space you want to dedicate to Arch (I chose 40GB). In ChromeOS, using a bash shell, run the following commands:

$ cd /
$ curl -sL https://git.io/cosresize | sudo bash -s

The script will unmount the stateful partition and resize it according to your input. Follow the prompts, and reboot when it's finished.

Once you're booted back into ChromeOS, verify that the partition has been re-sized by going to the file browser, clicking on "Downloads", and then on the menu button in the upper-right corner.

Set up an intermediary linux chroot

We need linux tools to install Arch linux. Luckily there's crouton. Follow the install instructions for crouton, then enter the chroot from the terminal:

$ sudo enter-chroot

Install Arch

Base installation

Before installing a new system, It's a good idea to make sure your host system (crouton) is up-to-date.

$ sudo apt-get update

Follow the installation guide starting at "Mount the partitions".

When running pacstrap, be sure to also include your editor of choice (eg, vim or nano), as well as some other packages that will be necessary later: base base-devel wget xmlto docbook-xsl kmod inetutils bc grub.

For the lazy:

$ sudo nano -w /etc/pacman.d/mirrorlist
$ sudo pacman -S arch-install-scripts
$ sudo mkfs.ext4 /dev/sda13
$ sudo mount /dev/sda13 /mnt
$ sudo pacstrap -i /mnt base base-devel nano wget xmlto docbook-xsl kmod inetutils bc grub
$ genfstab -U -p /mnt | sudo tee -a /mnt/etc/fstab
$ sudo arch-chroot /mnt /bin/bash

Install your editor of choice (eg, nano), Then set locale and timezone, and sync the hardware clock:

# nano -w /etc/locale.gen
# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8
# ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime

Note: The docs say to sync your hardware clock (hwclock --systohc --utc), however this will fail from within your chroot. Wait until you reboot into arch to do this (this is covered in Recommendations).

Set the hostname (also add it to /etc/hosts):

# echo myhostname > /etc/hostname
# nano -w /etc/hosts

Install the linux-samus kernel

Make sure the install system has the same repositories enabled as the host (eg, testing, multilib, etc) in /etc/pacman.conf., then update the system:

# nano -w /etc/pacman.conf
# pacman -Syu

Note: If you get an error that says something like warning: binutils: local (2.25-4) is newer than core (2.25-2), run pacman -Syuu first to downgrade those packages (not sure why this happened in my case).

Then, create your regular user. To give your user account administrative privileges, you can create them with the adm group:

# useradd -U -m -G adm myuser
# passwd myuser

You can allow users in the adm group to run any command with sudo by updating the sudoers file:

# EDITOR=nano visudo

Add the following line and save the file:

%adm ALL=(ALL) AL

Now you can switch to your regular user account and continue from there.

# su - myuser

Now install the linux-samus from raphael's github repo:

$ sudo pacman -S git
$ mkdir -p ~/.local/src && cd ~/.local/src
$ git clone https://github.com/raphael/linux-samus
$ cd linux-samus/scripts/archlinux
$ ./install.sh

Networking

While you still have an internet connection, make sure to install your preferred networking packages. If you want to use wifi-menu (commandline) , you'll need dialog and wpa_supplicant. If you're using NetworkManager, just install networkmanager.

Chromebook-specific tweaks

zSwap

Install the zramswap package from AUR, and enable the systemd service. This will save you many headaches down the road. Before I enabled zswap, I experienced a lot of kernel OOM-kill (out-of-memory kill) events, which tended to lock up the kernel for anywhere from a few seconds to a few minutes. Even though you have plenty of memory, not having swap means the kernel is much more aggressive about memory. Using zram for swap should keep the kernel happy:

$ cd ~/Downloads
$ wget https://aur.archlinux.org/packages/zr/zramswap/zramswap.tar.gz
$ tar xf zramswap.tar.gz
$ cd zramswap*
$ makepkg
$ sudo pacman -U zramswap*.tar.xz
$ sudo systemctl enable zramswap

You'll also need to comment out or remove the zram0 device from /etc/fstab:

...
#/dev/zram0             none            swap            defaults        0 0
...

Sound

The SoC audio device shows up as the second ALSA device, so you might want to add this to /etc/modprobe.d/alsa-base.conf to change the order:

options snd_soc_rt5677 index=0
options snd_hda_intel index=1

Next, change to the linux-samus kernel source directory, and perform the following:

$ sudo pacman -S alsa-utils
$ ALSA_CONFIG_UCM=ucm/ alsaucm -c bdw-rt5677 set _verb HiFi
$ sudo alsactl store

This initializes the sound card and saves the state for the next reboot.

Touchpad

Install xf86-input-synaptics (this is needed even though we're not using a synaptics touchpad)

$ sudo pacman -S xf86-input-synaptics

Display

Edit /etc/mkinitcpio.conf and add i915 to the MODULES list

...
MODULES="i915"
...

Edit /etc/default/grub and set GRUB_TERMINAL_OUTPUT to console:

...
GRUB_TERMINAL_OUTPUT=console
....

Touchscreen in Chrome

To enable touchscreen in the chrome browser, it must be given the touchscreen device number in the --touch-devices list. You can make this automatic using the following script to start chrome (place this in your path, eg, /usr/local/bin or ~/.local/bin):

#!/bin/bash
touchscreen=$(xinput --list | perl -nle 'print $1 if /Touchscreen.+id=(\d+)/')
google-chrome --touch-devices="$touchscreen"

Note: Make sure to use the correct google-chrome binary in the above script if using google-chrome-beta or google-chrome-unstable.

Chromebook Keyboard Support

Install xkeyboard-config-chromebook from AUR.

Enable the GRUB bootloader

Generate the initramfs, install GRUB, and generate the boot config:

$ sudo mkinitcpio -p linux-samus
$ sudo grub-install --target=i386-pc --recheck --debug --force /dev/sda
$ sudo grub-mkconfig -o /boot/grub/grub.cfg

GRUB will expect /sbin/init to exist. Installing systemd-sysvcompat will create a symlink to systemd so that grub can find it.

$ sudo pacman -S systemd-sysvcompat

Moment of Truth

Exit both chroots and make sure to unmount any volumes used for the chroot.

Note: you'll need to press Ctrl + L every time you reboot to enter into legacy boot mode.

If you're creating the install medium, make sure to run sync before rebooting. Once you're booted into the install medium go back to the Prepare the primary SSD drive step, and repeat the remaining steps on the SSD drive.

Otherwise, once you've finished installing on the SSD and you've rebooted using legacy boot, you should see your Arch Linux GRUB menu (assuming everything went smoothly).

Recommendations

Sync HW clock and NTP

After rebooting, sync your hardware clock and enable ntp time sync

$ sudo hwclock --systohc --utc
$ sudo timedatectl set-ntp true

SSD performance

Enable fstrim for better SSD sustained performance

$ sudo systemctl enable trim.timer

Install anything-sync-daemon from AUR, and configure it to mount any i/o-heavy directories (such as browser profile directories).

$ sudo pacman -S anything-sync-daemon

You can also use profile-sync-daemon to manage just browser profiles:

$ sudo pacman -S profile-sync-daemon

More information on keeping your SSD healthy can be found in the Arch wiki SSD article.

Better font rendering

Install the infinality-bundle meta package:

$ echo -e "[infinality-bundle]\nServer = http://bohoomil.com/repo/$arch" | sudo tee -a /etc/pacman.conf
$ sudo pacman-key -r 962DDE58
$ sudo pacman-key --lsign-key 962DDE58
$ pacman -Syy
$ pacman -S infinality-bundle

References:

@kodiak879

This comment has been minimized.

Copy link

kodiak879 commented Nov 30, 2016

I must have missed something obvious, but Im to the step where crouton is installed and setup with the -t core option and I am able to enter the chroot, but none of the arch tools required for the install are in there...? I did the sudo apt-get update but still no pacstrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.