Automatically updates Arch Linux installed packages if there is a new update available is important to keep the packages up-to-date and it will provide improvement of security fixes, stability, performance, features, and more.

To keep the installed packages up-to-date, Arch Linux can automatically update if there is a new update available using a systemd service and timer (scheduler). It also helps to protect against zero-day attacks and vulnerabilities.

Information: The automatic update service below cannot automatically resolve package conflict during upgrade process, it will automatically skip or cancel the update process if conflict is detected. To resolve package conflict, run “pacman -Syu” (upgrade command) manually.

Create autoupdate service

Create a systemd service (autoupdate.service) using a text editor such as nano:

Add following to the autoupdate.service:

The autoupdate.service (autoupdate timer’s dependency unit) require the network is up. On service stop systemd will send interrupt signal (SIGINT) then wait the process to stop, after 180 seconds (timeout) systemd.kill will terminate using SIGTERM signal.

While installing a package, pacman will not immediately end the process after receive the interrupt signal (SIGINT), instead pacman will continue upgrading the package until finish, then quit the process. It will avoid the package to be broken or corrupted.

Create autoupdate timer

Create a systemd timer or scheduler (autoupdate.timer) using a text editor such as nano to run the automatic updates periodically (e.g. every 45 minutes):

Add following to the autoupdate.timer:
Enable the autoupdate.timer to automatically run at startup:


Package was broken and corrupted after interrupted install/update

If the automatic update were running when installing a package, but interrupted after power failure or system crash, then you receive an error when running pacman (e.g. error: target not found: package).

Try to force re-install the broken or corrupted package then uninstall the package using following commands:

If you’re encountered a conflicting file issue on upgrading process in example “gd: /directory/file/ exists in filesystem” you can try to force pacman to upgrade the package:

Note: Use the “–force” command to force package to be removed or upgraded, but use carefully.

If the above steps doesn’t work you can try another method from ArchWiki pacman’s guide

See also

  1. pacman – ArchWiki
  2. systemd – ArchWiki
  3. Image by dxiri / CC-BY 2.0