Did you know that you can block package updates under Ubuntu and Debian? Let’s say you have a lot of packages installed on your Ubuntu / Debian system and (for whatever reason) you want that specific packages aren’t getting updated whenever you do a system upgrade. This short article is going to show you how to prevent this packages from being updated.
Error: Your Requested widget " adcontrol_sidebar_widget-4" is not in the widget list.
- [do_widget_area footer-a]
- [do_widget_area footer-b]
- [do_widget_area footer-c]
- [do_widget id="meta-4"]
- [do_widget_area sidebar]
- [do_widget id="recent-posts-2"]
- [do_widget id="twitter-follow-5"]
- [do_widget id="blog_subscription-3"]
- [do_widget id="archives-2"]
- [do_widget id="adcontrol_sidebar_widget-3"]
- [do_widget_area widgets_for_shortcodes]
- [do_widget id="adcontrol_sidebar_widget-4"]
- [do_widget_area wp_inactive_widgets]
- [do_widget id="meta-2"]
- [do_widget id="search-2"]
- [do_widget id="categories-2"]
- [do_widget id="recent-comments-2"]
- [do_widget id="rss-3"]
- [do_widget id="twitter-follow-3"]
- [do_widget id="twitter-timeline-profile-3"]
- [do_widget id="twitter-timeline-list-3"]
APT or Aptitude: Both can block package updates
Debian / Ubuntu basically has two ways to manage packages. To be more specific there are two package managers which can be used on the console for updating, installing and removing packages / software under your Ubuntu / Debian systems. These two solutions are APT and Aptitude. This article describes how to prevent packages from being updated with both solutions. If you don’t know which of those two you should go with: Simply go with the APT tools (apt-get, apt-mark, apt-cache, …).
How to prevent packages from being updated.
You can always prevent packages from being updated with the help of APT. APT comes with every Ubuntu / Debian installation, so the following command should definitely work on any Debian / Ubuntu based system:
user@system:~$ sudo apt-mark hold <name of the package>
You have to change <name of the package> with the package you want to hold of course. So for e.g. if you want to prevent vlc from getting updated, the command would look like this:
user@system:~$ sudo apt-mark hold vlc
If you’re and Aptitude user instead, the command (with the exact same result) looks like this:
user@system:~$ sudo aptitude hold vlc
If you now update your system with the classical apt-get upgrade command for e.g., the package vlc isn’t going to be upgraded. APT, as well as Aptitude, will echo a notice which is saying that the package has been prevented from being updated.
How to unhold the package?
So, to hold a package is rather easy. But what to do when you want to unhold this package in order to get it updated again? If we use our vlc package from the example above again, the command to unhold and make a package available for an update with APT looks like this:
user@system:~$ sudo apt-mark unhold vlc
Again, the same command with the exact same result in Aptitude does look like this:
user@system:~$ sudo aptitude unhold vlc
But why to hold a package anyway?
You may ask yourself why you should hold a package anyway. Well, there are several reasons to do this. For e.g. sometimes you update a package and after this update the software doesn’t work as expected. So if you encounter a problem after an update on a test system, you could hold / block the specific package which causes you trouble on a production system before updating that system. Another example would be that you might have to check the configuration files first before updating a specific software. However, you want to install the latest security updates for the other installed packages. With holding the package you can update the other packages without touching the once you block.
Of course there are many other reasons why holding a package is a useful and a needed feature. You can also do this with a graphical solution like Synaptics. However, the console way of block package updates is much more easier and faster (IMHO) 😉
- Image header source: wikipedia.org