Usually on my Ubuntu 16.04 LTS, I lock package versions with APT-pin functionality.
For example if I want to pin meld
to version 1.5.3-1ubuntu1 I create the following pin-file:
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-meld
Package: meld
Pin: version 1.5.3-1ubuntu1
Pin-Priority: 1337
EOF
This file applies settings system-wide: apt
, apt-get
, aptitude
and GUI tools such as synaptic
and muon
respects it.
I know other mechanism - apt-mark
. Let's assume.
My starting point - I have manually installed meld_1.5.3-1ubuntu1, its pin is removed.
$ apt-mark showhold
$ apt-cache policy meld
meld:
Installed: 1.5.3-1ubuntu1
Candidate: 3.14.2-1
Version table:
3.14.2-1 500
500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages
*** 1.5.3-1ubuntu1 100
100 /var/lib/dpkg/status
Then I hold installed version.
$ sudo apt-mark hold meld
meld set on hold.
$ dpkg -l | grep meld
hi meld 1.5.3-1ubuntu1 all graphical tool to diff and merge files
APT-mark shows it is on hold. But apt-cache policy meld
have no changes
$ apt-cache policy meld
meld:
Installed: 1.5.3-1ubuntu1
Candidate: 3.14.2-1
Version table:
3.14.2-1 500
500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages
*** 1.5.3-1ubuntu1 100
100 /var/lib/dpkg/status
apt-get upgrade
reports that meld
is kept back:
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
meld
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
But if I launch aptitude
in interactive mode I have meld
in Upgradable Packages:
Actions Undo Package Resolver Search Options Views Help
C-T: Menu ?: Help q: Quit u: Update g: Preview/Download/Install/Remove Pkgs
aptitude 0.7.4
--\ Upgradable Packages (1)
--\ gnome - The GNOME Desktop Environment (1)
--\ universe - Unsupported Free Software. (1)
ih meld 1.5.3-1ubuntu1 3.14.2-1
and if I accidentally select Actions -> Cancel pending actions the hold will be removed.
As far I can understand synaptic
ignores apt-mark
markings, its Lock Version functionality works differently.
meld
is listed here as Installed (upgradeable). Mark all upgrades button does not auto-select it, but package may be accidentally upgraded by Mark for Upgrade.
Muon works in same manner with packages, held by apt-mark
. But what is interesting its option Lock at Current Version writes pin-file to /etc/apt/preferences.d/meld
.
Am I understand correctly that APT-pin is more reliable than apt-mark
?