The easiest and fastest way to get a Debian rootfs to run on the Acer C7 series Chromebook is in a chroot to be entered from ChromeOS (in developer mode). The crouton installation scripts by Google's David Schneider work flawlessly: I had, with install options "-r sid" and "-t lxde" Debian Sid with the LXDE desktop environment up and running in 30 minutes flat. So, read no further if all you want to do is to play around a bit with running a Debian rootfs on your Acer C7 series Chromebook.
The chroot method is not suitable in my view for a serious Debian rootfs installation, as you'll bump into restrictions imposed by the ChromeOS chroot. For example, installing a CUPS network printer in the chroot turned out to be a major headache... You'll be wasting a lot of time chasing solutions to this and similar problems.
Better in that case to run the Debian rootfs directly on the hardware, with its own kernel. Initially, as described in this HOWTO, that will be a copy of the ChromeOS kernel, but this could eventually also be a Debian kernel configured for the Chromebook hardware and firmware.
My Chromebook came with an internal 320GB HDD and 2 GB RAM, which I've upgraded to a 120GB SSD and 8 GB RAM. That makes this Chromebook a very capable machine indeed to run a Debian rootfs on, even with that modest 1.1GHz Celeron dual-core CPU.
While there are umpteen scripts and blogs around showing how to install Ubuntu on this Chromebook, this HOWTO focuses strictly on Debian. The title says Sid, but it works just as well for testing (Jessie) and stable (Wheezy). In fact, this revised HOWTO is based on installing Wheezy, since Sid was on the fritz while writing it at the end of August 2013.
Most commands in the following are to be run with root privileges.
1. Prepare your Chromebook
The Chromebook must be put (and kept) in developer mode: power on while simultaneously pressing the Esc and Refresh buttons, after which a "scary screen" appears with dire warnings. Ignore these, press Ctrl-D, press Enter to confirm the procedure, and press Ctrl-D once more. This takes a little while to complete.
From now on the Chromebook (re)boots into that scary screen (get used to it!); press Ctrl-D to start the priority OS, at first ChromeOS. Once in the login screen, open a shell with Ctrl-Alt-Forward (where Forward is the right-facing arrow in the top row of the keyboard).
Alternatively, after logging in, open a crosh window with Ctrl-Alt-T and start a shell from there.
Become root and upgrade to developer firmware with
Code: Select all
# chromeos-firmwareupdate --mode=todev
2. Make space for KERN-C and ROOT-C
Open a root shell and show the partition table of the internal drive with
Code: Select all
# cgpt show /dev/sda
KERN-C must be given the standard size 32,768 for the ChromeOS kernel. ROOT-C will house our Debian rootfs; its size will be a matter of preference, provided that STATE keeps at least a couple of GBs. My choice for the size of ROOT-C was 60 GiB or 125,829,120 sectors, which together with 32,768 sectors for KERN-C leaves 99,872,768 sectors for STATE.
The required space is taken from the end of STATE, after first repeatedly unmounting it (since it is multiply mounted),
Code: Select all
# umount -l /dev/sda1
Code: Select all
# cgpt add -i 1 -b 8671232 -s 99872768 -t data -l STATE /dev/sda
# cgpt add -i 6 -b 108544000 -s 32768 -t kernel -l KERN-C /dev/sda
# cgpt add -i 7 -b 108576768 -s 125829120 -t rootfs -l ROOT-C /dev/sda
3. Prepare Debian rootfs on GNU/Linux computer
The Debian rootfs is most conveniently installed with debootstrap on a running Debian GNU/Linux computer or virtual machine. Installation is first to a raw (binary) disk image, from which the completed rootfs partition is extracted and transferred to the Chromebook.
We make that disk image not too large, like 6 GiB or 12,582,912 sectors, so as to keep the time needed for the rootfs transfer reasonable. The rootfs can be expanded later to take up all space available on ROOT-C.
3.1 Prepare the rootfs partition
Create the disk image in a working directory on the GNU/Linux computer with
Code: Select all
# dd if=/dev/zero bs=512 seek=12582911 count=1 of=debian.bin
Code: Select all
# losetup /dev/loop0 debian.bin
Code: Select all
# gparted /dev/loop0
3.2 Debootstrap
Mount the intended rootfs partition somewhere convenient,
Code: Select all
# mount -o dev,exec /dev/loop0p1 /mnt
Code: Select all
# debootstrap --verbose --arch=i386 --foreign wheezy /mnt <your-preferred-mirror>
The bootstrap is completed when chrooted to the new rootfs, for which the packages qemu-user-static and binfmt-support must be installed on the host OS:
Code: Select all
# cp /usr/bin/qemu-i386-static /mnt/usr/bin/
# mkdir /mnt/dev/pts
# modprobe binfmt_misc
# mount -t proc /proc /mnt/proc
# mount -t devpts /dev/pts /mnt/dev/pts
# chroot /mnt
Code: Select all
# /debootstrap/debootstrap --second-stage
It is convenient, while still in the chroot, to configure the base system. First, edit /etc/apt/sources.list as per usual, then
Code: Select all
# aptitude update
Code: Select all
# export LANG=C
# aptitude install dialog locales
# dpkg-reconfigure locales
Code: Select all
# export LANG=en_US.UTF-8
Edit /etc/network/interfaces as follows
Code: Select all
auto lo wlan0
iface lo inet loopback
iface wlan0 inet dhcp
wpa-ssid <SSID>
wpa-psk <passphrase>
Code: Select all
auto eth0
iface eth0 inet dhcp
Finally, we fix passwords, user and hostname with
Code: Select all
# passwd
# adduser <user>
# vi /etc/hostname
Code: Select all
127.0.1.1 <your-hostname>
Code: Select all
# losetup -d /dev/loop0
4. Install rootfs and kernel on Chromebook
Open a root shell when back in ChromeOS on the Chromebook.
4.1 Extract Debian rootfs
Mount the USB memory stick or SDHC card on the new mount point /tmp/debian, then
Code: Select all
# cd /tmp/debian
# cgpt show debian.bin
Code: Select all
# dd if=/tmp/debian.bin bs=512 skip=2048 count=12578816 of=/dev/sda7
Code: Select all
# e2fsck -f /dev/sda7
# resize2fs -p /dev/sda7
4.2 Package a kernel
Some minimal kernel command line is needed for the ChromeOS kernel to work with the Debian rootfs, like
Code: Select all
console=tty1 debug verbose root=/dev/sda7 rootwait rw lsm.module_locking=0
Find the current kernel version with
Code: Select all
# uname -r
Code: Select all
# cgpt show /dev/sda
Code: Select all
# dd if=/dev/sda4 of=/tmp/oldblob
Code: Select all
vbutil_kernel --repack /tmp/newkern \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--version 1 \
--signprivate \
/usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config=/tmp/config \
--oldblob /tmp/oldblob
Code: Select all
# sh /tmp/repack
4.3 Install kernel, modules and firmware
The resulting new kernel is written to the KERN-C partition with
Code: Select all
# dd if=/tmp/newkern of=/dev/sda6
Code: Select all
# mount /dev/sda7 /tmp/sda7
# cp -ar /lib/modules /tmp/sda7/lib/
# cp -ar /lib/firmware/* /tmp/sda7/lib/firmware/
Code: Select all
# cgpt add -i 6 -S 1 -T 5 -P 5 /dev/sda
5. Running with the Debian rootfs
We must first make sure that we can also reboot ChromeOS. Download and install the cgpt package from the Debian unstable (Sid) repository, as this is not available in the Debian stable (Wheezy) release,
Code: Select all
# dpkg -i cgptxxxxxxx_i386.deb
Rebooting ChromeOS requires changing the boot priority of KERN-C back to zero. It is convenient to do this with the script chromeboot placed in /usr/local/bin,
Code: Select all
#!/bin/sh
## (Re)boot Chromebook with ChromeOS.
## Usage: chromeboot [now]
## to be run with root privileges.
cgpt add -i 6 -S 1 -P 0 /dev/sda
case "$1" in
now* ) echo "Will reboot ChromeOS now..."
sleep 3
reboot ;;
* ) echo "Will boot ChromeOS on next (re)boot..." ;;
esac
exit 0
6. Back to ChromeOS in user mode
The Chromebook can be restored to the original ChromeOS in user mode by first reverting the firmware in a ChromeOS root shell with
Code: Select all
# chromeos-firmwareupdate --mode=tonormal
Note that this does not undo our earlier partitioning of the internal drive. If you also want to undo that partitioning (and lose everything on it), then you should have a "recovery image" handy before zeroing the GPT table entries with
Code: Select all
# cgpt -Z create /dev/sda
In conclusion
Most everything seems to work out-of-the-box when running the Debian rootfs on this Chromebook, including sound. I'm running XFCE as a desktop environment, and I'll be posting separately about screen brightness and audio volume keys.
Enjoy!
Credits: Much info gleaned from various forums and blogs, especially the blogs of Google's Olof Johansson.