Ubuntu – apt-get won’t handle package locking made in Synaptic

aptpackage-managementsynaptic

In Synaptic I locked skype to version 2.2.0.35 and the package manager is correctly ignoring newer version (it doesn't select skype upgrade).

On the contrary, apt-get upgrade will propose the upgrade.

I know I could lock the package with echo "skype hold" | sudo dpkg --set-selections, but I'd like to have Synaptic changes being reflected in apt-get

Best Answer

Synaptic has it's own configuration file, separate from dpgk's so this will be a manual process. However, here are some commands that should make things easier.

To put the pinned Synaptic packages on hold:

sed -n '/Package:/h;/Pin:/{g;s/\(Package: \)//;s/.*/& hold/p}' < /var/lib/synaptic/preferences |  sudo dpkg --set-selections

If you want to change the held packages back to install:

dpkg --get-selections |sed -n '/hold/H;s/hold/install/p'| sudo dpkg --set-selections