How to prevent packages from upgrading in Arch Linux?

Stop Packages From Updating In Arch Linux

Arch Linux is among the most widely used rolling release Linux Distributions. But sometimes the packages can cause you trouble after an update. For example, a kernel update has the potential to mess with your installation, so it is probably okay to disable its updates (unless you have new hardware).

The default package manager in Arch Linux and Arch-based distributions such as Artix, Manjaro, and Endeavour OS is Pacman. And it allows you to disable the update for any specific package by editing the pacman.conf file.

If you’re struggling with a quick-draining battery, here’s a quick guide on improving battery life on Arch Linux.

Why should you disable updates for specific packages?

Since it is a rolling release distribution, any update for a package is released as soon as the developers release one. This gives the developers less time to fix any bugs. These buggy packages will in turn result in a non-working application, or if the package is too important, then it can crash your system.

Stopping a package upgrade will solve your issue if any known version of that package is tested heavily and works well on your system.

Prevent a package from getting updated in Arch Linux

Simply edit the pacman.conf file which is located in the /etc/ directory using your favorite text editor. Open a Terminal and type :

# For Vim Users
sudo vim /etc/pacman.conf

# For nano users
sudo nano /etc/pacman.conf

If you are using vim editor, then press ‘i’ on your keyboard to enter the Insert mode. Now, scroll down till you find something like ‘IgnorePkg and IgnoreGroup.’

Uncomment The Options To Exclude Packages
Uncomment The Options To Exclude Packages

Uncomment the IgnorePkg line by removing the ‘#’ present before them, now add the name of the software package which you want to exclude while updating.

Exclude Packages From Updating In Arch Linux
Exclude Packages From Updating In Arch Linux

If you want to exclude several packages from upgrading, then you can separate them using a space. Now, press Ctrl+O to save and Ctrl+X to exit if you are using the nano text editor. For vim users, press Escape and type :wq to exit.

Here’s are 10 ways to exit the VIM editor if the above doesn’t work for you.

You can also exclude a whole group of applications, although it is not recommended (unless you know what you are doing) by uncommenting IgnoreGroup line in the pacman.conf file like this :

IgnoreGroup = kde-applications

You have to modify the pacman.conf file the next time you wish to update any excluded packages.

You can also exclude a package when you type pacman -Syu using the ignore option like this :

sudo pacman -Syu --ignore=vim,linux,linux-headers
Upgrading Arch Linux While Excluding Packages
Upgrading Arch Linux While Excluding Packages

Summary

Linux certainly provides you with more freedom. Unlike Windows, where basically update is forced on you, on Linux distributions, you can choose what to upgrade and when. You don’t have to do the above steps on Manjaro Linux, because the Manjaro Team holds the package till they become ‘stable enough’, however, it can cause a dependency error. And for the same reason, you should not hold off the applications from updating for too long.

References

Pacman – ArchWiki