Archlinux Pacman Command
Archlinux Pacman Command
pacmanis the package manager of Archlinux. It combines a set of binary tools with a system
relatively simple to build packages. (seemakepkgandABSThe aim is to easily manage the packages,
whether they come from official repositories or are compiled by the user.
pacman allows you to keep your system up to date by synchronizing the package list from a server and then
download/install the new packages, as well as their dependencies, with a simple command.
Configuration
Pacman is configured using the file /etc/pacman.conf (cf.man 5 pacman.conf).
Global options
These options are configured under the [options] section, some examples:
Architecture: if it is defined, pacman will only install packages of this architecture. It can take the
auto value (the architecture will be defined by a call touname -m). It also allows the use of the
variable$archin theURIof adeposit.
IgnorePkg: indicates to pacman the packages not to update.
IgnoreGroup: indicates to pacman the groups to not update.
UseDelta: this option does not take any parameters and allows the user to indicate to download the deltas
packages if they are available. (cf.Use of deltas)
SigLevel: Indicate topacmanhow to manage signatures:pacman-key
Color: the output of pacman in the console will be colored.
Indicate topacmannot to extract certain files (e.g.Prevent the installation of locales)
Deposits
The syntax is simple:
[name_of_the_deposit]
Server=mirror1_of_the_repository
Server=mirror2_of_the_depot
Note: Regarding the indicated URL, pacman automatically replaces $repo with the name of the repository.
Note: The Include directive allows including another file in the configuration; in practice, the content of the file
cf.Deposit details.
Usage
Note: Since Archlinux is a rolling release, updating the system may require action.
manual unlike regular release distributions, it is therefore important to follow certain rules of
bases :
read thenewsOn the homepage, updates requiring particular action are usually the subject of
of an article.
know how to recognize critical packages and, depending on skills, maybe wait a minimum of time before
For a complete description, please refer to the man page:pacman(8)Some options need to be taken
with great caution, consultthese a few tipsto use pacman optimally.
pacman -Sy
Package installation
Installation of a package list:
If the package exists in several repositories, one can possibly specify one:
pacman -S extra/package
pacman -U package_archive.pkg.tar.xz
pacman -UThe provided text is a URL and does not contain translatable content.
For the installation of a list of packages from a text file (one package per line):
Package updates
Update following a previously performed synchronization:
pacman -Su
Packet suppression
pacman -R package_1
To keep a system clean, it is also necessary to remove dependencies that are no longer required by any package:
By default, modified configuration files are saved with the .pacsave extension. To not...
to conserve
Note: Pacman does not touch personal directories; it is the user's responsibility to handle all files.
Research
For quick assistance:
pacman -Q --help
pacman -S --help
pacman -R --help
community/metacity 3.14.1-1
Complete information about an installed package (for example, to check if some optional dependencies
can provide you with additional features):
Tip: with-QiiYou can know the possible backup files of a package and their status.
with-Qii|grep ^MODIFIEDyou can know all backup files modified compared to those
of origin.
Tip:pkgfileallows you to search for a file in the not installed packages, or to list the files of a
pacman -Qm
List of packages (dependencies) that are no longer required by the system (the package that caused their installation is no longer
present)
pacman -Qdt
Attention: List the packages that are not explicitly installed and that no other package depends on, but this does not
doesn't necessarily mean that you don't use them. For example, you install a package that depends on dezip, this
last installs, one day, he no longer depends on it, zip will become not required by the system, but you may still use it.
Downgrade packages
It is sometimes necessary to temporarily revert to the previous version of a package (regression, bug), different
existing means:Downgrade.
The following pacman command removes all non-installed packages from the cache (old versions or not.
installed on the system)
pacman -Sc
Attention :
Only run this command if you are sure that the installed packages are stable on your system and
that onedowngradewill not be necessary. This will remove all the old versions of the packages by not
leaving only the last installed versions. It may be useful to keep the old versions of the packages.
cases where an update would make the system unstable or inoperable.Murphy's Law always applying in this
This happens just after a complete cache clearing. If all the old packages have been removed from
cache, the only way to recover them is to go through an alternative repository likeArch Rollback Machine.
It is also possible to completely clear the cache using the command pacman -Scc. This prevents any
Reinstallation of packages from the cache requires them to be downloaded again, which is not a problem.
thanks toArch Rollback MachineSo quite useful in order to recover disk space.
Due to all the restrictions stated above, it is recommended to use a dedicated cache cleaning script.
from pacman, in order to more finely control the packages to be removed:
The commandpaccache, provided with the packagepacman-contrib, delete by default all packages from the cache except
the three latest versions:
paccache -r
However, it will not verify if the packages are still installed on the system and will therefore leave the packages.
not installed in the cache. To remove from the cache all versions of the non-installed packages, you must run
the following command at a later time:
paccache -ruk0
You can also install and use the alternative scripts:pkgcacheclean(written in C)...
pkgcacheclean
pacleaner -m
pacleaner -u
pacleaner -m --delete
pacleaner -u --delete
In bulk
Download packages only:
pacman -Sw package_1 package_2
options
ILoveCandy
You will subsequently obtain a Pacman output similar to the game of the same name when you set up your system
up to date.
None of the files listed in the NoExtract option rules are extracted during the installation of a package.
pattern* is allowed to designate a set of files (as one would do in a shell). By
example /usr/lib/systemd/system/* designates all the files in the folder/usr/lib/systemd/system/thus
that in its subfolders. It is possible to reverse the behavior of a rule by prefixing it with a !. This cancels
the previous rules regarding the corresponding files.
So, if we want to do without all the locales except for the Francophone ones, we obtain the following rules to add
in the section [options] ofpacman.conf.
/etc/pacman.conf file
NoExtract = usr/share/locale/[a-z]*/*
!usr/share/locale/fr/*
!usr/share/locale/fr_FR/*
The rules can also be indicated on a single line.
Note: Adding these lines does not make the files disappear until the packages containing them are updated.
day.
However, it is possible to delete them directly with, for example, the following command:find
Only the package name is required. This allows us to obtain the Pkgbuild after which we can enter the command.
next to retrieve the sources:
makepkg -S
Problems
Pacman crash during an update
In the event that pacman crashes during an update, package removal, or even a reinstallation of a
package, you will need to complete these different steps:
A package has been updated but pacman says the system is up to date
The Pacman mirrors are not directly synchronized. It takes about 24 hours before you can
to receive the much-desired update.
If you are very comfortable with Pacman but cannot manage to use other package managers...
mainpacaptis a solution.