Installing packages from Debian Bookworm in Trixie
I run Debian on my computers, and, because I like the improvements that come in newer packages, I run Trixie (aka testing), instead of Bookworm (the last stable release). As they say:
The main advantage of using this distribution is that it has more recent versions of software.
Despite the testing designation, I’ve yet to experience any significant problems, but I do occasionally suffer the inconvenience of packages disappearing from the repository entirely. A recent example of this is the GNU Image Manipulation Program, better (and infelicitously) known as GIMP.
As far as I understand it, due to a bug preventing compilation, it has been removed from testing because it won’t build, and, while the bug has been fixed in the release candidate for the next version, this won’t be accepted into testing until it’s an actual release.
But that doesn’t help me now. I could install the Flatpak version, but Flatpak applications never work quite as well: they always look slightly off, or the file picker behaves weirdly, or drag and drop is broken. On top of this, each Flatpak app requires its own version of libraries, which take time to download, use up disk space, and consume more RAM.
If you install Bookworm, install GIMP, then update to Trixie, you still have GIMP even though it isn’t available in the repository. So the version from Bookworm runs on Trixie perfectly well. Can we reproduce this without having to go back and reinstall everything? Yes, we can.
The trick is to add Bookworm as an apt source, but pin it to a lower priority so that it’s only used when a better source isn’t available. The default repository priority is 500, and the local repository is 100, so we want somewhere lower than those values so that we get a package from Bookworm if and only if the package isn’t in Trixie.
This is achieved by adding two files:
$ sudo tee /etc/apt/sources.list.d/bookworm.list >/dev/null <<END
deb http://deb.debian.org/debian/ bookworm main contrib non-free
END
$ sudo tee /etc/apt/preferences.d/bookworm >/dev/null <<END
Package: *
Pin: release n=bookworm
Pin-Priority: 90
END
You can now install gimp
:
$ sudo apt update && sudo apt install gimp
This won’t work if there are intractable conflicts between the package you want
and the packages installed on the system, but I’ve successfully used it to
install the gimp
and fbterm
packages.