What is more reliable - apt-mark or APT-pin (/etc/apt/preferences.d/pin) for version locking?

Yes, pinning is more reliable, than apt-mark.

What I have discovered:

  • last 12-14 years Synaptic uses its own pinning file (/var/lib/synaptic/preferences) - see bug 42178 on launchpad. For system-wide one may want to set symlink between /etc and Synaptic

    sudo ln -s /etc/apt/preferences.d/synaptic /var/lib/synaptic/preferences
    

    so it is workaround, locking versions in Synaptic is not recommended method (this file does not read by apt-get and aptitude).

  • Muon uses system-wide pin files per-application in /etc/apt/preferences.d.

  • aptitude has two bugs:

    1. on 14.04 LTS it does not respect apt-mark completely (see my bug 1747189 at launchpad).
    2. on 16.04 LTS holds, which were set by apt-mark are lost after clicking on Actions -> Cancel pending actions (see my bug 1747191 at launchpad).

    but in 18.04 LTS aptitude do not have such bugs, it is great.

So my conclusion is the following: apt-mark is usable only if you install/remove/upgrade software only with apt-get, otherwise you should use pinning (i.e. /etc/apt/preferences.d/), it is more reliable and straightforward.


Note: to prevent package installation pin priority should be negative:

P < 0 :
prevents the version from being installed

for example Pin-Priority: -10.