Difference between revisions of "Pacman"

From ArchWiki
Jump to: navigation, search
(Upgrading packages: add links for mailing list, rss feed, and twitter.)
(Cleaning the package cache: paccache -rk 1 is probably the most frequent use of paccache so I added it explicitly as an example)
 
(308 intermediate revisions by 71 users not shown)
Line 7: Line 7:
 
[[el:Pacman]]
 
[[el:Pacman]]
 
[[es:Pacman]]
 
[[es:Pacman]]
 +
[[fa:Pacman]]
 
[[fr:Pacman]]
 
[[fr:Pacman]]
 
[[id:Pacman]]
 
[[id:Pacman]]
Line 12: Line 13:
 
[[ja:Pacman]]
 
[[ja:Pacman]]
 
[[ko:Pacman]]
 
[[ko:Pacman]]
[[lt:Pacman]]
 
 
[[nl:Pacman]]
 
[[nl:Pacman]]
 
[[pl:Pacman]]
 
[[pl:Pacman]]
Line 24: Line 24:
 
[[zh-CN:Pacman]]
 
[[zh-CN:Pacman]]
 
[[zh-TW:Pacman]]
 
[[zh-TW:Pacman]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Pacman is the Arch Linux [[Wikipedia:Package management system|package manager]]. Package managers are used to install, upgrade, and remove software. This article covers basic usage and troubleshooting tips.}}
+
{{Related|Creating packages}}
{{Article summary heading|Overview}}
+
{{Related|Downgrading packages}}
{{Article summary text|{{Package management overview}}}}
+
{{Related|pacman/Package signing}}
{{Article summary heading|Related}}
+
{{Related|pacman/Pacnew and Pacsave}}
{{Article summary wiki|Downgrading Packages}}
+
{{Related|pacman/Restore local database}}
{{Article summary wiki|Improve Pacman Performance}}
+
{{Related|pacman/Rosetta}}
{{Article summary wiki|Pacman GUI Frontends}}
+
{{Related|pacman/Tips and tricks}}
{{Article summary wiki|Pacman Rosetta}}
+
{{Related|FAQ#Package management}}
{{Article summary wiki|Pacman Tips}}
+
{{Related|System maintenance}}
{{Article summary wiki|Pacman package signing}}
+
{{Related|Arch Build System}}
{{Article summary wiki|FAQ#Package Management}}
+
{{Related|Official repositories}}
{{Article summary wiki|pacman-key}}
+
{{Related|Arch User Repository}}
{{Article summary wiki|Pacnew and Pacsave Files}}
+
{{Related articles end}}
{{Article summary heading|Resources}}
+
{{Article summary link|libalpm(3) Manual Page|https://www.archlinux.org/pacman/libalpm.3.html}}
+
{{Article summary link|pacman(8) Manual Page|https://www.archlinux.org/pacman/pacman.8.html}}
+
{{Article summary link|pacman.conf(5) Manual Page|https://www.archlinux.org/pacman/pacman.conf.5.html}}
+
{{Article summary link|repo-add(8) Manual Page|https://www.archlinux.org/pacman/repo-add.8.html}}
+
{{Article summary end}}
+
  
The '''[https://www.archlinux.org/pacman/ pacman]''' [[Wikipedia:Package management system|package manager]] is one of the major distinguishing features of Arch Linux. It combines a simple binary package format with an easy-to-use [[Arch Build System|build system]]. The goal of pacman is to make it possible to easily manage packages, whether they are from the [[Official Repositories|official Arch repositories]] or the user's own builds.
+
The [https://www.archlinux.org/pacman/ pacman] [[Wikipedia:Package manager|package manager]] is one of the major distinguishing features of Arch Linux. It combines a simple binary package format with an easy-to-use [[Arch Build System|build system]]. The goal of ''pacman'' is to make it possible to easily manage packages, whether they are from the [[official repositories]] or the user's own builds.
  
Pacman keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows the user to download/install packages with a simple command, complete with all required dependencies.
+
''pacman'' keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows the user to download/install packages with a simple command, complete with all required dependencies.
  
Pacman is written in the C programming language and uses the {{ic|.pkg.tar.xz}} package format.
+
''pacman'' is written in the C programming language and uses the ''.pkg.tar.xz'' package format.
  
{{Tip|The official {{Pkg|pacman}} package also contains other useful tools, such as '''makepkg''', '''pactree''', '''vercmp''' and more: run {{ic|pacman -Ql pacman <nowiki>|</nowiki> grep bin}} to see the full list.}}
+
{{Tip|The {{Pkg|pacman}} package contains other useful tools such as '''makepkg''', '''pactree''', '''vercmp''', and [[checkupdates]]. Run {{ic|pacman -Qlq pacman <nowiki>|</nowiki> grep bin}} to see the full list.}}
  
== Configuration ==
+
== Usage ==
  
Pacman's settings are located in {{ic|/etc/pacman.conf}}. This is the place where the user configures the program to work in the desired manner. In-depth information about the configuration file can be found in [https://www.archlinux.org/pacman/pacman.conf.5.html man pacman.conf].
+
{{Expansion|1=pacman 5.0 added some new operations: {{ic|-F}} and {{ic|-D}} [https://projects.archlinux.org/pacman.git/tree/NEWS?h=v5.0.0]. Compare {{ic|-F}} with [[pkgfile]], which is already linked below.}}
  
=== General options ===
+
What follows is just a small sample of the operations that ''pacman'' can perform. To read more examples, refer to [https://www.archlinux.org/pacman/pacman.8.html man pacman].
  
General options are in the {{ic|[options]}} section. Read the man page or look in the default {{ic|pacman.conf}} for information on what can be done here.
+
{{Tip|For those who have used other Linux distributions before, there is a helpful [[Pacman Rosetta]] article.}}
  
==== Skip package from being upgraded ====
+
=== Installing packages ===
  
To skip upgrading a specific package, specify it as such:
+
{{Note|Packages often have a series of [[PKGBUILD#optdepends|optional dependencies]] which are packages that provide additional functionality to the application, albeit not strictly required for running it. When installing a package, ''pacman'' will list its optional dependencies among the output messages, but they will not be found in {{ic|pacman.log}}: use the [[#Querying package databases|pacman -Si]] command to view the optional dependencies of a package, together with short descriptions of their functionality.}}
  
IgnorePkg=linux
+
{{Warning|1=When installing packages in Arch, avoid refreshing the package list without [[#Upgrading packages|upgrading the system]] (for example, when a [[#Packages cannot be retrieved on installation|package is no longer found]] in the official repositories). In practice, do '''not''' run {{ic|pacman -Sy ''package_name''}} instead of {{ic|pacman -Sy'''u''' ''package_name''}}, as this could lead to dependency issues. See [[System maintenance#Partial upgrades are unsupported]] and [https://bbs.archlinux.org/viewtopic.php?id=89328 BBS#89328].}}
  
For multiple packages use a space-separated list, or use additional {{ic|IgnorePkg}} lines.
+
==== Installing specific packages ====
  
==== Skip package group from being upgraded ====
+
To install a single package or list of packages (including dependencies), issue the following command:
  
As with packages, skipping a whole package group is also possible:
+
# pacman -S ''package_name1'' ''package_name2'' ...
  
IgnoreGroup=gnome
+
To install a list of packages with regex (see [https://bbs.archlinux.org/viewtopic.php?id=7179 this forum thread]):
  
==== Skip files from being installed to system ====
+
# pacman -S $(pacman -Ssq ''package_regex'')
  
To always skip installation of specific directories list them under {{Ic|NoExtract}}. For example, to avoid installation of [[systemd]] units use this:
+
Sometimes there are multiple versions of a package in different repositories, e.g. ''extra'' and ''testing''. To install the former version, the repository needs to be defined in front:
  
  NoExtract=usr/lib/systemd/system/*
+
  # pacman -S extra/''package_name''
 
+
=== Repositories ===
+
  
This section defines which [[Official Repositories|repositories]] to use, as referred to in {{ic|/etc/pacman.conf}}. They can be stated here directly or included from another file (such as {{ic|/etc/pacman.d/mirrorlist}}), thus making it necessary to maintain only one list. See [[Mirrors|here]] for mirror  configuration.
+
To install a number of packages sharing similar patterns in their names -- not the entire group nor all matching packages; eg. {{Grp|plasma}}:
  
{{hc|/etc/pacman.conf|2=
+
# pacman -S plasma-{desktop,mediacenter,nm}
#[testing]
+
#SigLevel = PackageRequired
+
#Include = /etc/pacman.d/mirrorlist
+
  
[core]
+
Of course, that is not limited and can be expanded to however many levels needed:
SigLevel = PackageRequired
+
Include = /etc/pacman.d/mirrorlist
+
  
[extra]
+
# pacman -S plasma-{workspace{,-wallpapers},pa}
SigLevel = PackageRequired
+
Include = /etc/pacman.d/mirrorlist
+
 
+
#[community-testing]
+
#SigLevel = PackageRequired
+
#Include = /etc/pacman.d/mirrorlist
+
 
+
[community]
+
SigLevel = PackageRequired
+
Include = /etc/pacman.d/mirrorlist
+
 
+
# If you want to run 32 bit applications on your x86_64 system,
+
# enable the multilib repositories as required here.
+
 
+
#[multilib-testing]
+
#SigLevel = PackageRequired
+
#Include = /etc/pacman.d/mirrorlist
+
 
+
#[multilib]
+
#SigLevel = PackageRequired
+
#Include = /etc/pacman.d/mirrorlist
+
 
+
# An example of a custom package repository.  See the pacman manpage for
+
# tips on creating your own repositories.
+
#[custom]
+
#SigLevel = Optional TrustAll
+
#Server = file:///home/custompkgs}}
+
 
+
{{Warning|Care should be taken when using the [testing] repository. It is in active development and updating may cause some packages to stop working. People who use the [testing] repository are encouraged to subscribe to the [https://mailman.archlinux.org/mailman/listinfo/arch-dev-public arch-dev-public mailing list] for current information.}}
+
 
+
=== Package security ===
+
 
+
Pacman 4 supports package signatures, which add an extra layer of security to the packages. The default configuration, {{ic|1=SigLevel = Required DatabaseOptional}}, enables signature verification for all the packages on a global level: this can be overridden by per-repository {{ic|SigLevel}} lines as shown above. For more details on package signing and signature verification, take a look at [[pacman-key]].
+
 
+
== Usage ==
+
 
+
What follows is just a small sample of the operations that pacman can perform. To read more examples, refer to [https://www.archlinux.org/pacman/pacman.8.html man pacman]. For an introduction, see [[pacman - An Introduction]].
+
 
+
=== Installing packages ===
+
 
+
==== Installing specific packages ====
+
 
+
To install a single package or list of packages (including dependencies), issue the following command:
+
 
+
# pacman -S ''package_name1'' ''package_name2'' ...
+
 
+
Sometimes there are multiple versions of a package in different repositories, e.g. [extra] and [testing]. To install the former version, the repository needs to be defined in front:
+
 
+
# pacman -S extra/''package_name''
+
  
 
==== Installing package groups ====
 
==== Installing package groups ====
  
Some packages belong to a group of packages that can all be installed simultaneously. For example, issuing the command:
+
Some packages belong to a [[Creating_packages#Meta_packages_and_groups|group of packages]] that can all be installed simultaneously. For example, issuing the command:
  
 
  # pacman -S gnome
 
  # pacman -S gnome
Line 169: Line 107:
 
Also visit https://www.archlinux.org/groups/ to see what package groups are available.
 
Also visit https://www.archlinux.org/groups/ to see what package groups are available.
  
{{Note|If a package in the list is already installed on the system, it will be reinstalled even if it is already up to date. This behavior can be overridden with the {{ic|--needed}} option.}}
+
{{Note|If a package in the list is already installed on the system, it will be reinstalled even if it is already up to date. This behavior can be overridden with the {{ic|--needed}} option.}}
 
+
{{Warning|1=When installing packages, do '''not''' refresh the package list without [[#Upgrading packages|upgrading]] the system (i.e. {{ic|pacman -Sy ''package_name''}}); this can lead to dependency issues. See [[#Partial upgrades are unsupported]] and https://bbs.archlinux.org/viewtopic.php?id=89328.}}
+
  
 
=== Removing packages ===
 
=== Removing packages ===
Line 193: Line 129:
 
  # pacman -Rdd ''package_name''
 
  # pacman -Rdd ''package_name''
  
Pacman saves important configuration files when removing certain applications and names them with the extension: {{ic|.pacsave}}. To prevent the creation of these backup files use the {{ic|-n}} option:
+
''pacman'' saves important configuration files when removing certain applications and names them with the extension: ''.pacsave''. To prevent the creation of these backup files use the {{ic|-n}} option:
  
 
  # pacman -Rn ''package_name''
 
  # pacman -Rn ''package_name''
  
{{Note|Pacman will not remove configurations that the application itself creates (for example "dotfiles" in the home folder).}}
+
{{Note|''pacman'' will not remove configurations that the application itself creates (for example "dotfiles" in the home folder).}}
  
 
=== Upgrading packages ===
 
=== Upgrading packages ===
  
Pacman can update all packages on the system with just one command. This could take quite a while depending on how up-to-date the system is. This command can synchronize the repository databases ''and'' update the system's packages (excluding 'local' packages that are not in the configured repositories):
+
{{Merge|System maintenance||Talk:Pacman#Don't rush upgrades}}
 +
{{Warning|Arch only supports full system upgrades. See [[System maintenance#Partial upgrades are unsupported]] and [[#Installing packages]] for details.}}
  
# pacman -Syu
+
It is recommended that users [[System_maintenance#Upgrading the system|upgrade their system regularly]]. When requesting support from the community, it will usually be assumed that the system is up to date.
  
{{Warning|Instead of immediately updating as soon as updates are available, users must recognize that due to the nature of Arch's rolling release approach, an update may have unforeseen consequences. This means that it is not wise to update if, for example, one is about to deliver an important presentation. Rather, update during free time and be prepared to deal with any problems that may arise.}}
+
Before upgrading, users are expected to visit the [https://www.archlinux.org/ Arch Linux home page] to check the latest news, or alternatively subscribe to the [https://www.archlinux.org/feeds/news/ RSS feed], [https://mailman.archlinux.org/mailman/listinfo/arch-announce/ arch-announce mailing list], or follow [https://twitter.com/archlinux @archlinux] on Twitter: when updates require out-of-the-ordinary user intervention (more than what can be handled simply by following the instructions given by ''pacman''), an appropriate news post will be made. Users must equally be aware that upgrading packages can raise '''unexpected''' problems that could need immediate intervention, therefore it is discouraged to upgrade a stable system shortly before it is required for carrying out an important task: it is wise to wait instead to have enough time in order to be able to deal with possible post-upgrade issues.
  
Pacman is a powerful package management tool, but it does not attempt to handle all corner cases. Read [[The Arch Way]] if this causes confusion.  Users must be vigilant and take responsibility for maintaining their own system. '''When performing a system update, it is essential that users read all information output by pacman and use common sense.''' If a user-modified configuration file needs to be upgraded for a new version of a package, a {{ic|.pacnew}} file will be created to avoid overwriting settings modified by the user. Pacman will prompt the user to merge them. These files require manual intervention from the user and it is good practice to handle them right after every package upgrade or removal. See [[Pacnew and Pacsave Files]] for more info.
+
''pacman'' can update all packages on the system with just one command. This could take quite a while depending on how up-to-date the system is. This command can synchronize the repository databases ''and'' update the system's packages (excluding "local" packages that are not in the configured repositories):
 +
 
 +
# pacman -Syu
  
{{Tip|Remember that pacman's output is logged in {{ic|/var/log/pacman.log}}.}}
+
''pacman'' is a powerful package management tool, but it does not attempt to handle all corner cases. Users must be vigilant and take responsibility for maintaining their own system. '''When performing a system update, it is essential that users read all information output by ''pacman'' and use common sense.''' If a user-modified configuration file needs to be upgraded for a new version of a package, a ''.pacnew'' file will be created to avoid overwriting settings modified by the user. ''pacman'' will prompt the user to merge them. These files require manual intervention from the user and it is good practice to handle them right after every package upgrade or removal. See [[Pacnew and Pacsave files]] for more information.
  
Before upgrading, it is advisable to visit the [https://www.archlinux.org/ Arch Linux home page] to check the latest news (alternatively subscribe to the [https://www.archlinux.org/feeds/news/ RSS feed], [https://mailman.archlinux.org/mailman/listinfo/arch-announce/ arch-announce mailing list], or follow [https://twitter.com/archlinux @archlinux] on Twitter), when updates require out-of-the-ordinary user intervention (more than what can be handled simply by following the instructions given by pacman), an appropriate news post will be made.
+
{{Tip|
 +
* Remember that ''pacman'''s output is logged in {{ic|/var/log/pacman.log}}.
 +
* You can use a log viewer such as {{AUR|wat-git}} to search the pacman logs.}}
  
 
If one encounters problems that cannot be solved by these instructions, make sure to search the forum. It is likely that others have encountered the same problem and have posted instructions for solving it.
 
If one encounters problems that cannot be solved by these instructions, make sure to search the forum. It is likely that others have encountered the same problem and have posted instructions for solving it.
Line 217: Line 158:
 
=== Querying package databases ===
 
=== Querying package databases ===
  
Pacman queries the local package database with the {{ic|-Q}} flag; see:
+
''pacman'' queries the local package database with the {{ic|-Q}} flag; see:
  
 
  $ pacman -Q --help
 
  $ pacman -Q --help
Line 225: Line 166:
 
  $ pacman -S --help
 
  $ pacman -S --help
  
Pacman can search for packages in the database, searching both in packages' names and descriptions:
+
''pacman'' can search for packages in the database, searching both in packages' names and descriptions:
  
 
  $ pacman -Ss ''string1'' ''string2'' ...
 
  $ pacman -Ss ''string1'' ''string2'' ...
 +
 +
Sometimes, {{Ic|-s}}'s builtin ERE can cause a lot of unwanted results, so it has to be limited to match the package name only; not the description nor any other field:
 +
 +
# pacman -Ss '^vim-'
  
 
To search for already installed packages:
 
To search for already installed packages:
Line 250: Line 195:
  
 
For packages not installed, use [[pkgfile]].
 
For packages not installed, use [[pkgfile]].
 +
 +
To verify the presence of the files installed by a package:
 +
 +
$ pacman -Qk ''package_name''
 +
 +
Passing the {{ic|k}} flag twice will perform a more thorough check.
  
 
One can also query the database to know which package a file in the file system belongs to:
 
One can also query the database to know which package a file in the file system belongs to:
Line 258: Line 209:
  
 
  $ pacman -Qdt
 
  $ pacman -Qdt
 +
 +
To list all packages explicitly installed and not required as dependencies:
 +
 +
$ pacman -Qet
  
 
To list a dependency tree of a package:
 
To list a dependency tree of a package:
Line 263: Line 218:
 
  $ pactree ''package_name''
 
  $ pactree ''package_name''
  
To list all the packages depending on an ''installed'' package, use {{ic|whoneeds}} from [[pkgtools]]:
+
To list all the packages recursively depending on an ''installed'' package, use ''whoneeds'' from {{AUR|pkgtools}}:
  
 
  $ whoneeds ''package_name''
 
  $ whoneeds ''package_name''
  
=== Additional commands ===
+
or the reverse flag to ''pactree'':
  
Upgrade the system and install a list of packages (one-liner):
+
$ pactree -r ''package_name''
  
  # pacman -Syu ''package_name1'' ''package_name2'' ...
+
See [[pacman tips]] for more examples.
 +
 
 +
==== Database structure ====
 +
 
 +
The pacman databases are normally located at {{ic|/var/lib/pacman/sync}}. For each repository specified in {{ic|/etc/pacman.conf}} there will be a corresponding database file located there. Database files are tar-gzipped archives containing one directory for each package, for example for the {{Pkg|which}} package:
 +
 
 +
{{bc|
 +
% tree which-2.20-6
 +
which-2.20-6<nowiki>
 +
|-- depends
 +
`-- desc</nowiki>
 +
}}
 +
 
 +
The {{ic|depends}} file lists the packages this package depends on, while {{ic|desc}} has a description of the package such as the file size and the MD5 hash.
 +
 
 +
=== Cleaning the package cache ===
 +
 
 +
''pacman'' stores its downloaded packages in {{ic|/var/cache/pacman/pkg/}} and does not remove the old or uninstalled versions automatically, therefore it is necessary to deliberately clean up that folder periodically to prevent such folder to grow indefinitely in size.
 +
 
 +
The built-in option to remove all the cached packages that are not currently installed is:
 +
 
 +
  # pacman -Sc
 +
 
 +
{{Warning|
 +
* Only do this when certain that previous package versions are not required, for example for a later [[downgrade]]. {{ic|pacman -Sc}} only leaves the versions of packages which are ''currently installed'' available, older versions would have to be retrieved through other means, such as the [[Archive]].
 +
* It is possible to empty the cache folder fully with {{ic|pacman -Scc}}. In addition to the above, this also prevents from reinstalling a package directly ''from'' the cache folder in case of need, thus requiring a new download. It should be avoided unless there is an immediate need for disk space.
 +
}}
 +
 
 +
Because of the above limitations, consider an alternative for more control over which packages, and how many, are deleted from the cache:
 +
 
 +
The ''paccache'' script, provided by the {{Pkg|pacman}} package itself, deletes all cached versions of each package regardless of whether they're installed or not, except for the most recent 3, by default:
 +
 
 +
# paccache -r
 +
 
 +
You can also define how many recent versions you want to keep:
 +
 
 +
# paccache -rk 1
 +
 
 +
To remove all cached versions of uninstalled packages, re-run ''paccache'' with:
 +
 
 +
# paccache -ruk0
 +
 
 +
See {{ic|paccache -h}} for more options.
 +
 
 +
{{AUR|pkgcacheclean}} and {{AUR|pacleaner}} are two further alternatives.
 +
 
 +
=== Additional commands ===
  
 
Download a package without installing it:
 
Download a package without installing it:
Line 277: Line 278:
 
  # pacman -Sw ''package_name''
 
  # pacman -Sw ''package_name''
  
Install a 'local' package that is not from a remote repository (e.g. the package is from the [[Arch User Repository|AUR]]):
+
Install a 'local' package that is not from a remote repository (e.g. the package is from the [[AUR]]):
  
  # pacman -U /path/to/package/package_name-version.pkg.tar.xz
+
  # pacman -U ''/path/to/package/package_name-version.pkg.tar.xz''
  
{{Tip|To keep a copy of the local package in pacman's cache, use:
+
To keep a copy of the local package in ''pacman'''s cache, use:
# pacman -U file://path/to/package/package_name-version.pkg.tar.xz
+
}}
+
  
Install a 'remote' package (not from a repository stated in pacman's configuration files):
+
# pacman -U file:///''path/to/package/package_name-version.pkg.tar.xz''
  
# pacman -U <nowiki>http://www.example.com/repo/example.pkg.tar.xz</nowiki>
+
Install a 'remote' package (not from a repository stated in ''pacman'''s configuration files):
  
Clean the package cache of packages that are not currently installed ({{ic|/var/cache/pacman/pkg}}):
+
# pacman -U ''<nowiki>http://www.example.com/repo/example.pkg.tar.xz</nowiki>''
  
{{Warning|Only do this if certain that the installed packages are stable and that a [[Downgrading Packages|downgrade]] will not be necessary, since it will remove all of the old versions from the cache folder, leaving behind only the versions of the packages that are currently installed. Having older versions of packages comes in handy in case a future upgrade causes breakage.}}
+
To inhibit the {{ic|-S}}, {{ic|-U}} and {{ic|-R}} actions, {{ic|-p}} can be used.
  
# pacman -Sc
+
''pacman'' always lists packages to be installed or removed and asks for permission before it takes action.
  
Clean the entire package cache:
+
=== Installation reason ===
  
{{Warning|This clears out the entire package cache. Doing this is considered a bad practice; it prevents the ability to downgrade something directly from the cache folder.  Users will be forced to have to use an alternative source of deprecated packages such as the [[Downgrading Packages#ARM|Arch Rollback Machine]].}}
+
The ''pacman'' database distinguishes the installed packages in two groups according to the reason why they were installed:
  
# pacman -Scc
+
* '''explicitly-installed''': the packages that were literally passed to a generic ''pacman'' {{ic|-S}} or {{ic|-U}} command;
 +
* '''dependencies''': the packages that, despite never (in general) having been passed to a ''pacman'' installation command, were implicitly installed because [[dependency|required]] by another package that was explicitly installed.
  
{{Tip|As an alternative to both the {{ic|-Sc}} and {{ic|-Scc}} switches, consider using {{ic|paccache}} from {{pkg|pacman}}. This offers more control over what and how many packages are deleted. Run {{ic|paccache -h}} for instructions.}}
+
When installing a package, it is possible to force its installation reason to ''dependency'' with:
  
=== Partial upgrades are unsupported ===
+
# pacman -S --asdeps ''package_name''
  
Arch Linux is a rolling release, and new [[Wikipedia:Library (computing)|library]] versions will be pushed to the repositories. The developers and Trusted Users will rebuild all the packages in the repositories that need to be rebuilt against the libraries. If the system has locally installed packages (such as [[Arch User Repository|AUR]] packages), users will need to rebuild them when their dependencies receive a [[Wikipedia:soname|soname]] bump.
+
When '''re'''installing a package, though, the current installation reason is preserved by default.
  
This means that partial upgrades are '''not supported'''. Do not use {{ic|pacman -Sy package}} or any equivalent such as {{ic|pacman -Sy}} and then {{ic|pacman -S package}}. Always upgrade before installing a package -- particularly if pacman has refreshed the sync repositories. Be very careful when using {{ic|IgnorePkg}} and {{ic|IgnoreGroup}} for the same reason.
+
The list of explicitly-installed packages can be shown with {{ic|pacman -Qe}}, while the complementary list of dependencies can be shown with {{ic|pacman -Qd}}.
  
If a partial upgrade scenario has been created, and binaries are broken because they cannot find the libraries they are linked against, '''do not "fix" the problem simply by symlinking'''. Libraries receive [[Wikipedia:soname|soname]] bumps when they are '''not backwards compatible'''. A simple {{ic|pacman -Syu}} to a properly synced mirror will fix the problem as long as pacman is not broken.
+
To change the installation reason of an already installed package, execute:
  
== Troubleshooting ==
+
# pacman -D --asdeps ''package_name''
  
{{FAQ
+
Use {{ic|--asexplicit}} to do the opposite operation.
|question=An update to package XYZ broke my system!
+
|answer=Arch Linux is a rolling-release cutting-edge distribution. Package updates are available as soon as they are deemed stable enough for general use. However, updates sometimes require user intervention: configuration files may need to be updated, optional dependencies may change, etc.
+
  
The most important tip to remember is to not "blindly" update Arch systems. Always read the list of packages to be updated. Note whether "critical" packages are going to be updated ({{Pkg|linux}}, {{Pkg|xorg-server}}, and so on). If so, it is usually a good idea to check for any news at https://www.archlinux.org/ and scan recent forum posts to see if people are experiencing problems as a result of an update.
+
== Configuration ==
  
If a package update is expected/known to cause problems, packagers will ensure that pacman displays an appropriate message when the package is updated. If experiencing trouble after an update, double-check pacman's output by looking at the log ({{ic|/var/log/pacman.log}}).  
+
''pacman'''s settings are located in {{ic|/etc/pacman.conf}}: this is the place where the user configures the program to work in the desired manner. In-depth information about the configuration file can be found in [https://www.archlinux.org/pacman/pacman.conf.5.html man pacman.conf].
  
At this point, '''only after ensuring there is no information available through pacman, there is no relative news on https://www.archlinux.org/, and there are no forum posts regarding the update''', consider seeking help on the forum, over [[IRC Channel|IRC]], or [[Downgrading Packages|downgrading the offending package]].}}
+
=== General options ===
 +
 
 +
General options are in the {{ic|[options]}} section. Read the [[man page]] or look in the default {{ic|pacman.conf}} for information on what can be done here.
 +
 
 +
==== Color output ====
 +
 
 +
Pacman has a color option. Uncomment the "Color" line in {{ic|/etc/pacman.conf}}.
 +
 
 +
==== Comparing versions before updating ====
 +
 
 +
To see old and new versions of available packages, uncomment the "VerbosePkgLists" line in {{ic|/etc/pacman.conf}}. The output of {{ic|pacman -Syu}} will be like this:
 +
 
 +
Package (6)            Old Version  New Version  Net Change  Download Size
 +
 +
extra/libmariadbclient  10.1.9-4    10.1.10-1      0.03 MiB      4.35 MiB
 +
extra/libpng            1.6.19-1    1.6.20-1      0.00 MiB      0.23 MiB
 +
extra/mariadb          10.1.9-4    10.1.10-1      0.26 MiB      13.80 MiB
 +
 
 +
==== Skip package from being upgraded ====
 +
 
 +
To have a specific package skipped when [[#Upgrading packages|upgrading]] the system, specify it as such:
 +
 
 +
IgnorePkg=linux
 +
 
 +
For multiple packages use a space-separated list, or use additional {{ic|IgnorePkg}} lines. Also, glob patterns can be used. If you want to skip packages just once, you can also use the {{ic|--ignore}} option on the command-line - this time with a comma-separated list.
 +
 
 +
It will still be possible to upgrade the ignored packages using {{ic|pacman -S}}: in this case ''pacman'' will remind you that the packages have been included in an {{ic|IgnorePkg}} statement.
 +
 
 +
==== Skip package group from being upgraded ====
 +
 
 +
As with packages, skipping a whole package group is also possible:
 +
 
 +
IgnoreGroup=gnome
 +
 
 +
==== Skip files from being installed to system ====
 +
 
 +
To always skip installation of specific directories list them under {{Ic|NoExtract}}. For example, to avoid installation of [[systemd]] units use this:
 +
 
 +
NoExtract=usr/lib/systemd/system/*
 +
 
 +
Or as a preemptive alternative to {{AUR|localepurge}}, to avoid installing non-English localizations:
 +
 
 +
NoExtract = usr/share/help/* !usr/share/help/en*
 +
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/locales/* opt/google/chrome/locales/*
 +
NoExtract = !*locale*/en* !usr/share/*locale*/locale.alias !usr/share/*locales/i18n !usr/share/*locales/iso* !usr/share/*locales/trans*
 +
NoExtract = usr/share/man/* !usr/share/man/man*
 +
NoExtract = usr/share/vim/vim74/lang/*
 +
 
 +
Later rules override previous ones, and you can negate a rule by prepending {{ic|!}} — this allows you to keep the locales you need.
 +
 
 +
{{Tip|''pacman'' issues warning messages about missing locales when updating a package for which locales have been cleared by ''localepurge'' or ''bleachbit''. Commenting the {{ic|CheckSpace}} option in {{ic|pacman.conf}} suppresses such warnings, but consider that the space-checking functionality will be disabled for all packages.}}
 +
 
 +
==== Maintain several configuration files ====
 +
 
 +
If you have several configuration files (e.g. main configuration and configuration with [[testing]] repository enabled) and would have to share options between configurations you may use {{ic|Include}} option declared in the configuration files, e.g.:
 +
 
 +
Include = ''/path/to/common/settings''
 +
 
 +
where {{ic|''/path/to/common/settings''}} file contains the same options for both configurations.
 +
 
 +
==== Hooks ====
 +
 
 +
''pacman'' can run pre- and post-transaction hooks from the {{ic|/usr/share/libalpm/hooks/}} directory; more directories can be specified with the {{ic|HookDir}} option in {{ic|pacman.conf}}, which defaults to {{ic|/etc/pacman.d/hooks}}. Hook file names must be suffixed with ''.hook''.
 +
 
 +
For more information on alpm hooks, see [https://www.archlinux.org/pacman/alpm-hooks.5.html alpm-hooks(5)]
 +
 
 +
=== Repositories and mirrors ===
 +
 
 +
Besides the special [[#General options|[options]]] section, each other {{ic|[section]}} in {{ic|pacman.conf}} defines a package repository to be used. A ''repository'' is a ''logical'' collection of packages, which are ''physically'' stored on one or more servers: for this reason each server is called a ''mirror'' for the repository.
 +
 
 +
Repositories are distinguished between [[Official repositories|official]] and [[Unofficial user repositories|unofficial]]. The order of repositories in the configuration file matters; repositories listed first will take precedence over those listed later in the file when packages in two repositories have identical names, regardless of version number. In order to use a repository after adding it, you will need to [[#Upgrading packages|upgrade]] the whole system first.
 +
 
 +
Each repository section allows defining the list of its mirrors directly or in a dedicated external file through the {{ic|Include}} directive: for example, the mirrors for the official repositories are included from {{ic|/etc/pacman.d/mirrorlist}}. See the [[Mirrors]] article for mirror configuration.
 +
 
 +
==== Package security ====
 +
 
 +
''pacman'' supports package signatures, which add an extra layer of security to the packages. The default configuration, {{ic|1=SigLevel = Required DatabaseOptional}}, enables signature verification for all the packages on a global level: this can be overridden by per-repository {{ic|SigLevel}} lines. For more details on package signing and signature verification, take a look at [[pacman-key]].
 +
 
 +
== Troubleshooting ==
  
{{FAQ
+
=== "Failed to commit transaction (conflicting files)" error ===
|question=I know an update to package ABC was released, but pacman says my system is up to date!
+
|answer=Pacman mirrors are not synced immediately. It may take over 24 hours before an update is available to you. The only options are be patient or use another mirror. [https://www.archlinux.org/mirrors/status/ MirrorStatus] can help you identify an up-to-date mirror.}}
+
  
{{FAQ
+
If you see the following error: [https://bbs.archlinux.org/viewtopic.php?id=56373]
|question=I get an error when updating: "file exists in filesystem"!
+
|answer=ASIDE: ''Taken from https://bbs.archlinux.org/viewtopic.php?id=56373 by Misfit138.''
+
  
 
  error: could not prepare transaction
 
  error: could not prepare transaction
 
  error: failed to commit transaction (conflicting files)
 
  error: failed to commit transaction (conflicting files)
  package: /path/to/file exists in filesystem
+
  ''package'': ''/path/to/file'' exists in filesystem
 
  Errors occurred, no packages were upgraded.
 
  Errors occurred, no packages were upgraded.
  
Why this is happening: pacman has detected a file conflict, and by design, will not overwrite files for you. This is a design feature, not a flaw.  
+
Why this is happening: ''pacman'' has detected a file conflict, and by design, will not overwrite files for you. This is a design feature, not a flaw.
  
The problem is usually trivial to solve. A safe way is to first check if another package owns the file ({{ic|pacman -Qo /path/to/file}}). If the file is owned by another package, [[Reporting Bug Guidelines|file a bug report]]. If the file is not owned by another package, rename the file which 'exists in filesystem' and re-issue the update command. If all goes well, the file may then be removed.
+
The problem is usually trivial to solve. A safe way is to first check if another package owns the file ({{ic|pacman -Qo ''/path/to/file''}}). If the file is owned by another package, [[Reporting bug guidelines|file a bug report]]. If the file is not owned by another package, rename the file which 'exists in filesystem' and re-issue the update command. If all goes well, the file may then be removed.
  
If you had installed a program manually without using pacman or a frontend, you have to remove it and all its files and reinstall properly using pacman.
+
If you had installed a program manually without using ''pacman'' or a frontend, for example through {{ic|make install}}, you have to remove it and all its files and reinstall properly using ''pacman''. See also [[Pacman tips#Identify files not owned by any package]].
  
Every installed package provides {{ic|/var/lib/pacman/local/$package-$version/files}} file that contains metadata about this package. If this file gets corrupted - is empty or missing - it results in "file exists in filesystem" errors when trying to update the package. Such an error usually concerns only one package and instead of manually renaming and later removing all the files that belong to the package in question, you can run {{ic|pacman -S --force $package}} to force pacman to overwrite these files.
+
Every installed package provides a {{ic|/var/lib/pacman/local/''$package-$version''/files}} file that contains metadata about this package. If this file gets corrupted, is empty or goes missing, it results in {{ic|file exists in filesystem}} errors when trying to update the package. Such an error usually concerns only one package. Instead of manually renaming and later removing all the files that belong to the package in question, you may exceptionally run {{ic|pacman -S --force $package}} to force ''pacman'' to overwrite these files.
  
Do '''not''' run {{ic|pacman -Syu --force}}.}}
+
{{Warning|Take care when using the {{ic|--force}} switch (for example {{ic|pacman -Syu --force}}) as it can cause major problems if used improperly. It is highly recommended to only use this option when the Arch news instructs the user to do so.}}
  
{{FAQ
+
=== "Failed to commit transaction (invalid or corrupted package)" error ===
|question=I get an error when installing a package: "not found in sync db"
+
|answer=Firstly, ensure the package actually exists (and watch out for typos!). If certain the package exists, your package list may be out-of-date or your repositories may be incorrectly configured. Try running {{ic|pacman -Syy}} to force a refresh of all package lists.}}
+
  
{{FAQ
+
Look for ''.part'' files (partially downloaded packages) in {{ic|/var/cache/pacman/pkg}} and remove them (often caused by usage of a custom {{ic|XferCommand}} in {{ic|pacman.conf}}).
|question=Pacman is repeatedly upgrading the same package!
+
|answer=This is due to duplicate entries in {{ic|/var/lib/pacman/local/}}, such as two {{ic|linux}} instances. {{ic|pacman -Qi}} outputs the correct version, but {{ic|pacman -Qu}} recognizes the old version and therefore will attempt to upgrade.
+
  
Solution: delete the offending entry in {{ic|/var/lib/pacman/local/}}.
+
# find /var/cache/pacman/pkg/ -iname "*.part" -exec rm {} \;
  
{{Note|Pacman version 3.4 should display an error in case of duplicate entries, which should make this note obsolete.}}}}
+
=== "Failed to init transaction (unable to lock database)" error ===
  
{{FAQ
+
When ''pacman'' is about to alter the package database, for example installing a package, it creates a lock file at {{ic|/var/lib/pacman/db.lck}}. This prevents another instance of ''pacman'' from trying to alter the package database at the same time.
|question=Pacman crashes during an upgrade!
+
|answer=In the case that pacman crashes with a "database write" error whilst removing packages, and reinstalling or upgrading packages fails:
+
  
# Boot using the Arch install media.
+
If ''pacman'' is interrupted while changing the database, this stale lock file can remain. If you are certain that no instances of ''pacman'' are running then delete the lock file:
# Mount your root filesystem.
+
# Update the pacman database via {{ic|pacman -Syy}}.
+
# Reinstall the broken package via {{ic|pacman -r /path/to/root -S package}}.}}
+
  
{{FAQ
+
# rm /var/lib/pacman/db.lck
|question=I installed software using "make install"; these files do not belong to any package!
+
|answer=If receiving a "conflicting files" error, note that pacman will overwrite manually-installed software if supplied with the {{ic|--force}} switch ({{ic|pacman -S --force}}). See [[Pacman Tips#Identify files not owned by any package]] for a script that searches the file system for ''disowned'' files.
+
{{Warning|Take care when using the {{ic|--force}} switch because it can cause major problems if used improperly.}}}}
+
  
{{FAQ
+
=== Packages cannot be retrieved on installation ===
|question=I need a package with a specific file. How do I know what provides it?
+
|answer=Install [[pkgfile]] which uses a separate database with all files and their associated packages.}}
+
  
{{FAQ
+
This error manifests as {{ic|Not found in sync db}}, {{ic|Target not found}} or {{ic|Failed retrieving file}}.
|question=Pacman is completely broken! How do I reinstall it?
+
|answer=In the case that pacman is broken beyond repair, manually download the necessary packages ({{Pkg|openssl}}, {{Pkg|libarchive}}, and {{Pkg|pacman}}) and extract them to root. The pacman binary will be restored along with its default configuration file. Afterwards, reinstall these packages with pacman to maintain package database integrity. Additional information and an example (outdated) script that automates the process is available in [https://bbs.archlinux.org/viewtopic.php?id=95007 this] forum post.}}
+
  
{{FAQ
+
Firstly, ensure the package actually exists (and watch out for typos!). If certain the package exists, your package list may be out-of-date or your repositories may be incorrectly configured. Try running {{ic|pacman -Syyu}} to force a refresh of all package lists and upgrade.
|question=After updating my system, I get a "unable to find root device" error after rebooting and my system will no longer boot
+
|answer=Most likely your initramfs got broken during a kernel update (improper use of pacman's {{ic|--force}} option can be a cause). You have two options:
+
  
'''1.''' Try the ''Fallback'' entry.
+
It could also be that the repository containing the package is not enabled on your system, e.g. the package could be in the ''multilib'' repository, but ''multilib'' is not enabled in your ''pacman.conf''.
  
: {{Tip|In case you removed this entry for whatever reason, you can always press the {{Keypress|Tab}} key when the bootloader menu shows up (for Syslinux) or {{Keypress|e}} (for GRUB), rename it {{ic|initramfs-linux-fallback.img}} and press {{Keypress|Enter}} or {{Keypress|b}} (depending on your bootloader) to boot with the new parameters.}}
+
See also [[FAQ#Why is there only a single version of each shared library in the official repositories?]].
  
: Once the system starts, run this command (for the stock {{Pkg|linux}} kernel) either from the console or from a terminal to rebuild the initramfs image:
+
=== Search for a package that contains a specific file ===
  
: {{bc|# mkinitcpio -p linux}}
+
Install [[pkgfile]] which uses a separate database with all files and their associated packages.
  
'''2.''' If that does not work, from a 2012 Arch release (CD/DVD or USB stick), run:
+
=== Manually reinstalling pacman ===
  
: {{Note|If you do not have a 2012 release or if you only have some other "live" Linux distribution laying around, you can [[chroot]] using the old fashion way. Obviously, there will be more typing than simply running the {{ic|arch-chroot}} script.}}
+
{{Warning|It is extremely easy to break your system even worse using this approach. Use this only as a last resort if the method from [[#pacman crashes during an upgrade]] is not an option.}}
  
: {{bc|<nowiki>
+
Even if ''pacman'' is terribly broken, you can fix it manually by downloading the latest packages and extracting them to the correct locations. The rough steps to perform are
# mount /dev/sdxY /mnt        #Your root partition.
+
# mount /dev/sdxZ /mnt/boot    #If you use a separate /boot partition.
+
# arch-chroot /mnt
+
# pacman -Syu mkinitcpio systemd linux</nowiki>}}
+
  
: Reinstalling the kernel (the {{Pkg|linux}} package) will automatically re-generate the initramfs image with {{ic|mkinitcpio -p linux}}. There is no need to do this separately.
+
# Determine dependencies to install
 +
# Download each package from a mirror of your choice
 +
# Extract each package to root
 +
# Reinstall these packages with {{ic|pacman -Sf}} to update the package database accordingly
 +
# Do a full system upgrade
  
: Afterwards, it is recommended that you run {{ic|exit}}, {{ic|umount /mnt/{boot,} }} and {{ic|reboot}}.
+
If you have a healthy Arch system on hand, you can see the full list of dependencies with
  
: {{Note|If you cannot enter the arch-chroot or chroot environment but need to re-install packages you can use the command {{ic|pacman -r /mnt -Syu foo bar}} to use pacman on your root partition.}}}}
+
$ pacman -Q $(pactree -u pacman)
  
{{FAQ
+
but you may only need to update a few of them depending on your issue. An example of extracting a package is
|question=Signature from "User <email@gmail.com>" is unknown trust, installation failed
+
|answer=Follow [[pacman-key#Resetting all the keys]]. Or you can try to manually upgrade {{Pkg|archlinux-keyring}} package first, i.e. {{ic|pacman -S archlinux-keyring}}. }}
+
  
{{FAQ
+
# tar -xvpwf ''package.tar.xz'' -C / --exclude .PKGINFO --exclude .INSTALL
|question=I keep getting
+
:error: PackageName: signature from "User <email@archlinux.org>" is invalid
+
:error: failed to commit transaction (invalid or corrupted package (PGP signature))
+
:Errors occured, no packages were upgraded.  
+
|answer=It happens when the system clock is wrong. Set the [[time]] and run: {{bc|# hwclock -w}} before to try to install/upgrade a package again.}}
+
  
{{FAQ
+
Note the use of the {{ic|w}} flag for interactive mode. Running non-interactively is very risky since you might end up overwriting an important file. Also take care to extract packages in the correct order (i.e. dependencies first). [https://bbs.archlinux.org/viewtopic.php?id=95007 This forum post] contains an example of this process where only a couple ''pacman'' dependencies are broken.
|question=I keep getting a "failed to commit transaction (invalid or corrupted package)" error
+
|answer=Look for {{ic|*.part}} files (partially downloaded packages) in {{ic|/var/cache/pacman/pkg}} and remove them (often caused by usage of custom {{ic|XferCommand}} in {{ic|pacman.conf}}).}}
+
  
{{FAQ
+
=== pacman crashes during an upgrade ===
|question=I get an error every time I use pacman saying 'warning: current locale is invalid; using default "C" locale'. What do I do?
+
|answer=As the error message says, your locale is not correctly configured. See [[Locale]].}}
+
  
{{FAQ
+
In the case that ''pacman'' crashes with a "database write" error while removing packages, and reinstalling or upgrading packages fails thereafter, do the following:
|question=How can I get Pacman to honor my proxy settings?
+
 
|answer=Make sure that the relevant environment variables ({{ic|$http_proxy}}, {{ic|$ftp_proxy}} etc.) are set up. If you use Pacman with [[sudo]], you need to configure sudo to [[sudo#Environment variables (Outdated?)|pass these environment variables to Pacman]].
+
# Boot using the Arch installation media. Preferably use a recent media so that the ''pacman'' version matches/is newer than the system.
}}
+
# Mount the system's root filesystem, e.g. {{ic|mount /dev/sdaX /mnt}} as root, and check the mount has sufficient space with {{ic|df -h}}
 +
# If the system uses default database and directory locations, you can now update the system's pacman database and upgrade it via {{ic|1=pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syyu}} as root.
 +
# After the upgrade, one way to double-check for not upgraded but still broken packages: {{ic|find /mnt/usr/lib -size 0}}
 +
# Followed by a re-install of any still broken package via {{ic|1=pacman --root /mnt --cachedir=/mnt/var/cache/pacman/pkg -S ''package''}}.
 +
 
 +
=== "Unable to find root device" error after rebooting ===
 +
 
 +
Most likely your initramfs got broken during a kernel update (improper use of ''pacman'''s {{ic|--force}} option can be a cause). You have two options; first, try the ''Fallback'' entry:
 +
 
 +
{{Tip|In case you removed this entry for whatever reason, you can always press the {{ic|Tab}} key when the bootloader menu shows up (for Syslinux) or {{ic|e}} (for GRUB or systemd-boot), rename it {{ic|initramfs-linux-fallback.img}} and press {{ic|Enter}} or {{ic|b}} (depending on your bootloader) to boot with the new parameters.}}
 +
 
 +
Once the system starts, run this command (for the stock {{Pkg|linux}} kernel) either from the console or from a terminal to rebuild the initramfs image:
 +
 
 +
# mkinitcpio -p linux
 +
 
 +
If that does not work, from a current Arch release (CD/DVD or USB stick), run:
 +
 
 +
{{Note|If you do not have a current release or if you only have some other "live" Linux distribution laying around, you can [[chroot]] using the old fashioned way. Obviously, there will be more typing than simply running the {{ic|arch-chroot}} script.}}
 +
 
 +
# mount /dev/sdxY /mnt        # Your root partition.
 +
# mount /dev/sdxZ /mnt/boot    # If you use a separate /boot partition.
 +
# arch-chroot /mnt
 +
# pacman -Syu mkinitcpio systemd linux
 +
 
 +
{{Note|If ''pacman'' fails with {{ic|Could not resolve host}}, please [[Network_configuration#Check_the_connection|check your internet connection]].}}
 +
 
 +
Reinstalling the kernel (the {{Pkg|linux}} package) will automatically re-generate the initramfs image with {{ic|mkinitcpio -p linux}}. There is no need to do this separately.
 +
 
 +
Afterwards, it is recommended that you run {{ic|exit}}, {{ic|umount /mnt/{boot,} }} and {{ic|reboot}}.
 +
 
 +
{{Note|If you cannot enter the arch-chroot or chroot environment but need to re-install packages you can use the command {{ic|pacman -r /mnt -Syu foo bar}} to use ''pacman'' on your root partition.}}
 +
 
 +
=== Signature from "User <email@gmail.com>" is unknown trust, installation failed ===
 +
 
 +
Follow [[pacman-key#Resetting all the keys]]. Or you can try to either:
 +
* update the known keys, i.e. {{ic|pacman-key --refresh-keys}};
 +
* or manually upgrade {{Pkg|archlinux-keyring}} package first, i.e. {{ic|pacman -S archlinux-keyring}}.
 +
 
 +
=== Request on importing PGP keys ===
 +
 
 +
If [[Installation guide|installing]] Arch with an outdated ISO, you are likely prompted to import PGP keys. Agree to download the key to proceed. If you are unable to add the PGP key successfully, update the keyring or upgrade {{Pkg|archlinux-keyring}} (see [[#Signature from "User <email@gmail.com>" is unknown trust, installation failed|above]]).
 +
 
 +
=== Signature from "User <email@archlinux.org>" is invalid, installation failed ===
 +
 
 +
When the system time is faulty, signing keys are considered expired (or invalid) and signature checks on packages will fail with the following error:
 +
 
 +
error: ''package'': signature from "User <email@archlinux.org>" is invalid
 +
error: failed to commit transaction (invalid or corrupted package (PGP signature))
 +
Errors occured, no packages were upgraded.
 +
 
 +
Make sure to correct the [[time]], for example with {{ic|ntpd -qg}} run as root, and run {{ic|hwclock -w}} as root before subsequent installations or upgrades.
 +
 
 +
=== "Warning: current locale is invalid; using default "C" locale" error ===
 +
 
 +
As the error message says, your locale is not correctly configured. See [[Locale]].
 +
 
 +
=== pacman does not honor proxy settings ===
 +
 
 +
Make sure that the relevant environment variables ({{ic|$http_proxy}}, {{ic|$ftp_proxy}} etc.) are set up. If you use ''pacman'' with [[sudo]], you need to configure sudo to [[sudo#Environment variables|pass these environment variables to pacman]].
 +
 
 +
=== How do I reinstall all packages, retaining information on whether something was explicitly installed or as a dependency? ===
 +
 
 +
To reinstall all the native packages: {{ic|<nowiki>pacman -Qnq | pacman -S -</nowiki>}} (the {{ic|-S}} option preserves the installation reason by default).
 +
 
 +
You will then need to reinstall all the foreign packages, which can be listed with {{ic|pacman -Qmq}}.
 +
 
 +
=== "Cannot open shared object file" error ===
 +
 
 +
It looks like previous ''pacman'' transaction removed or corrupted shared libraries needed for pacman itself.
 +
 
 +
To recover from this situation you need to unpack required libraries to your filesystem manually. First find what package contains the missed library and then locate it in the ''pacman'' cache ({{ic|/var/cache/pacman/pkg/}}). Unpack required shared library to the filesystem. This will allow to run ''pacman''.
 +
 
 +
Now you need to [[#Installing specific packages|reinstall]] the broken package. Note that you need to use {{ic|--force}} flag as you just unpacked system files and ''pacman'' does not know about it. ''pacman'' will correctly replace our shared library file with one from package.
 +
 
 +
That's it. Update the rest of the system.
 +
 
 +
=== Freeze of package downloads ===
 +
 
 +
Some issues have been reported regarding network problems that prevent ''pacman'' from updating/synchronizing repositories. [https://bbs.archlinux.org/viewtopic.php?id&#61;68944] [https://bbs.archlinux.org/viewtopic.php?id&#61;65728] When installing Arch Linux natively, these issues have been resolved by replacing the default ''pacman'' file downloader with an alternative (see [[Improve pacman performance]] for more details). When installing Arch Linux as a guest OS in [[VirtualBox]], this issue has also been addressed by using ''Host interface'' instead of ''NAT'' in the machine properties.
 +
 
 +
=== Failed retrieving file 'core.db' from mirror ===
 +
 
 +
If you receive this error message with correct [[mirrors]], try setting a different [[Resolv.conf|name server]].
  
 
== See also ==
 
== See also ==
  
* [[Common Applications/Utilities#Package management]]
+
* [https://www.archlinux.org/pacman/ Pacman's homepage]
 +
* [https://www.archlinux.org/pacman/libalpm.3.html libalpm(3) Manual Page]
 +
* [https://www.archlinux.org/pacman/pacman.8.html pacman(8) Manual Page]
 +
* [https://www.archlinux.org/pacman/pacman.conf.5.html pacman.conf(5) Manual Page]
 +
* [https://www.archlinux.org/pacman/repo-add.8.html repo-add(8) Manual Page]

Latest revision as of 09:34, 16 July 2016

The pacman package manager is one of the major distinguishing features of Arch Linux. It combines a simple binary package format with an easy-to-use build system. The goal of pacman is to make it possible to easily manage packages, whether they are from the official repositories or the user's own builds.

pacman keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows the user to download/install packages with a simple command, complete with all required dependencies.

pacman is written in the C programming language and uses the .pkg.tar.xz package format.

Tip: The pacman package contains other useful tools such as makepkg, pactree, vercmp, and checkupdates. Run pacman -Qlq pacman | grep bin to see the full list.

Contents

Usage

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: pacman 5.0 added some new operations: -F and -D [1]. Compare -F with pkgfile, which is already linked below. (Discuss in Talk:Pacman#)

What follows is just a small sample of the operations that pacman can perform. To read more examples, refer to man pacman.

Tip: For those who have used other Linux distributions before, there is a helpful Pacman Rosetta article.

Installing packages

Note: Packages often have a series of optional dependencies which are packages that provide additional functionality to the application, albeit not strictly required for running it. When installing a package, pacman will list its optional dependencies among the output messages, but they will not be found in pacman.log: use the pacman -Si command to view the optional dependencies of a package, together with short descriptions of their functionality.
Warning: When installing packages in Arch, avoid refreshing the package list without upgrading the system (for example, when a package is no longer found in the official repositories). In practice, do not run pacman -Sy package_name instead of pacman -Syu package_name, as this could lead to dependency issues. See System maintenance#Partial upgrades are unsupported and BBS#89328.

Installing specific packages

To install a single package or list of packages (including dependencies), issue the following command:

# pacman -S package_name1 package_name2 ...

To install a list of packages with regex (see this forum thread):

# pacman -S $(pacman -Ssq package_regex)

Sometimes there are multiple versions of a package in different repositories, e.g. extra and testing. To install the former version, the repository needs to be defined in front:

# pacman -S extra/package_name

To install a number of packages sharing similar patterns in their names -- not the entire group nor all matching packages; eg. plasma:

# pacman -S plasma-{desktop,mediacenter,nm}

Of course, that is not limited and can be expanded to however many levels needed:

# pacman -S plasma-{workspace{,-wallpapers},pa}

Installing package groups

Some packages belong to a group of packages that can all be installed simultaneously. For example, issuing the command:

# pacman -S gnome

will prompt you to select the packages from the gnome group that you wish to install.

Sometimes a package group will contain a large amount of packages, and there may be only a few that you do or do not want to install. Instead of having to enter all the numbers except the ones you do not want, it is sometimes more convenient to select or exclude packages or ranges of packages with the following syntax:

Enter a selection (default=all): 1-10 15

which will select packages 1 through 10 and 15 for installation, or:

Enter a selection (default=all): ^5-8 ^2

which will select all packages except 5 through 8 and 2 for installation.

To see what packages belong to the gnome group, run:

# pacman -Sg gnome

Also visit https://www.archlinux.org/groups/ to see what package groups are available.

Note: If a package in the list is already installed on the system, it will be reinstalled even if it is already up to date. This behavior can be overridden with the --needed option.

Removing packages

To remove a single package, leaving all of its dependencies installed:

# pacman -R package_name

To remove a package and its dependencies which are not required by any other installed package:

# pacman -Rs package_name

To remove a package, its dependencies and all the packages that depend on the target package:

Warning: This operation is recursive, and must be used with care since it can remove many potentially needed packages.
# pacman -Rsc package_name

To remove a package, which is required by another package, without removing the dependent package:

# pacman -Rdd package_name

pacman saves important configuration files when removing certain applications and names them with the extension: .pacsave. To prevent the creation of these backup files use the -n option:

# pacman -Rn package_name
Note: pacman will not remove configurations that the application itself creates (for example "dotfiles" in the home folder).

Upgrading packages

Merge-arrows-2.pngThis article or section is a candidate for merging with System maintenance.Merge-arrows-2.png

Warning: Arch only supports full system upgrades. See System maintenance#Partial upgrades are unsupported and #Installing packages for details.

It is recommended that users upgrade their system regularly. When requesting support from the community, it will usually be assumed that the system is up to date.

Before upgrading, users are expected to visit the Arch Linux home page to check the latest news, or alternatively subscribe to the RSS feed, arch-announce mailing list, or follow @archlinux on Twitter: when updates require out-of-the-ordinary user intervention (more than what can be handled simply by following the instructions given by pacman), an appropriate news post will be made. Users must equally be aware that upgrading packages can raise unexpected problems that could need immediate intervention, therefore it is discouraged to upgrade a stable system shortly before it is required for carrying out an important task: it is wise to wait instead to have enough time in order to be able to deal with possible post-upgrade issues.

pacman can update all packages on the system with just one command. This could take quite a while depending on how up-to-date the system is. This command can synchronize the repository databases and update the system's packages (excluding "local" packages that are not in the configured repositories):

# pacman -Syu

pacman is a powerful package management tool, but it does not attempt to handle all corner cases. Users must be vigilant and take responsibility for maintaining their own system. When performing a system update, it is essential that users read all information output by pacman and use common sense. If a user-modified configuration file needs to be upgraded for a new version of a package, a .pacnew file will be created to avoid overwriting settings modified by the user. pacman will prompt the user to merge them. These files require manual intervention from the user and it is good practice to handle them right after every package upgrade or removal. See Pacnew and Pacsave files for more information.

Tip:
  • Remember that pacman's output is logged in /var/log/pacman.log.
  • You can use a log viewer such as wat-gitAUR to search the pacman logs.

If one encounters problems that cannot be solved by these instructions, make sure to search the forum. It is likely that others have encountered the same problem and have posted instructions for solving it.

Querying package databases

pacman queries the local package database with the -Q flag; see:

$ pacman -Q --help

and queries the sync databases with the -S flag; see:

$ pacman -S --help

pacman can search for packages in the database, searching both in packages' names and descriptions:

$ pacman -Ss string1 string2 ...

Sometimes, -s's builtin ERE can cause a lot of unwanted results, so it has to be limited to match the package name only; not the description nor any other field:

# pacman -Ss '^vim-'

To search for already installed packages:

$ pacman -Qs string1 string2 ...

To display extensive information about a given package:

$ pacman -Si package_name

For locally installed packages:

$ pacman -Qi package_name

Passing two -i flags will also display the list of backup files and their modification states:

$ pacman -Qii package_name

To retrieve a list of the files installed by a package:

$ pacman -Ql package_name

For packages not installed, use pkgfile.

To verify the presence of the files installed by a package:

$ pacman -Qk package_name

Passing the k flag twice will perform a more thorough check.

One can also query the database to know which package a file in the file system belongs to:

$ pacman -Qo /path/to/file_name

To list all packages no longer required as dependencies (orphans):

$ pacman -Qdt

To list all packages explicitly installed and not required as dependencies:

$ pacman -Qet

To list a dependency tree of a package:

$ pactree package_name

To list all the packages recursively depending on an installed package, use whoneeds from pkgtoolsAUR:

$ whoneeds package_name

or the reverse flag to pactree:

$ pactree -r package_name

See pacman tips for more examples.

Database structure

The pacman databases are normally located at /var/lib/pacman/sync. For each repository specified in /etc/pacman.conf there will be a corresponding database file located there. Database files are tar-gzipped archives containing one directory for each package, for example for the which package:

% tree which-2.20-6 
which-2.20-6
|-- depends
`-- desc

The depends file lists the packages this package depends on, while desc has a description of the package such as the file size and the MD5 hash.

Cleaning the package cache

pacman stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically, therefore it is necessary to deliberately clean up that folder periodically to prevent such folder to grow indefinitely in size.

The built-in option to remove all the cached packages that are not currently installed is:

# pacman -Sc
Warning:
  • Only do this when certain that previous package versions are not required, for example for a later downgrade. pacman -Sc only leaves the versions of packages which are currently installed available, older versions would have to be retrieved through other means, such as the Archive.
  • It is possible to empty the cache folder fully with pacman -Scc. In addition to the above, this also prevents from reinstalling a package directly from the cache folder in case of need, thus requiring a new download. It should be avoided unless there is an immediate need for disk space.

Because of the above limitations, consider an alternative for more control over which packages, and how many, are deleted from the cache:

The paccache script, provided by the pacman package itself, deletes all cached versions of each package regardless of whether they're installed or not, except for the most recent 3, by default:

# paccache -r

You can also define how many recent versions you want to keep:

# paccache -rk 1

To remove all cached versions of uninstalled packages, re-run paccache with:

# paccache -ruk0

See paccache -h for more options.

pkgcachecleanAUR and pacleanerAUR are two further alternatives.

Additional commands

Download a package without installing it:

# pacman -Sw package_name

Install a 'local' package that is not from a remote repository (e.g. the package is from the AUR):

# pacman -U /path/to/package/package_name-version.pkg.tar.xz

To keep a copy of the local package in pacman's cache, use:

# pacman -U file:///path/to/package/package_name-version.pkg.tar.xz

Install a 'remote' package (not from a repository stated in pacman's configuration files):

# pacman -U http://www.example.com/repo/example.pkg.tar.xz

To inhibit the -S, -U and -R actions, -p can be used.

pacman always lists packages to be installed or removed and asks for permission before it takes action.

Installation reason

The pacman database distinguishes the installed packages in two groups according to the reason why they were installed:

  • explicitly-installed: the packages that were literally passed to a generic pacman -S or -U command;
  • dependencies: the packages that, despite never (in general) having been passed to a pacman installation command, were implicitly installed because required by another package that was explicitly installed.

When installing a package, it is possible to force its installation reason to dependency with:

# pacman -S --asdeps package_name

When reinstalling a package, though, the current installation reason is preserved by default.

The list of explicitly-installed packages can be shown with pacman -Qe, while the complementary list of dependencies can be shown with pacman -Qd.

To change the installation reason of an already installed package, execute:

# pacman -D --asdeps package_name

Use --asexplicit to do the opposite operation.

Configuration

pacman's settings are located in /etc/pacman.conf: this is the place where the user configures the program to work in the desired manner. In-depth information about the configuration file can be found in man pacman.conf.

General options

General options are in the [options] section. Read the man page or look in the default pacman.conf for information on what can be done here.

Color output

Pacman has a color option. Uncomment the "Color" line in /etc/pacman.conf.

Comparing versions before updating

To see old and new versions of available packages, uncomment the "VerbosePkgLists" line in /etc/pacman.conf. The output of pacman -Syu will be like this:

Package (6)             Old Version  New Version  Net Change  Download Size

extra/libmariadbclient  10.1.9-4     10.1.10-1      0.03 MiB       4.35 MiB
extra/libpng            1.6.19-1     1.6.20-1       0.00 MiB       0.23 MiB
extra/mariadb           10.1.9-4     10.1.10-1      0.26 MiB      13.80 MiB

Skip package from being upgraded

To have a specific package skipped when upgrading the system, specify it as such:

IgnorePkg=linux

For multiple packages use a space-separated list, or use additional IgnorePkg lines. Also, glob patterns can be used. If you want to skip packages just once, you can also use the --ignore option on the command-line - this time with a comma-separated list.

It will still be possible to upgrade the ignored packages using pacman -S: in this case pacman will remind you that the packages have been included in an IgnorePkg statement.

Skip package group from being upgraded

As with packages, skipping a whole package group is also possible:

IgnoreGroup=gnome

Skip files from being installed to system

To always skip installation of specific directories list them under NoExtract. For example, to avoid installation of systemd units use this:

NoExtract=usr/lib/systemd/system/*

Or as a preemptive alternative to localepurgeAUR, to avoid installing non-English localizations:

NoExtract = usr/share/help/* !usr/share/help/en*
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/locales/* opt/google/chrome/locales/*
NoExtract = !*locale*/en* !usr/share/*locale*/locale.alias !usr/share/*locales/i18n !usr/share/*locales/iso* !usr/share/*locales/trans*
NoExtract = usr/share/man/* !usr/share/man/man*
NoExtract = usr/share/vim/vim74/lang/*

Later rules override previous ones, and you can negate a rule by prepending ! — this allows you to keep the locales you need.

Tip: pacman issues warning messages about missing locales when updating a package for which locales have been cleared by localepurge or bleachbit. Commenting the CheckSpace option in pacman.conf suppresses such warnings, but consider that the space-checking functionality will be disabled for all packages.

Maintain several configuration files

If you have several configuration files (e.g. main configuration and configuration with testing repository enabled) and would have to share options between configurations you may use Include option declared in the configuration files, e.g.:

Include = /path/to/common/settings

where /path/to/common/settings file contains the same options for both configurations.

Hooks

pacman can run pre- and post-transaction hooks from the /usr/share/libalpm/hooks/ directory; more directories can be specified with the HookDir option in pacman.conf, which defaults to /etc/pacman.d/hooks. Hook file names must be suffixed with .hook.

For more information on alpm hooks, see alpm-hooks(5)

Repositories and mirrors

Besides the special [options] section, each other [section] in pacman.conf defines a package repository to be used. A repository is a logical collection of packages, which are physically stored on one or more servers: for this reason each server is called a mirror for the repository.

Repositories are distinguished between official and unofficial. The order of repositories in the configuration file matters; repositories listed first will take precedence over those listed later in the file when packages in two repositories have identical names, regardless of version number. In order to use a repository after adding it, you will need to upgrade the whole system first.

Each repository section allows defining the list of its mirrors directly or in a dedicated external file through the Include directive: for example, the mirrors for the official repositories are included from /etc/pacman.d/mirrorlist. See the Mirrors article for mirror configuration.

Package security

pacman supports package signatures, which add an extra layer of security to the packages. The default configuration, SigLevel = Required DatabaseOptional, enables signature verification for all the packages on a global level: this can be overridden by per-repository SigLevel lines. For more details on package signing and signature verification, take a look at pacman-key.

Troubleshooting

"Failed to commit transaction (conflicting files)" error

If you see the following error: [2]

error: could not prepare transaction
error: failed to commit transaction (conflicting files)
package: /path/to/file exists in filesystem
Errors occurred, no packages were upgraded.

Why this is happening: pacman has detected a file conflict, and by design, will not overwrite files for you. This is a design feature, not a flaw.

The problem is usually trivial to solve. A safe way is to first check if another package owns the file (pacman -Qo /path/to/file). If the file is owned by another package, file a bug report. If the file is not owned by another package, rename the file which 'exists in filesystem' and re-issue the update command. If all goes well, the file may then be removed.

If you had installed a program manually without using pacman or a frontend, for example through make install, you have to remove it and all its files and reinstall properly using pacman. See also Pacman tips#Identify files not owned by any package.

Every installed package provides a /var/lib/pacman/local/$package-$version/files file that contains metadata about this package. If this file gets corrupted, is empty or goes missing, it results in file exists in filesystem errors when trying to update the package. Such an error usually concerns only one package. Instead of manually renaming and later removing all the files that belong to the package in question, you may exceptionally run pacman -S --force $package to force pacman to overwrite these files.

Warning: Take care when using the --force switch (for example pacman -Syu --force) as it can cause major problems if used improperly. It is highly recommended to only use this option when the Arch news instructs the user to do so.

"Failed to commit transaction (invalid or corrupted package)" error

Look for .part files (partially downloaded packages) in /var/cache/pacman/pkg and remove them (often caused by usage of a custom XferCommand in pacman.conf).

# find /var/cache/pacman/pkg/ -iname "*.part" -exec rm {} \;

"Failed to init transaction (unable to lock database)" error

When pacman is about to alter the package database, for example installing a package, it creates a lock file at /var/lib/pacman/db.lck. This prevents another instance of pacman from trying to alter the package database at the same time.

If pacman is interrupted while changing the database, this stale lock file can remain. If you are certain that no instances of pacman are running then delete the lock file:

# rm /var/lib/pacman/db.lck

Packages cannot be retrieved on installation

This error manifests as Not found in sync db, Target not found or Failed retrieving file.

Firstly, ensure the package actually exists (and watch out for typos!). If certain the package exists, your package list may be out-of-date or your repositories may be incorrectly configured. Try running pacman -Syyu to force a refresh of all package lists and upgrade.

It could also be that the repository containing the package is not enabled on your system, e.g. the package could be in the multilib repository, but multilib is not enabled in your pacman.conf.

See also FAQ#Why is there only a single version of each shared library in the official repositories?.

Search for a package that contains a specific file

Install pkgfile which uses a separate database with all files and their associated packages.

Manually reinstalling pacman

Warning: It is extremely easy to break your system even worse using this approach. Use this only as a last resort if the method from #pacman crashes during an upgrade is not an option.

Even if pacman is terribly broken, you can fix it manually by downloading the latest packages and extracting them to the correct locations. The rough steps to perform are

  1. Determine dependencies to install
  2. Download each package from a mirror of your choice
  3. Extract each package to root
  4. Reinstall these packages with pacman -Sf to update the package database accordingly
  5. Do a full system upgrade

If you have a healthy Arch system on hand, you can see the full list of dependencies with

$ pacman -Q $(pactree -u pacman)

but you may only need to update a few of them depending on your issue. An example of extracting a package is

# tar -xvpwf package.tar.xz -C / --exclude .PKGINFO --exclude .INSTALL

Note the use of the w flag for interactive mode. Running non-interactively is very risky since you might end up overwriting an important file. Also take care to extract packages in the correct order (i.e. dependencies first). This forum post contains an example of this process where only a couple pacman dependencies are broken.

pacman crashes during an upgrade

In the case that pacman crashes with a "database write" error while removing packages, and reinstalling or upgrading packages fails thereafter, do the following:

  1. Boot using the Arch installation media. Preferably use a recent media so that the pacman version matches/is newer than the system.
  2. Mount the system's root filesystem, e.g. mount /dev/sdaX /mnt as root, and check the mount has sufficient space with df -h
  3. If the system uses default database and directory locations, you can now update the system's pacman database and upgrade it via pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syyu as root.
  4. After the upgrade, one way to double-check for not upgraded but still broken packages: find /mnt/usr/lib -size 0
  5. Followed by a re-install of any still broken package via pacman --root /mnt --cachedir=/mnt/var/cache/pacman/pkg -S package.

"Unable to find root device" error after rebooting

Most likely your initramfs got broken during a kernel update (improper use of pacman's --force option can be a cause). You have two options; first, try the Fallback entry:

Tip: In case you removed this entry for whatever reason, you can always press the Tab key when the bootloader menu shows up (for Syslinux) or e (for GRUB or systemd-boot), rename it initramfs-linux-fallback.img and press Enter or b (depending on your bootloader) to boot with the new parameters.

Once the system starts, run this command (for the stock linux kernel) either from the console or from a terminal to rebuild the initramfs image:

# mkinitcpio -p linux

If that does not work, from a current Arch release (CD/DVD or USB stick), run:

Note: If you do not have a current release or if you only have some other "live" Linux distribution laying around, you can chroot using the old fashioned way. Obviously, there will be more typing than simply running the arch-chroot script.
# mount /dev/sdxY /mnt         # Your root partition.
# mount /dev/sdxZ /mnt/boot    # If you use a separate /boot partition.
# arch-chroot /mnt
# pacman -Syu mkinitcpio systemd linux
Note: If pacman fails with Could not resolve host, please check your internet connection.

Reinstalling the kernel (the linux package) will automatically re-generate the initramfs image with mkinitcpio -p linux. There is no need to do this separately.

Afterwards, it is recommended that you run exit, umount /mnt/{boot,} and reboot.

Note: If you cannot enter the arch-chroot or chroot environment but need to re-install packages you can use the command pacman -r /mnt -Syu foo bar to use pacman on your root partition.

Signature from "User <email@gmail.com>" is unknown trust, installation failed

Follow pacman-key#Resetting all the keys. Or you can try to either:

  • update the known keys, i.e. pacman-key --refresh-keys;
  • or manually upgrade archlinux-keyring package first, i.e. pacman -S archlinux-keyring.

Request on importing PGP keys

If installing Arch with an outdated ISO, you are likely prompted to import PGP keys. Agree to download the key to proceed. If you are unable to add the PGP key successfully, update the keyring or upgrade archlinux-keyring (see above).

Signature from "User <email@archlinux.org>" is invalid, installation failed

When the system time is faulty, signing keys are considered expired (or invalid) and signature checks on packages will fail with the following error:

error: package: signature from "User <email@archlinux.org>" is invalid
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occured, no packages were upgraded.

Make sure to correct the time, for example with ntpd -qg run as root, and run hwclock -w as root before subsequent installations or upgrades.

"Warning: current locale is invalid; using default "C" locale" error

As the error message says, your locale is not correctly configured. See Locale.

pacman does not honor proxy settings

Make sure that the relevant environment variables ($http_proxy, $ftp_proxy etc.) are set up. If you use pacman with sudo, you need to configure sudo to pass these environment variables to pacman.

How do I reinstall all packages, retaining information on whether something was explicitly installed or as a dependency?

To reinstall all the native packages: pacman -Qnq | pacman -S - (the -S option preserves the installation reason by default).

You will then need to reinstall all the foreign packages, which can be listed with pacman -Qmq.

"Cannot open shared object file" error

It looks like previous pacman transaction removed or corrupted shared libraries needed for pacman itself.

To recover from this situation you need to unpack required libraries to your filesystem manually. First find what package contains the missed library and then locate it in the pacman cache (/var/cache/pacman/pkg/). Unpack required shared library to the filesystem. This will allow to run pacman.

Now you need to reinstall the broken package. Note that you need to use --force flag as you just unpacked system files and pacman does not know about it. pacman will correctly replace our shared library file with one from package.

That's it. Update the rest of the system.

Freeze of package downloads

Some issues have been reported regarding network problems that prevent pacman from updating/synchronizing repositories. [3] [4] When installing Arch Linux natively, these issues have been resolved by replacing the default pacman file downloader with an alternative (see Improve pacman performance for more details). When installing Arch Linux as a guest OS in VirtualBox, this issue has also been addressed by using Host interface instead of NAT in the machine properties.

Failed retrieving file 'core.db' from mirror

If you receive this error message with correct mirrors, try setting a different name server.

See also