|

How to Prevent a Package From Being Updated in Ubuntu and Debian-based Linux Distributions

Brief: Quick tutorial to show you how to prevent certain packages from being updated in Ubuntu and Debian based Linux distributions.

When you update your Ubuntu system, all the applications, packages are updated at once.

This is of course very convenient as you don’t have to worry about updating the installed packages one by one.

But there may be situations where you want to retain the version of a particular installed application.

In this tutorial, I’ll show you both GUI and terminal methods to disable certain package updates in Ubuntu and other Ubuntu and Debian based systems.

Method 1: Prevent package update using apt-mark command

Ubuntu’s package manager, apt has plenty of useful utilities for almost every aspect of package management. One of the apt commands is apt-mark that you can use to blacklist or whitelist certain packages from the system updates.

To hold a package and thus prevent apt from making changes to it, you can use the apt-mark command with hold option.

The tab completion doesn’t work with the apt-mark command. You need to type the exact name of the package you are trying to update.

sudo apt-mark hold package_name

Make sure that you replace the package-name with the appropriate package you’re trying to target. Here’s an example:

Prevent Package Update in Ubuntu

To list all the packages that are held you can use:

apt-mark showhold
show all hold packages in Ubuntu using apt-mark

To remove hold on a package:

sudo apt-mark unhold package_name
Resume Update On Packages Ubuntu

Now that you are aware of the commands, let’s see how to prevent package update graphically.

Method 2: Prevent package update using Synaptic Package Manager

Prevent Package From Being Updated in Ubuntu

Once upon a time, Synaptic used to ship by default in Ubuntu and it was also the default GUI package manager in Ubuntu until 11.10. You have a better graphical GNOME Software Center now but you could still use Synaptic.

Use the following command to install Synaptic Package Manager in Ubuntu/Debian:

sudo apt install synaptic

Next, the follow the steps below:

  • Launch Synaptic Package Manager
  • Search for your desired package in the search bar
  • Select the desired package
  • In the Package menu, choose Lock Version
  • Save it
Prevent Package Update Screenshot

To undo this, just do the same and this time select Unlock Version.

Did it help you?

That’s all you need to do. See, how easy it was to lock a package from the updates?

I hope this quick tutorial was helpful to you. I welcome your questions and suggestions.

Similar Posts

  • How can i prevent a package which is build from source from being updated? i cant find my pytorch package in apt system or in synaptic. Thx

  • Thanks for that. I use virtualbox to run a version of windows XP which must never be changed or see the internet so I have locked virtualbox in case it reverts to allowing internet to my XP environment. I hope this keeps working.

  • What should I do if I need to install the specific version of package and dependencies? Best example is the linux kernel. I have 3.13.0.32 installed, 3.13.0.43 latest and I need to correctly update to 3.13.0.39 and lock it from upgrade.