Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Alternative to `apt-mark hold`

This is a rewritten version of an old post: apt/preferences.d: A Useful Example with a focus on what syntax it replaced.

I used to use apt-mark hold to control packages that I wanted to pin. For example, zenity now uses gtk4 so I

But before I got that epoch part added, I marked the package.

apt-mark hold zenity

But I never found where this information was stored, and I prefer to have files that configure my apps rather than online commands only. I bet it was in /var/lib somewhere I never found.

You could at least show holds, and unhold items.

apt-mark showhold
apt-mark unhold zenity

Anyway, so to make the process so I can deploy a file to control this, I made a file: /etc/apt/preferences.d/zenity

Package: zenity
Version: 3.44.2-1
Pin: release
Pin-Priority: 600
Package: zenity-common
Version: 3.44.2-1
Pin: release
Pin-Priority: 600

The pin priority is higher than the default 500 for installed and installable packages. Of course if you've started tweaking these numbers for specific repositories but you still want this preference to have priority, you can adjust the numbers.

Later on, I built a copy of the last gtk3-based one for myself, with a package epoch (the number prepending a colon and then the regular version number) so it always has top priority version-wise. So I didn't need any of this anymore. But for anyone who doesn't want to rebuild a whole package, use this method I just described.

Comments