Upgrading a package marked as hold, marks it as install in dpkg –get-selections
If I mark a package as hold
with echo "xyz hold" | sudo dpkg --set-selections
and afterwards explicitly use apt upgrade xyz=1.2.3
the package is marked as install
in dpkg --get-selections
.
Is there any way to "permanently" mark a package as hold
? – I want to update it, but always manually and never as part of another update.
I tried to look online, but there’s 100 posts that teaches you how to hold a package, I know that. I also tried man apt
which sends you to man apt-get 8
but upgrade
doesn’t really specify anything about hold
-packages (or suddenly unholding them..) – so I’m also happy if you can provide resources about the behaviour.
It kind of tripped me a little when I upgraded 3 packages in a row, to a specific "not-latest" version, and .. the last one got the specified version, but the others were suddenly "latest."
I can see in the output that apt upgrade
did show me that it was also going to upgrade the other packages.. I just don’t want to write a new script like..
upgrade(){
apt-get upgrade $1=$2
echo "$1 hold" | dpkg --set-selection
}
….. or is that the solution I’m looking for?
This question was originally posted on "askubuntu," but since it didn’t get any traffic they suggested that I deleted the question and posted it here.
A user did suggest using apt-mark
. But it does not solve my problem it just simplifies holding packages.
I don’t think there’s a way to do this with package holds; but there is a different way of preventing upgrades: you can pin a package with priority -1. Create a file in /etc/apt/preferences.d
containing
Package: xyz
Pin: version *
Pin-Priority: -1
xyz
will then never be a candidate for upgrades, unless a specific version is requested.