Difference between revisions of "Archlinux pacman"

From gr0x0rd
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
There is an extensive set of documentation for pacman. This covers a few brief but important things.
 
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==
 
==Installing a package==
Line 5: Line 9:
 
==Removing a package==
 
==Removing a package==
 
  $ sudo pacman -R <package>
 
  $ sudo pacman -R <package>
==Updating the system==
 
$ sudo pacman -Syu
 
 
==Installing a specific package version==
 
==Installing a specific package version==
 
If you have previously installed it
 
If you have previously installed it
 
  $ sudo pacman -U file:///var/cache/pacman/pkg/package-old_version.pkg.tar.type
 
  $ sudo pacman -U file:///var/cache/pacman/pkg/package-old_version.pkg.tar.type
 
To source it from the archives
 
To source it from the archives
  $ sudo pacman -U [https://archive.archlinux.org/packages/ | https://archive.archlinux.org/packages/<prefix>/<package>/<version>]
+
  $ sudo pacman -U [https://archive.archlinux.org/packages/ 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:
 +
<pre>
 +
##                                                                             
 +
## Arch Linux repository mirrorlist                                           
 +
## Generated on <today's date>                                                     
 +
##
 +
Server=https://archive.archlinux.org/repos/YYYY/MM/DD/$repo/os/$arch
 +
</pre>
 +
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

Latest revision as of 10:24, 2 December 2022

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