Rice, Rice, Baby
Jun 12, 2018 “All right stop! Emerge @world and listen, rice is back with my brand new invention.”#gentoo #floss #hardware #rice
I promised an update on my (Thinkpad X200) laptop upgrade, so here it is.
Hardware
I swapped out the old miniscule 120 GB (!!!) hard drive with a new and shiny 1 TB drive. Moreover, I went and upgraded the ram in the laptop from a single PC3-10600 4GB board to two 4 GB PC-8500 boards.
I also went ahead and replaced my delapidated keyboard (where the Super and /
keys were broken) with a new keyboard. In the process, I cleaned out a bit of dust and hair (as is expected for laptops).
Firmware
I installed Libreboot. Basically, Libreboot is a free-as-in-freedom replacement for the proprietary Lenovo BIOS. It’s fully libre and customizable, and I plan to hack on it later. I used this guide to install Libreboot.
Basically, I used the setup described on the Libreboot site. One thing I did differently is that I had to lower the SPI bus speed because my wires were so long (as you can see I used a T-Cobbler breakout board). Other than that, everything was the same. Here are some pics:
I didn’t take any images of the Libreboot BIOS screen, but it looks something like this.
Software
My choice of Linux distributions? I’m running Gentoo. I’ve never seriously used a distribution with this much fine-grained control before. I can now see why people swear by Gentoo. It’s pretty freaking cool.
I’ve been wanting to make use of BTRFS for a while now. Since I’m setting up a new drive that I don’t need to keep serious data on, I figured: what the hell, BTRFS is stable, so let’s try it! To say the least, I’ve been satisfied with what I’ve seen so far.
Configuration
For my hard drive, I have an unconventional partitioning scheme. This is mainly because I’m a brainlet and couldn’t figure out how to get BTRFS, Dracut, LUKS, and LVM to play nicely; so I just ditched LVM.
Basically, I have four partitions. The first is a blank 1 MB partition for the disk’s GPT header. Next, I have a 200 MB parititon for grub to boot from. Third, I have a 16 GB encrypted LUKS partition with a swapfile occupying the entire thing. I store the key to the swap partition on the root partition so I can have hibernate support (even though I never use it). The fourth partition is also a LUKS parition with BTRFS on top.
I’ve also got a subvolume in BTRFS for my home directory. I plan on using this subvolume thing to make backups of ~
and protect against bit rot. Bascially, btrfs-scrub will save me from nearly all file corruption.
Here’s a hint to anybody out there trying to get Dracut to work with LUKS, BTRFS, and GRUB: modify your /etc/default/grub
to have the following two lines:
GRUB_CMDLINE_LINUX="rd.luks=1 rd.luks.uuid=<ENCRYPTED-ROOT-LUKS-UUID-HERE> rootfstype=btrfs rd.auto rd.shell root=UUID=<DECRYPTED-ROOT-UUID-HERE> rd.info"
GRUB_ENABLE_CRYPTO=y
Obviously, you need to change the parts in <angle brackets>. After that, go ahead and build initramfs, install grub, and then run grub-mkconfig -o /boot/grub/grub.cfg
. Then just type the encryption key when you’re prompted to on the next boot and you’re in.
Also, since I couldn’t get my other partitions to automatically mount with /etc/fstab
, I made a simple script in /etc/local.d
to mount my /boot
and swap partitions. As mentioned earlier, I mount the swap partition with a keyfile that I store on the root BTRFS filesystem.
Rice
For my rice, I’m running urxvt with a modified version of the I’m not gentoo theme from AntSunrise. For my display manager, I’m using Wayland with swaywm. I had to toil in a Vietnamese rice paddy for two days and all I got was a crummy minimalistic desktop.
So far, sway seems to be pretty nice. I also made a little statusbar script that shows the laptop’s current power as well as the current time in seconds. I like it so far.
Major shouts to Luke Smith for being a cool dude and inspiring me to rice my chinkpad.
TL;DR: Install Gentoo loser