Exclude Packages from Apt-Get Upgrade on Debian Linux

Posted on September 18, 2019 at 9:56 am

To exclude/hold a package from apt-get upgrade type:

apt-mark hold package_name

For example, to exclude MariaDB mysql packages type:

apt-mark hold libmariadbclient18 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mysql-common

Here is an example output:

libmariadbclient18 set on hold.
mariadb-client-10.3 set on hold.
mariadb-client-core-10.3 set on hold.
mariadb-common set on hold.
mariadb-server set on hold.
mariadb-server-10.3 set on hold.
mariadb-server-core-10.3 set on hold.
mysql-common set on hold.

To list packages excluded/on hold type:

dpkg --get-selections | grep "hold"

Here is an example output:

libmariadbclient18                              hold
mariadb-client-10.3                             hold
mariadb-client-core-10.3                        hold
mariadb-common                                  hold
mariadb-server                                  hold
mariadb-server-10.3                             hold
mariadb-server-core-10.3                        hold
mysql-common                                    hold

To include/unhold a package type:

apt-mark unhold package_name

For example, to include previously excluded MariaDB mysql packages type:

apt-mark unhold libmariadbclient18 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mysql-common

Here is an example output:

Canceled hold on libmariadbclient18.
Canceled hold on mariadb-client-10.3.
Canceled hold on mariadb-client-core-10.3.
Canceled hold on mariadb-common.
Canceled hold on mariadb-server.
Canceled hold on mariadb-server-10.3.
Canceled hold on mariadb-server-core-10.3.
Canceled hold on mysql-common.

Receive updates via email

Other Posts

Updated Posts