[Howto] How can I exclude selected packages when I run dnf update command?

You have two alternatives exclude the packaged or lock it…

1. Exclude the package version

With the Command Line

Until a fix is available you can block the offending package from updating by adding an option to the command, replace packagename with the name of the package(s), specified by a name or a glob and separated by a comma

sudo dnf upgrade --exclude=packagename

In Configuration Files

It is also possible to add the exclude option to the configuration file. If you use a gui update application this is the best option. You will need root permission to edit this file so use su - or prefix the command with sudo. Add exclude=packagename to /etc/dnf/dnf.conf .

excludepkgs

Exclude packages of this repository, specified by a name or a glob and separated by a comma , from all operations. Can be disabled using --disableexcludes command line switch.

Source -> conf_ref

NOTE: do not use quotation marks to identify the package name

2. Locking the package version

You can use the versionlock plugin for DNF to keep it, is part of dnf-plugins-core.

Then add the version desired. For example:

sudo dnf versionlock add package

If you want to remove the locked version, use the delete option:

sudo dnf versionlock delete package

https://dnf-plugins-core.readthedocs.io/en/latest/versionlock.html

7 Likes

Probably worth a quick doc too?

(We need to keep moving information from here to quick docs as we find it IMO. Otherwise we suffer the same issues as askbot).