apt-get hold back packages on Ubuntu / Debian Linux

In Ubuntu and Debian Linux, you can use the apt-mark command to hold back packages from being upgraded. Here are the steps you can follow:

  1. Start by updating the package list by running the following command:
sudo apt-get update
  1. Next, you can hold back a package by running the following command:
sudo apt-mark hold package_name

Replace package_name with the name of the package you want to hold back.

  1. To check which packages are on hold, you can run the following command:
apt-mark showhold
  1. If you want to unhold a package and allow it to be upgraded again you can run the following command:
sudo apt-mark unhold package_name
  1. Finally, you can upgrade your system as usual with the command:
sudo apt-get upgrade

It’s important to keep in mind that holding back a package can cause issues with dependency management and that can lead to unexpected behavior on your system. It’s a good idea to test updates on a non-production environment before applying to production. Also holding back the package will only affect upgrades, the package can still be removed if it is no longer needed or used.

Leave a Comment