Archlinux pacman

From gr0x0rd
Jump to navigation Jump to search

There is an extensive set of documentation for pacman. This covers a few brief but important things.

Updating the system

$ sudo pacman -Syu

Performing this weekly ensures a secure and stable system.

Installing a package

$ sudo pacman -S <package>

Removing a package

$ sudo pacman -R <package>

Installing a specific package version

If you have previously installed it

$ sudo pacman -U file:///var/cache/pacman/pkg/package-old_version.pkg.tar.type

To source it from the archives

$ sudo pacman -U https://archive.archlinux.org/packages/<prefix>/<package>/<version>

Rollback to a specific date

Back up the current mirror list

$ sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.<date>

Create a new one that mirrors the desired date

$ sudo nano /etc/pacman.d/mirrorlist 

Paste the desired date into the file where YYYY/MM/DD is desired rollback year/month/day:

##                                                                              
## Arch Linux repository mirrorlist                                             
## Generated on <today's date>                                                      
##
Server=https://archive.archlinux.org/repos/YYYY/MM/DD/$repo/os/$arch

Save the file and then

$ sudo pacman -Syyuu

If successful, don't forget to revert the old file.

Clear the cache

If you are running out of disk space, you can clear all the archived packages from /var/lib/pacman .

$ sudo pacman -Sc

To remove all packages

$ pacman -Scc

PGP key errors

If a package cannot be upgraded or a system update fails due to an invalid package, PGP error or key signature, for example

corrupted (invalid or corrupted package (PGP signature) 

Try upgrading the archlinux keyring first:

$ pacman -Sy archlinux-keyring

If that fails, try the following:

$ killall gpg-agent
$ sudo rm -rf /etc/pacman.d/gnupg
$ sudo pacman-key --init
$ sudo pacman-key --populate archlinux