blog/content/posts/fedora-on-acer-c720p.md

302 lines
12 KiB
Markdown

---
date: 2014-09-26T00:00:00-05:00
title: "Fedora on an Acer C720P Chromebook"
tags: [howto, free-software, fedora, fedora-planet, en_us, english, open-source, report]
---
Yes, you are reading correctly: I decided to buy a freacking Chromebook.
I really needed a lightweight notebook with me for my daily hackings
while waiting for my subway station, and this one seemed to be the best
option available when comparing models and prices. To be fair, and
before you throw me rocks, I visited the [LibreBoot X60's
website](http://shop.gluglug.org.uk/product/ibm-lenovo-thinkpad-x60-coreboot/)
for some time, because I was strongly considering buying one (even
considering its weight); however, they did not have it in stock, and I
did not want to wait anymore, so...
Anyway, as one might expect, configuring GNU/Linux on notebooks is
becoming harder as time goes by, either because the infamous [Secure
Boot](http://en.wikipedia.org/wiki/Secure_boot) (anti-)feature, or
because they come with more and more devices that demand proprietary
crap to be loaded. But fortunately, it is still possible to overcome
most of those problems and still get a GNU/Linux distro running.
References
----------
For main reference, I used the following websites:
- [ACER Chromebook C720P: touchpad and touchscreen do not
work](https://bugzilla.redhat.com/show_bug.cgi?id=1045821), a bug
related to the Fedora support for the machine.
- [Fedora 20 (LXDE LiveCD) on my Acer c720p
Chromebook](http://pnmyers.blogspot.ca/2014/04/fedora-20-lxde-livecd-on-my-acer-c720p.html),
by Perry Myers.
- [Acer C720
Chromebook](https://wiki.archlinux.org/index.php/Acer_C720_Chromebook),
a wiki page from Arch[GNU/]Linux.
- [Chromebook](https://wiki.archlinux.org/index.php/Chromebook), a
wiki page from Arch[GNU/]Linux.
I also used other references for small problems that I had during the
configuration, and I will list them when needed.
Backing up ChromeOS
-------------------
The first thing you will probably want to do is to make a recovery image
of the ChromeOS that comes pre-installed in the machine, in case things
go wrong. Unfortunately, to do that you need to have a Google account,
otherwise the system will fail to record the image. So, if you want to
let Google know that you bought a Chromebook, login into the system,
open Chrome, and go to the special URL `chrome://imageburner`. You will
need a 4 GiB pendrive/sdcard. It should be pretty straightforward to do
the recording from there.
Screw the screw
---------------
Now comes the hard part. This notebook comes with a [write-protect
screw](http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/acer-c720-chromebook).
You might be thinking: what is the purpose of this screw?
Well, the thing is: Chromebooks come with their own boot scheme, which
unfortunately doesn't work to boot Linux. However, newer models also
offer a “legacy boot” option
([SeaBIOS](http://www.coreboot.org/SeaBIOS)), and **this** can boot
Linux. So far, so good, but...
When you switch to SeaBIOS (details below), the system will complain
that it cannot find ChromeOS, and will ask if you want to reinstall the
system. This will happen **every time** you boot the machine, because
the system is still entering the default BIOS. In order to activate
SeaBIOS, you have to press CTRL-L (Control + L) **every time you boot**!
And this is where the screw comes into play.
If you remove the write-protect screw, you will be able to make the
system use SeaBIOS by default, and therefore will not need to worry
about pressing CTRL-L every time. Sounds good? Maybe not so much...
The first thing to consider is that you will lose your warranty the
moment you open the notebook case. As I was not very concerned about it,
I decided to try to remove the screw, and guess what happened? I
stripped the screw! I am still not sure why that happened, because I was
using the correct screw driver for the job, but when I tried to remove
the screw, it seemed like butter and started to “decompose”!
Anyway, after spending many hours trying to figure out a way to remove
the screw, I gave up. My intention is to always suspend the system, so I
rarely need to press CTRL-L anyway...
Well, that's all I have to say about this screwed screw. If you decide
to try removing it, keep in mind that I cannot help you in any way, and
that you are entirely responsible for what happens.
Now, let's install the system :-).
Enable Developer Mode
---------------------
You need to enable the Developer Mode in order to be able to enable
SeaBIOS. To do that, follow [these
steps](https://wiki.archlinux.org/index.php/Chromebook#Enabling_Developer_Mode)
from the Arch[GNU/]Linux wiki page.
I don't remember if this step works if you don't have activated the
ChromeOS (i.e., if you don't have a Google account associated with the
device). For my use, I just created a fake account to be able to
proceed.
Accessing the superuser shell inside ChromeOS
---------------------------------------------
Now, you will need to access the superuser (`root`) shell inside
ChromeOS, to enable SeaBIOS. Follow [the steps described in the
Arch\[GNU/\]Linux wiki page](https://wiki.archlinux.org/index.php/Chromebook#Accessing_the_superuser_shell).
For this specific step, you don't need to login, which is good.
Enabling SeaBIOS
----------------
We're almost there! The last step before you boot your Fedora LiveUSB is
to actually enable SeaBIOS. Just go inside your superuser shell (from
the previous step) and type:
```console
> crossystem dev_boot_usb=1 dev_boot_legacy=1
```
And that's it!
If you managed to successfuly remove the write-protect screw, you may
also want to enable booting SeaBIOS by default. To do that, [there is a
guide](https://wiki.archlinux.org/index.php/Chromebook#Boot_to_SeaBIOS_by_default),
again on Arch[GNU/]Linux wiki. **DO NOT DO THAT IF YOU DID NOT REMOVE
THE WRITE-PROTECT SCREW!!!!**
Booting Fedora
--------------
Now, we should finally be able to boot Fedora! Remember, you will have
to press CTRL-L after you reboot (if you have not removed the
write-protect screw), otherwise the system will just complain and not
boot into SeaBIOS. So, press CTRL-L, choose the boot order (you will
probably want to boot from USB first, if your Fedora is on a USB stick),
choose to boot the live Fedora image, and... bum!! You will probably see
a message complaining that there was not enough memory to boot (the
message is “Not enough memory to load specified image”).
You can solve that by passing the `mem` parameter to Linux. So, when
GRUB complains that it was unable to load the specified image, it will
give you a command prompt (`boot:`), and you just need to type:
```console
boot: linux mem=1980M
```
And that's it, things should work.
Installing the system
---------------------
I won't guide you through the installation process; I just want to
remember you that you have a 32 GiB SSD drive, so think carefully before
you decide how you want to set up the partitions. What I did was to
reserve 1 GB for my swap, and take all the rest to the root partition
(i.e., I did not create a separate `/home` partition).
You will also notice that the touchpad does not work (neither does the
touchscreen). So you will have to do the installation using a USB mouse
for now.
Getting the touchpad to work
----------------------------
I strongly recommend you to read [this Fedora
bug](https://bugzilla.redhat.com/show_bug.cgi?id=1045821), which is
mostly about the touchpad/touchscreen support, but also covers other
interesting topics as well.
Anyway, the bug is still being constantly updated, because the proposed
patches to make the touchpad/touchscreen work were not fully integrated
into Linux yet. So, depending on the version of Linux that you are
running, you will probably need to run a different version of the
scripts that are being kindly provided in the bug.
As of this writing, I am running Linux 3.16.2-201.fc20, and the script
that does the job for me is [this
one](https://bugzilla.redhat.com/attachment.cgi?id=937274). If you are
like me, you will never run a script without looking at what it does, so
go there and do it, I will wait :-).
OK, now that you are confident, run the script (as `root`, of course),
and confirm that it actually installs the necessary drivers to make the
devices work. In my case, I only got the touchpad working, even though
the touchscreen is also covered by this script. However, since I don't
want the touchscreen, I did not investigate this further.
After the installation, reboot your system and at least your touchpad
should be working :-). Or kind of...
What happened to me was that I was getting strange behaviors with the
touchpad. Sometimes (randomly), its sensitivity became weird, and it was
very hard to move the pointer or to click on things. Fortunately, I
found the solution in the same bug, in [this comment by Yannick
Defais](https://bugzilla.redhat.com/show_bug.cgi?id=1045821#c3). After
creating this X11 configuration file, everything worked fine.
Getting suspend to work
-----------------------
Now comes the hard part. My next challenge was to get suspend to work,
because (as I said above) I don't want to poweroff/poweron every time.
My first obvious attempt was to try to suspend using the current
configuration that came with Fedora. The notebook actually suspended,
but then it resumed 1 second later, and the system froze (i.e., I had to
force the shutdown by holding the power button for a few seconds). Hmm,
it smelled like this would take some effort, and my nose was right.
After a lot of search (and [asking in the
bug](https://bugzilla.redhat.com/show_bug.cgi?id=1045821#c63)), I found
out about a few Linux flags that I could provide in boot time. To save
you time, this is what I have now in my `/etc/default/grub` file:
```console
GRUB_CMDLINE_LINUX="tpm_tis.force=1 tpm_tis.interrupts=0 ..."
```
The final `...` means that you should keep whatever was there before you
included those parameters, of course. Also, after you edit this file,
you need to regenerate the GRUB configuration file on `/boot`. Run the
following command as `root`:
```console
> grub2-mkconfig -o /boot/grub2/grub.cfg
```
Then, after I rebooted the system, I found that only adding those flags
was still not enough. I saw a bunch of errors on `dmesg`, which showed
me that there was some problem with EHCI and xHCI. After a few more
research, I found the [this
comment](https://bbs.archlinux.org/viewtopic.php?pid=1364521#p1364521)
on an Arch[GNU/]Linux forum. Just follow the steps there (i.e., create
the necessary files, especially the
`/usr/lib/systemd/system-sleep/cros-sound-suspend.sh`), and things
should start to get better. But not yet...
Now, you will see that suspend/resume work OK, but when you suspend, the
system will still resume after 1 second or so. Basically, this happens
because the system is using the touchpad and the touchscreen to
determine whether it should resume from suspend or not. So basically
what you have to do is to disable those sources of events:
```console
echo TPAD > /proc/acpi/wakeup
echo TSCR > /proc/acpi/wakeup
```
And voilà! Now everything should work as expected :-). You might want to
issue those commands every time you boot the system, in order to get
suspend to work every time, of course. To do that, you can create a
`/etc/rc.d/rc.local`, which gets executed when the system starts:
```console
> cat /etc/rc.d/rc.local
#!/bin/bash
suspend_tricks()
{
echo TPAD > /proc/acpi/wakeup
echo TSCR > /proc/acpi/wakeup
}
suspend_tricks
exit 0
```
Don't forget to make this file executable:
```console
> chmod +x /etc/rc.d/rc.local
```
Conclusion
----------
Overall, I am happy with the machine. I still haven't tried installing
[Linux-libre](http://www.fsfla.org/ikiwiki/selibre/linux-libre/index.en.html)
on it, so I am not sure if it can work without binary blobs and
proprietary craps.
I found the keyboard comfortable, and the touchpad OK. The only extra
issue I had was using the Canadian/French/whatever keyboard that comes
with it, because it lacks some useful keys for me, like Page Up/Down,
Insert, and a few others. So far, I am working around this issue by
using `xbindkeys` and `xvkdb`.
I do not recommend this machine if you are not tech-savvy enough to
follow the steps listed in this post. If that is the case, then consider
buying a machine that can easily run GNU/Linux, because you feel much
more comfortable configuring it!