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:
- Start by updating the package list by running the following command:
sudo apt-get update
- 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.
- To check which packages are on hold, you can run the following command:
apt-mark showhold
- 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
- 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.