Setting up a ThinkPad x250 with Linux

Two chapters in this article are Debian-specific, the rest is more or less Archlinux-specific. It never grew into the device-specific alround tutorial I envisioned and has been partially superseded by this article. The ThinkPad itself is in daily use. No regrets there!

BIOS Update

The latest BIOS update for this machine is from September this year. Impressive for a 5-year-old laptop. I checked the BIOS, it is at a lower verion than the current 1.38. I downloaded the .iso (first item on this list) and followed the instructions here.

Going through the BIOS - there's loads of interesting options!

TLP

TLP - I don't know what the acronym originally stood for; it's "a feature-rich command line utility for Linux, saving laptop battery power without the need to delve deeper into technical details."

Just start & enable the systemd service after installation.

The Arch wiki has a comprehensive article that requires some comment (esp. for this model):

The Radio Device Wizard is a separate package (tlp-rdw) but is configured through TLP's own configuration file, /etc/tlp.conf (scroll down). For me, the term "wizard" has a specific meaning when applied to software, but there's no "wizard" here, just a few config file settings. Keep in mind it depends on network-manager's dispatcher.

According to thinkwiki, tp_smapi will not work "on a recent Thinkpad that has an Ivy Bridge or newer processor (X230, T430, T530, etc.)". Surely an x250 falls into that category. Presumably this means that TLP's charging threshold settings will not work. It instead recommends tpacpi-bat which is available in Archlinux' [community] repository. It's a separate systemd service that sets charging thresholds, nothing else. According to TLP documentation and the output of tlp-stat -b, tpacpi-bat is part of TLP and should get activated automatically. No separate installation is required.

Question: Do the charging thresholds still apply when the laptop goes into hibernation (not standby), or is powerd off?
Answer: Yes.

Tip

Recalibration (tlp-stat recalibrate BATn) is quicker when you simultaneously stress the CPU:

sh
while true; do stress --cpu 32 --timeout 60; done

Installing Debian Stretch (Bunsenlabs)

The Debian installer required firmware iwlwifi, possible to load from external device like USB stick. This is most likely to succeed with a FAT32-formatted device. I simply copied the relevant firmware (from my ArchLinux installation, I do not think this is distro-specific) to the USB stick:

cp /lib/firmware/iwlwifi* /media/Some-USB-Stick/; sync

Then put the stick in the Lenovo's 2nd USB slot, and told the installer to continue.

Full encryption worked. Power management appears to work reasonably well (still testing).

Keep in mind that Bunsenlabs is still based on Debian Stretch (oldstable), but that doesn't matter much on a classical openbox desktop, and on a device that fits right into the time frame (it came out 2015, stretch became testing the same year, and stable in 2017).

Fingerprint Reader (Debian)

Following these instructions, and some help from arch wiki. It seems very buggy. Have to do more testing/researching.
...
In the end I installed libfprint0 from stretch-backports, rebooted a few times, and executed sudo pam-auth-update - now it works reasonably well. It seems very finicky (success rate less than 50%), but after registering my right index finger for all fingers the success rate seems better. I can now log in (lightdm) and sudo with it.

Some info about Intel RST

In the end, I'm sorry to say that RST did not work sufficiently well (amongst other things, headphone sound did not work after resume) and I am not using it anymore. I disabled it in BIOS and activated hibernation on the installed Linux system.
I also configured the initramfs to resume as soon as possible: HOOKS=(base udev resume ...
and told it to not compress the initramfs at all: COMPRESSION="cat"
The latter makes the image larger but decreases boot time significantly. With all these changes, resuming from hibernation is just a few seconds slower than with Intel RST.

...that's Rapid Start Technology.
https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_T450s#Intel_Rapid_Start_Technology_(IRST)
https://www.intel.com/content/dam/support/us/en/documents/motherboards/desktop/sb/rapid_start_technology_user_guide_v14.pdf
https://mjg59.dreamwidth.org/26022.html

I had to create the partition and set its type with fdisk, gparted doesn't seem to have an option for 0x84:
https://www.tecmint.com/fdisk-commands-to-manage-linux-disk-partitions/
https://www.tldp.org/HOWTO/Partition-Mass-Storage-Definitions-Naming-HOWTO/x190.html

At first it didn't work, now (currently on ArchLabs, an ArchLinux installer) it does, 100%. Very unsatisfying, not knowing why.
In BIOS, I set it to become active immediately when the machine is suspended. I set xfce4-power-manager to suspend (almost everywhere), not hibernate. So whenever the machine suspends, this turns into Intel RST hibernation; takes about a minute altogether.

No more

Nobody seems to be using RST - at least nobody on the ThinkPad Linux mailing list. Opting for an encrypted swap partition instead, I dropped Intel RST completely. It only ever saved a few seconds at best.

xfce4-power-manager does not Suspend on Lid Close

I found out that xfce4-power-manager defaults to letting systemd-logind handle the lid switch, however systemd-logind is set to ignore it.
There's a solution here (or here); the same can be achieved graphically with the Xfconf Settings Editor (remove the checkmark for logind-handle-lid-switch).

Bluetooth does not Wake up

... after resuming from suspend.

I started noticing this some time ago. According to this, I edited /etc/bluetooth/main.conf and added AutoEnable=true under the [Policy] section toward the end of the file. Then systemctl restart bluetooth.service, and the device comes back on when resuming from suspend.