How to prevent a package from being updated in Ubuntu
Sponsored Link
There are three ways of holding back packages, with dpkg, aptitude or with dselect.
Using dpkg
Put a package on hold
sudo echo “package hold” | dpkg --set-selections
Example
sudo echo “apache2 hold” | dpkg --set-selections
Remove the hold
sudo echo “package install” | dpkg --set-selections
Example
sudo echo “apache2 install” | dpkg --set-selections
Knowing the status of your packages
sudo dpkg --set-selections
Using aptitude
With aptitude, you can hold a package using
sudo aptitude hold package_name
Example
sudo aptitude hold apache2
and remove the hold with
sudo aptitude unhold package_name
Example
sudo aptitude unhold apache2
Using dselect
With dselect, you just have to enter the [S]elect screen, find the package you wish to hold in its present state, and press the `=’ key (or `H’). The changes will go live immediately after you exit the [S]elect screen.
You probably meant:
echo “apache2 hold” |sudo dpkg --set-selections
You probably meant:
Knowing the status of your packages
sudo dpkg –get-selections
I think you’ll also find that you don’t need to use the ” ” around the name of the package. I tried that and got this: dpkg: error: illegal package name at line 1: package name in specifier ‘“firefox’ is illegal: must start with an alphanumeric character
I tried it without the quote marks, and it worked. The package i wanted to stop was firefox, and I used this command:
echo firefox hold: sudo dpkg –set-selections