Although Arch Linux emphasizes versatility and user-centrality, certain user choices can make life with Arch harder than it needs to be. Bad package management, in particular, can cause many headaches due to Arch's frequent package updates. The sections of this article constitute a baseline of good package management with Arch Linux.
You may of course ignore any recommendations that you find unnecessary, but be prepared to justify your decisions if you go to the Arch community for help afterwards.
Use pacman to install/uninstall software
Although many software packages include their own installer, installing packages via pacman will make your system much easier to maintain in the long term.
If there are no existing pacman packages for the software you need, you can learn about creating packages and make your own. This will take effort up front, but it will save time in the future when you want to upgrade or remove the software.
Similarly avoid deleting files manually if they are managed by pacman. You can query pacman's database to determine which package, if any, owns a particular file.
Avoid dangerous pacman options
Flags such as
--force bypass pacman's built-in safety checks. Only use them when instructed to by Arch developers or after consulting the Arch community to ensure that your use-case is appropriate. Never blindly copy-paste pacman commands (such as those from Pacman/Tips and tricks); always read the manual first to ensure that you understand what the command does.
Configure new packages
Arch packages generally include configuration files as provided by the developers, and there is no guarantee that any given package will have a sane default configuration.
When installing new packages, take some time to read the man pages and relevant wiki articles to ensure that you are aware of any necessary first-time setup.
Minimize the use of unsupported packages
Unsupported packages such as those in the AUR and unofficial user repositories are more error-prone and less trustworthy than official packages. These problems can be mitigated somewhat by double-checking PKGBUILDs, rebuilding unsupported packages with each system upgrade, and by following the upstream software developers, but that all comes at the cost of more involved system maintenance.
Perform periodic checks to see if any installed unsupported packages are unneeded and can be removed, or if they can be replaced with equivalent supported packages.
Read before system upgrades
Because of Arch's rolling release model, system upgrades can range from trivial bug fixes to massive system-wide changes requiring manual intervention. Before a system upgrade, read the latest Arch News to learn if there are any difficulties to be aware of. You can also check the forum for Pacman & Package Upgrade Issues to see if any users are having problems upgrading specific packages.
Regularly perform system upgrades
Perform a full system upgrade regularly to enjoy the latest bugfix and security updates and also to minimize the amount of manual intervention required for each upgrade. Keep an eye out for alerts during the upgrade process: they often indicate that some manual intervention is required, such as dealing with new configuration files.
Remember to manually upgrade packages not installed from a mirror (such as AUR packages).
Deal with new configuration files
Pacman will sometimes create special files to handle configuration conflicts. These files should be taken care of immediately after an upgrade to incorporate any configuration changes. The Pacman/Pacnew and Pacsave article explains several ways of managing them.
Note that many programs have configuration files not managed by pacman (such as user-specific ones in
~/.config). Remember to keep them up-to-date with system upgrades as well.
Always follow a package database sync with a system upgrade
Whenever you synchronize pacman's database you should immediately follow it with a full system upgrade. This ensures that all installed packages come from the same package snapshot. To be safe, do not run
pacman -Sy on its own, always do
Failure to upgrade after a sync can result in partial upgrades, where different packages come from different package snapshots. This can cause lots of problems due to dependency mismatches.
- If a system upgrade fails after a sync, you need to get the upgrade to succeed before doing any other package installs.
- If you build any packages with makepkg and install them, you may need to rebuild them when their dependencies are updated. Pacman cannot detect when these rebuilds are needed.
- If you try to install a new package and the package is not found on your mirrors, you should sync, upgrade, and then try to install the package again.
Remove unneeded packages
You should occasionally clean up unused packages from your system in order to minimize upgrade maintenance and to free up disk space.
- Check the list of orphan packages for ones you do not use:
pacman -Qdtq. You may not want to uninstall these indiscriminately because PKGBUILD makedepends often end up as orphans.
- Check the list of packages you explicitly installed and which no other packages depend on:
pacman -Qetq. You may have wanted these packages in the past, but some of them you probably do not use anymore.
- If your system is stable and you do not think you will need to downgrade any packages, remove old package versions from pacman's cache.