apt-get hold back packages on Ubuntu / Debian Linux

On Ubuntu and Debian Linux, you can use the “apt-mark” command to hold back packages, which means that the package will not be upgraded when you run the “apt-get upgrade” command. Here’s an example of how you can hold back a package:

  1. First, use the command “apt-mark showhold” to view the list of packages that are currently held back.
  2. To hold a package, use the command “sudo apt-mark hold package_name” replacing “package_name” with the name of the package you want to hold.
  3. For example, if you want to hold back the package “nginx”, you would use the command “sudo apt-mark hold nginx”.
  4. You can check if the package is on hold by running the command “apt-mark showhold” again
  5. To unhold the package, use the command “sudo apt-mark unhold package_name”
  6. It’s important to note that the “apt-mark hold” command only works for packages that were installed using the apt package manager and only works for packages that are already installed.
  7. Additionally, you can use the option “apt-get –no-upgrade package_name” this will prevent the package from being updated on the next “apt-get upgrade” command.
  8. Also, you can use the option “apt-get install package_name=version” to install a specific version of a package, this will prevent the package from being updated to a new version.

It’s important to note that, Holding back a package can cause security vulnerabilities and software bugs, so it’s recommended to hold back a package only if it’s really necessary and you know the consequences.

Leave a Comment