← Back home

FreeBSD 13 on a Lenovo x220

Some notes from my recent install of FreeBSD 13 on a Lenovo x220.

Published , 596 words

TL;DR: I followed the graphical installer, opted for the default ZFS/RAID0 and let the installer partition the system drive however it wanted to, and applied these tweaks.

My x220 itself has an i7 CPU, a 512GB SSD, and 16GB RAM. I upgraded the LCD screen to a higher-quality IPS display panel and disconnected the touchpad. I also removed the lid closure sensor, the webcam, and the internal microphone. This negated my need to install drivers or set bootloader options for these devices.


The last step of the installer asked if I’d like to chroot into the new system and apply any post-installation configs. I said yes and proceeded thusly.

I added my login user to the video and wheel groups:

pw groupmod video -m james && pw groupmod wheel -m james

dbus is required for just about anything graphical, so I added this line to /etc/rc.conf:

echo 'dbus_enable="YES"' >> /etc/rc.conf

I also enabled the stock i915kms driver:

echo 'kld_list="i915kms"' >> /etc/rc.conf

Then, I installed the following:

pkg install vim git stow xorg slim openbox firefox \
            xf86-input-keyboard xf86-input-mouse

I then set slim to handle graphical login:

echo 'slim_enable="YES"' >> /etc/rc.conf

and start Openbox on login:

echo 'exec openbox-session' >> /home/james/.xinitrc


I set permissions for the wheel group to allow the doas command:

echo 'permit persist :wheel' >> /usr/local/etc/doas.conf


I didn’t go overboard with the kernel tunables, wifi power saving, and so on, keeping the configuration pretty elementary. I get about 5 hours of normal use with the 9-cell battery (which is ~10 years old, at about 95% capacity).

Here’s what I added to /etc/rc.conf:

powerd_flags="-a hiadaptive -b adaptive"

Other optimizations

These are commented to be self-explanatory. Here’s my /etc/rc.conf:

# Don't hang the boot process while waiting for DHCP

# Clear /tmp on boot

# Enable Linux compatibility

And /boot/loader.conf:


# More appropriate values for desktop use

# Enable the nub and disable the touchpad

# Enable a faster implementation of soreceive

# Increase the network interface queue link

# Enable hardware accelerated AES

# Load the H-TCP algorithm

# Enable CPU firmware updates

# Enable CPU temperature monitoring

# Enable LCD backlight control, ThinkPad buttons, etc

I don’t usually stream music or watch videos on this computer, so I let Mozilla’s cubeb library handle everything.


By this point, I could log in to an X session with decent performance, battery life, an editor, a browser, and a way to configure my system.

I use GNU Stow to manage my dotfiles, so the rest was easy:

git clone https://github.com/jamesacklin/dots
cd dots
stow openbox

This installed my window manager theme, made the correct changes to the right-click desktop menu, set my desktop background to light gray, and so on. I repeated the same stow command for the other programs and services I wanted to configure.

Overall impressions

My entire experience was no more complicated than a typical Arch Linux installation. I wasn’t anticipating a “just works” experience like Fedora or Ubuntu, but I was pleasantly surprised to find that my x220 now runs quietly and efficiently while I putter around.

I had previously committed this entire process on the same machine with OpenBSD, but I found that the CPU fan ran audibly. Some quick research online told me that the OpenBSD developers removed something questionable in the fan driver – which is good and in line with their security goals but not great for me.

Thanks to c0ffee.net for almost all of these pointers.