Pacman, the default package manager on Arch-based distros, allows you to ignore a package upgrade by simply editing the pacman.conf file. This article is all about preventing specific packages from getting upgraded on Arch Linux, both permanently and temporarily.
Why Prevent Package Upgrades on Arch Linux?
Arch Linux is a rolling-release distro, which means new updates are released as soon as the package developers release one. This gives the developers less time to test the packages, hence increasing the chances of bugs and other issues in the code.
If you know that a specific package version is tested and less likely to break, you can prevent it from getting upgraded. This ensures that you enjoy the stability of the tested package for however long you want, while still having the choice to update it whenever you like.
You might also bump into issues with your system after upgrading a specific package. In such situations, it’s better to downgrade it to the previous stable version and prevent its further upgrades using Pacman.
How to Ignore a Package From Getting Updated
To prevent a package upgrade on Arch Linux, you’ll be editing a file named pacman.conf. It is the primary configuration file for Pacman, the Arch Linux package manager.
Begin with opening the pacman.conf file using a Linux text editor of your choice.
Scroll down till you find the comment: “Pacman won’t upgrade packages listed in IgnorePkg and members of IgnoreGroup.”
Uncomment the line below it and add the packages you don’t want to upgrade after the equals sign (=).
To add multiple packages, simply list them while separating two consecutive packages with space.
The aforementioned command will prevent nano, vim, and the current Linux kernel from upgrading further. Save and exit Vim when you’re done editing the file.
When you try to upgrade an ignored package manually (using pacman -S packagename), Pacman will notify you that the package is a part of IgnorePkg and ask if you’d like to upgrade it anyway. You can then choose to override the IgnorePkg statement if you want.
To ignore an entire package group from getting upgraded, add the IgnoreGroup statement in the pacman.conf file.
When the unstable version of the package is fixed, you can remove the upgrade limitation by simply removing the package names from the IgnorePkg and IgnoreGroup statements.
Temporarily Excluding a Package From a System Upgrade
Banning a specific package from getting upgrades permanently might not be an optimal solution for some users. If you want to ignore a package upgrade just once, use the –ignore flag in the pacman command.
For example, to prevent the update of the Linux kernel during a system upgrade:
Specify a comma-separated package list to ignore multiple packages from getting upgraded.
Similarly, you can also ignore certain package groups from getting upgraded using the –ignoregroup flag.
To update the package, simply run the command again without the –ignore and –ignoregroup flags.
Linux Gives You Complete Control Over Your System
With Linux, you can expect to see such attributes offering fine-grained control sprinkled all over the place. You can ignore specific package upgrades, downgrade a package, and even add your own packages to the Arch User Repository.
If you come from a Debian or RHEL-based distro and are new to Arch Linux, you might not be familiar with the AUR. The AUR is one of the primary reasons why Arch Linux is preferred by many users.