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

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

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.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.