Pacman package manager cheatsheet
Pacman notes
Cheatsheet
| Usage | Command |
|---|---|
| Package upgrade | pacman -Syu |
| Sync package DB | pacman -Sy |
| Search package | pacman -Ss package_name |
| Install package | pacman -S package_name |
| Remove package and unused dependencies | pacman -Rs package_name |
| List installed packages | pacman -Qeq |
| Search installed package | pacman -Qs package_name |
- Always do
pacman -Syubefore you install packagesTips and notes
- https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks
yy v.s. y
Passing two –refresh or -y flags will force a refresh of all package lists even if they appear to be up to date.
Unknown public key
|
|
gpg --recv-keys F54984BFA16C640F.- https://wiki.archlinux.org/index.php/Makepkg#Signature_checking
Signature from is unknown trust
|
|
other possible fixes:
https://stackoverflow.com/a/35256655/3973896
123pacman -S archlinux-keyringpacman-key --populatepacman -Suhttps://forum.antergos.com/post/46752
12345wget https://git.archlinux.org/archlinux-keyring.git/snapshot/archlinux-keyring-20171213.tar.xzpacman -U antergos-keyring-20170524-1-any.pkg.tar.xzsudo pacman -Sccsudo pacman-key --refresh-keyssudo pacman -Syu- get the latest keyring at https://git.archlinux.org/archlinux-keyring.git/
Disable packages that are blocking update
- For example, I was getting this error for pkgbuilder author’s key
Re-assign key also failed
123$ sudo pacman-key -r 5EAAEA16gpg: keyserver receive failed: No data==> ERROR: Remote key not fetched correctly from keyserver.The kiyring is outdated but pacman upgrades are blocked by this key
- The only workaround at this point is to disable upgrading pkgbuilder
sudo /etc/pacman.conf, editIgnorePkgto include pkgbuilder:1IgnorePkg = fakeroot,pkgbuilderand comment out pkgbuilder repository:
12[pkgbuilder]Server = https://pkgbuilder-repo.chriswarrick.com/after the upgrade, revert pkgbuilder
- then
sudo pacman-key --refresh-keysshould fix the issue- or follow their README to resign the key
The requested URL returned error: 404
|
|
This is usually happened because the local database is outdated, so pacman is not aware of new version and trying to pull a old version package (which is not available anymore). The python2-requests package, at the time of writing, is actually on 2.19.1-1.
Do pacman -Syu or pacman -Syyu should fix the error.
If the problem exists, it could also be that the server mirror you’re using is outdated, try edit /etc/pacman.d/mirrorlist and disable (comment out) top servers:
- /etc/pacman.d/mirrorlist123## WorldwideServer = http://mirrors.evowise.com/archlinux/$repo/os/$arch#Server = http://mirror.rackspace.com/archlinux/$repo/os/$arch
add # to comment out the first server and try again, for me it was the worldwide server that is outdated.
lib32 packages
- Required by some 32bit applications, or when you want to build 32bit applications from gcc.
- NOT RECOMMAND unless required by other packages, see below error note
uncomment the following in
/etc/pacman.conf:12[multilib]Include = /etc/pacman.d/mirrorlistgcc-multilibpackages will replace gcc packages when installed. (I don’t think they can coexist)
breaks dependency error when doing pacman installs
|
|
- At the time of writing, this is because gcc has upgraded to 7.2.1 while gcc-multilib is still on 7.2.0-3. Since I’m not using gcc-multilib anymore I just revert back to gcc by doing
pacman -S gcc - https://forum.manjaro.org/t/cannot-apply-the-latest-update-due-to-dependency-conflict/25283/9
Cleanup
- Remove unused dependencies:
sudo pacman -Rns $(pacman -Qtdq)
3rd party AUR package manager
add the following to
/etc/pacman.conf12[pkgbuilder]Server = https://pkgbuilder-repo.chriswarrick.com/Run
123pacman-key -r 5EAAEA16pacman-key --lsign 5EAAEA16pacman -Syyu pkgbuilderbasically the usage is the same as
pacman, for examplepkgbuilder -S package_nameandpkgbuilder -Syu
Build AUR packages manually
You need to install base-devel package for building packages
|
|
- For step 1, you can also download PKGBUILD file manually from AUR pages if you don’t want to use AUR package manager.
- Use
makepkg -RdLffor a “re-package”. Re-packaging is useful when the process failed in package() and you don’t want to run the long build part again.