# pacman - An Introduction

This article or section is a candidate for merging with pacman.

Notes: No point in duplicating the main article here. (Discuss in Talk:Pacman - An Introduction#)

## Overview

Packages in arch repositories are constantly upgraded. When a package is upgraded, its old version is removed from the repository. There are no major arch releases. Each package is upgraded as new versions become available from upstream sources. The repository is always coherent. (The packages in the repository always have compatible versions.) Before packages are upgraded in the core, extra and community repositories, they are tested in the testing repository, to ensure that the distribution is stable.

Pacman saves to disk a list of packages available in a repository. This list is not automatically updated (refreshed) and is called a repository database. Updating the list is referred to as synchronizing the database.

## Installing packages

`pacman -S mypackage` installs `mypackage` and all its dependencies. If `mypackage` has been upgraded by the developer and uploaded to the repository since the last refresh of the local package database, then the required version of `mypackage` will not be found in the repository and `pacman -S mypackage` fails with a message. `mypackage`'s dependencies are listed in the Depends On entry of `mypackage`'s metainformation. (`mypackage`'s metainformation can be listed with `pacman -Si mypackage` for packages in the package list and with `pacman -Qi mypackage` for installed packages). If `mypackage` or its dependencies are already installed, they are upgraded to the version in the package list. If `pacman -S mypackage` finds any conflicts (installed packages which are listed in the Conflicts With entry of the `mypackage`'s metainformation) then it fails with a message.

Warning: However, `pacman -S mypackage` does not check for broken dependencies which may appear from the possible upgrade of `mypackage` or one of its dependencies. It is possible that an already installed package which depends on an upgraded package is unable to function with the new version of the upgraded package. This can happen if the package list has been refreshed by the user via `pacman -Sy` but all installed packges have not been upgraded and it could result in a non functional system after reboot.

The solution is to never run `pacman -Sy` separately, which could be followed by `pacman -S mypackage`, but to always run `pacman -Syu`, which upgrades all packages after the refresh of the package list. This ensures that when `pacman -S mypackage` is run all packages installed on the system have compatible versions.

`pacman -Syyu` additionally refreshes the list even if it appears to be up to date. This is a good idea after the repository mirror used by `pacman` is changed by the user. Mirrors can be out of sync and the package list from the old mirror may not correspond to the package list of the new mirror, even though the dates of the lists may suggest that they do. See also Is -Syy safe?.

After `pacman -Syu` is run there is a small chance that corrections on the system will be needed in order to have it running as desired. Important corrections are advertised here: Arch Home. However, it is advisable to run `pacman -Syu` only when time to perform corrections is available to the user and not when the system is relied upon. It is advisable to run `pacman -Syu` regularly in order to reduce the difficulty of adjustment, whenever it arises.

See also Installing packages.

Category:

- Classroom