How to prevent a package from being updated in Debian/Ubuntu Linux Systems


If you want to update all the packages other than one in your Debian server follow this procedure

There are three ways of holding back packages, with dpkg, aptitude or with dselect.

Option1: Using dpkg

Put a package on hold

echo "package hold" | dpkg --set-selections


echo "apache2 hold" | dpkg --set-selections

Remove the hold

echo "package install" | dpkg --set-selections


echo "apache2 install" | dpkg --set-selections

Knowing the status of your packages

dpkg --set-selections

Option 2: Using aptitude

With aptitude, you can hold a package using

# aptitude hold package_name


# aptitude hold apache2

and remove the hold with

# aptitude unhold package_name


# aptitude unhold apache2

Option 3: 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.

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *