• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Exclude A Specific Package From Apt-Get Update

How To Exclude A Specific Package From Apt-Get Update

By Sourabh / April 12, 2017 Category: How To, Ubuntu

How to exclude a package from Apt-Get upgrade in Ubuntu Linux. Learn how to prevent apt from updating of specific packages using the command line. During the normal update process, you will see that there are few packages that you do not want to upgrade but still it gets updated. Luckily there is a way to exclude a specific package from updating.

apt-mark

apt-mark can be used as a unified front-end to set various settings for a package, such as marking a package as being automatically/manually installed or changing dpkg selections such as hold, install, deinstall and purge which are respected e.g. by apt-get dselect-upgrade or aptitude.

format

apt-mark {hold | unhold | install | remove | purge} pkg… |
{showhold | showinstall | showremove | showpurge} [pkg…]

hold

hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.

unhold

unhold is used to cancel a previously set hold on a package to allow all actions again.

showhold

showhold is used to print a list of packages on hold in the same way as for the other show commands.

Exclude A Package from Apt-Get Upgrade

As the packages can be updated using apt, dpkg or aptitude, there are three ways to exclude a specific package from Apt-Get upgrade process.

The apt-mark command can be used with apt, dpkg or aptitude. See below for the respective command format:

$ sudo apt-mark hold package_name
$ echo "package_name hold" | sudo dpkg --set-selections
$ sudo aptitude hold package_name

Change the package_name with your actual package name to be set on hold.

List All Packages That Are On Hold

dpkg –get-selections shows packages marked “deinstall”. This is the simplest way to list all the packages that are put on hold for update process. Simply run the following command:

$ dpkg --get-selections

Tags: ansible apt-mark, apt hold package, apt list held packages, apt pin version, apt-get install exclude package, apt-mark hold list, apt-mark showhold, apt-mark unhold

Primary Sidebar

Latest Posts

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To Check Kernel Installed Date In Linux Ubuntu

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

How To Fix Initramfs Error In Ubuntu Command Line

How To Check All Available Kernel Version In Linux Ubuntu

3 Best Artificial Intelligence Domain Name Generators

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap