Pacman

From Segfault
Jump to navigation Jump to search

Usage

Install a package:

pacman -S less

Install a package, but don't re-install already existing packages:

pacman -S --needed less cowsay

Update the whole system:

pacman -Syvu                              # --sync --refresh --verbose --sysupgrade

After updating the system (and maybe checking the Arch Linux News), be sure to examine new configuration file versions:

find /etc/ -name "*.pacnew"

Or, to diff each file to its old version:

find /etc/ -name "*.pacnew" | while read f; do echo "### $f"; diff -u ${f%%.pacnew} ${f}; echo; done

Downgrade a specific package:

$ ls -1tr /var/cache/pacman/pkg/tar*.zst
/var/cache/pacman/pkg/tar-1.35-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/tar-1.35-2-x86_64.pkg.tar.zst

$ pacman -U /var/cache/pacman/pkg/tar-1.35-1-x86_64.pkg.tar.zst

Troubleshooting

Sometimes packages break and we should consult the news to see if it's a known issue.

If there's a problem with the package signature, we could try to update the keyring:

pacman -Sy archlinux-keyring

If needed, we could clear out the package cache, remove unused repositories and try again:

pacman -Scc                               # --sync --clean --clean

Advanced Rollback if something goes wrong:[1]

  1. Point /etc/pacman.d/mirrorlist to an archive point:
    Server=https://archive.archlinux.org/repos/2023/10/10/$repo/os/$arch
  2. Execute the rollback with pacman -Syyuu resp. pacman -Syy packagename
  3. Pin pacakges afterwards in /etc/pacman.conf
    IgnorePkg = php php-apcu php-fpm php-gd php-igbinary [...]
  4. Restore the original mirrorlist

Links

References