Pacman usage

From wikinotes

Key Management

pacman-key --init
pacman-key --populate archlinux
pacman-key --refresh-keys
pacman -S archlinux-keyring  # arch's official keys

Package Management

Basics

installing packages

pacman -Ss <pkg>            # search
pacman -Qo /bin/netstat     # search package containing this file

pacman -S  <pkg>            # install
pacman -Rs <pkg>            # uninstall with dependencies
pacman -Rsc <pkg>           # uninstall with dependencies, and packages that require this package
pacman -Rsd --nodeps <pkg>  # uninstall, allowing broken deps (useful for removing video driver)

updates

pacman -Syy          # refresh package index
pacman -Syu          # update all

maintenance

pacman -Si <pkg>                 # info
pacman -Q                        # list of all installed packages
pacman -Qi <pkg> | grep Required # list packages depending on this package
pacman -Qtd --color=never | awk '{ print $1 }' | xargs sudo pacman -Rsd  # remove orphan packages
pacman -Sc                       # remove old packages from pkg-cache  (MAKE SURE CleanMethod=KeepInstalled IN /ETC/PACMAN.CONF (default))

Downloading old Packages

Archlinux

Manual Downloads

Find the package you'd like to downgrade to here https://archive.archlinux.org/packages/.

Ex:

firefox https://archive.archlinux.org/packages   ## find url to package

pacman -U \
    https://archive.archlinux.org/packages/l/linux/linux-4.15.3-2-x86_64.pkg.tar.xz \
    https://archive.archlinux.org/packages/l/linux-headers-4.15.3-2-x86_64.pkg.tar.xz


WARNING:

Occasionally, you might need to install something to satisfy a current AUR package. But installing the core package will break the existing AUR package dependencies.

You have 2x options:

pacaur -S zfs-linux spl-linux -U https://...  https://..

Freeze Repo/Mirrorlist to Date

You can now configure your repo to download packages as of a specific date!
configure either

/etc/pacman.conf


# /etc/pacman.conf

[core]
SigLevel = PackageRequired
Server=https://archive.archlinux.org/repos/2014/03/30/$repo/os/$arch

[extra]
SigLevel = PackageRequired
Server=https://archive.archlinux.org/repos/2014/03/30/$repo/os/$arch

[community]
SigLevel = PackageRequired
Server=https://archive.archlinux.org/repos/2014/03/30/$repo/os/$arch


/etc/pacman.d/mirrorlist

# /etc/pacman.d/mirrorlist

Server=https://archive.archlinux.org/repos/2014/03/30/$repo/os/$arch

then replace all installed packages

pacman -Syyuu

Archlinux-Arm

# find cpu arch
uname -a

# download package for your arch
http://tardis.tiny-vps.com/aarm/packages/f/firefox/firefox-79.0.1-aarch64.tar.xz

# install
pacman -U firefox-79.0.1-aarch64.tar.xz

Configuration Management

pacman-conf  # print current pacman config (incl. all source pacman.d entries)