How to install a single package from debian testing

Published:

I recently bought a Lenovo Thinkpad X13 Yoga to have as a sort of combination of a personal laptop and a tablet.

Not being particularly fond of Microsoft, I installed the current Debian stable, Trixie, on it.

Most things seemed to work just fine, I even have decent battery life. There is one notable exception, however, and that is auto-rotating the display when I fold it over to use it as a tablet. That just flat out didn't work.

After a bit of digging around, I found out that that was a known bug in the package iio-sensor-proxy that had already been solved upstream. Unfortunately, Debian Trixie didn't have a new enough version of the package.

Debian Testing (Forky), however, did.

I don't really feel for running Debian testing on this laptop, but maybe I can just get one single package from there? And sure enough, after a bit of more digging around, I found out how to do this.

How to install a single package from Debian testing?

It comes down to a combination of two things:

  1. Add the sources for debian testing packages
  2. Pin the package you want from testing at a higher than normal priority, and all the other ones lower than normal.

Now, the standard priority weight for debian packages seems to be 500, so let's pin iio-sensor-proxy just above that.

And let's pin everything else from Forky at a negative number, to ensure we don't accidentally get those.

Add forky package lists

These look just like how you would expect, and go in /etc/apt/sources.list.d/forky.list.

# /etc/apt/sources.list.d/forky.list
deb http://ftp.se.debian.org/debian/ forky main non-free-firmware
deb-src http://ftp.se.debian.org/debian/ forky main non-free-firmware

deb http://security.debian.org/debian-security forky-security main non-free-firmware
deb-src http://security.debian.org/debian-security forky-security main non-free-firmware

# forky-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://ftp.se.debian.org/debian/ forky-updates main non-free-firmware
deb-src http://ftp.se.debian.org/debian/ forky-updates main non-free-firmware

Pin specific packages from a debian release name

This goes in /etc/apt/preferences/forky.pref, and specifies that we have the Pin-Priority: -10 for all packages from the forky package lists except for iio-sensor-proxy, which we set at 501. That is, just above the normal priority for packages.

# /etc/apt/preferences/forky.pref
Package: *
Pin: release n=forky
Pin-Priority: -10

Package: iio-sensor-proxy
Pin: release n=forky
Pin-Priority: 501

This will cause apt update and then apt list --upgradable to tell us that we can upgrade iio-sensor-proxy to a newer version.

Conclusion

After running apt upgrade to install the new version of iio-sensor-proxy (3.8 instead of 3.7) from Debian testing, and then a reboot, I got display auto-rotate working.