mirror of
https://github.com/tiyn/wiki.git
synced 2025-11-19 10:19:45 +01:00
linux: split package managers in multiple entries
This commit is contained in:
@@ -26,10 +26,10 @@ betterdiscordctl self-upgrade
|
||||
### Pacman Hook
|
||||
|
||||
When using [Arch Linux](/wiki/linux/arch-linux.md) and its package managers
|
||||
[Pacman and Yay](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay) a hook can be set that
|
||||
[Pacman and Yay](/wiki/linux/package_manager/pacman_and_aur.md) a hook can be set that
|
||||
automatically updates the discord installation to setup betterdiscord using betterdiscordctl.
|
||||
The following is a [pacman hook](/wiki/linux/package_manager.md#hooks) that can be used to update
|
||||
betterdiscord automatically.
|
||||
The following is a [pacman hook](/wiki/linux/package_manager/pacman_and_aur.md#hooks) that can be
|
||||
used to update betterdiscord automatically.
|
||||
Make sure to change the three occurences of `<username>` to the name of the user to install
|
||||
betterdiscord for.
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ The Steam software suite is available on [Linux](/wiki/linux.md) and [Windows](/
|
||||
systems.
|
||||
For Linux-based operating systems there often exists a package named `steam`.
|
||||
For [Arch Linux](/wiki/linux/arch-linux.md) the
|
||||
[multilib repository](/wiki/linux/package_manager.md#enabling-multilib) needs to be enabled.
|
||||
[multilib repository](/wiki/linux/package_manager/pacman_and_aur.md#enabling-multilib) needs to be
|
||||
enabled.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ It places files or directories in an archive and is able to compress them.
|
||||
|
||||
7-zip can be installed by installing the packages `p7zip-full` and `p7zip-rar` on Ubuntu systems.
|
||||
On [Arch Linux](/wiki/linux/arch-linux.md) it can be installed with the package `7-zip`
|
||||
from the [AUR](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay).
|
||||
from the [AUR](/wiki/linux/package_manager/pacman_and_aur.md).
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
[Arch Linux](https://archlinux.org/) is a rolling-release, general-purpose
|
||||
[Linux](/wiki/linux.md)
|
||||
distribution.
|
||||
The package manager of Arch Linux is generally
|
||||
[Pacman and various possible AUR ones](/wiki/linux/package_manager/pacman_and_aur.md).
|
||||
|
||||
## Package Manager and AUR
|
||||
|
||||
Arch Linux uses the
|
||||
[pacman](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay) package
|
||||
[pacman](/wiki/linux/package_manager/pacman_and_aur.md) package
|
||||
manager.
|
||||
An additional repository for user made software exists.
|
||||
It is called Arch User Repository (AUR).
|
||||
The Arch User Repositories (AUR) features community-made packages that can be
|
||||
installed with different
|
||||
[package manager for that purpose](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay).
|
||||
[package manager for that purpose](/wiki/linux/package_manager/pacman_and_aur.md).
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ en_US.UTF-8 UTF-8
|
||||
In [Arch Linux](/wiki/linux/arch-linux.md) 32-bit software is managed via the `multilib`
|
||||
repository, which is for example needed for the `steam` package.
|
||||
Due to it not being enabled by default, this has to be
|
||||
[done manually](/wiki/linux/package_manager.md#enabling-multilib).
|
||||
[done manually](/wiki/linux/package_manager/pacman_and_aur.md#enabling-multilib).
|
||||
For this navigate to `/etc/pacman.conf` and find and uncomment the following lines.
|
||||
|
||||
```txt
|
||||
@@ -244,7 +244,7 @@ should be checked for further setups.
|
||||
|
||||
In some cases the Arch keyring needs to be repopulated.
|
||||
This is discussed in
|
||||
[the package manager entry](/wiki/linux/package_manager.md#error-during-updating-is-marginal-trust).
|
||||
[the package manager entry](/wiki/linux/package_manager/pacman_and_aur.md#error-during-updating-is-marginal-trust).
|
||||
|
||||
Additionally if you have a NVidia Graphics Cards you should read
|
||||
[the NVidia article](../nvidia.md) too.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Debian
|
||||
|
||||
[Debian](https://www.debian.org/) is a free and open-source [Linux](/wiki/linux.md) distribution.
|
||||
Debian uses the [APT](/wiki/linux/package_manager/apt.md) package manager.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -28,7 +29,7 @@ apt-mark hold docker-ce docker-ce-cli containerd.io
|
||||
The first step for a major upgrade usually is
|
||||
[retrieving the current version](#retrieve-debian-version).
|
||||
Afterward the packages of the current major release version have to be
|
||||
[upgrading](/wiki/linux/package_manager.md#debian-updating-upgrading) using APTs `full-upgrade`
|
||||
[upgrading](/wiki/linux/package_manager/apt.md#updating-upgrading) using APTs `full-upgrade`
|
||||
option.
|
||||
Then a reboot is recommended.
|
||||
|
||||
@@ -43,7 +44,7 @@ deb http://deb.debian.org/debian bookworm-updates main contrib non-free
|
||||
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
|
||||
```
|
||||
|
||||
Following this a [full upgrade](/wiki/linux/package_manager.md#debian-updating-upgrading) has to be
|
||||
Following this a [full upgrade](/wiki/linux/package_manager/apt.md#updating-upgrading) has to be
|
||||
performed.
|
||||
Sometimes this process asks if the user wants to replace the local configuration files with newer
|
||||
ones.
|
||||
|
||||
@@ -143,7 +143,7 @@ There are various files that are unused but saved by default.
|
||||
The following list shows some options to quickly clean up space.
|
||||
|
||||
- [System Trash](#clearing-system-trash-bin)
|
||||
- [Arch Linux/Pacman/Yay Cache](/wiki/linux/package_manager.md#clear-cache)
|
||||
- [Package Mangers](/wiki/linux/package_manager.md)
|
||||
- [ViFM Trash Bin](/wiki/linux/vifm.md#empty-trash)
|
||||
|
||||
## Error solving
|
||||
|
||||
@@ -5,8 +5,8 @@ linux systems.
|
||||
|
||||
## Setup
|
||||
|
||||
The `flatpak` package can be installed by most distribution specific package
|
||||
managers (e.g. [pacman or yay](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay)).
|
||||
The `flatpak` package can be installed by most distribution specific
|
||||
[package managers](/wiki/linux/package_manager.md)).
|
||||
After installation it is important to add [flathub](https://flathub.org/home),
|
||||
a source for many Flatpak packages.
|
||||
The addition of this can be done by running
|
||||
|
||||
@@ -2,364 +2,10 @@
|
||||
|
||||
Package managers are important programs to get software onto your system.
|
||||
|
||||
## Debian & Debian-Based Systems: APT
|
||||
The following is a list of package managers and the corresponding [Linux](/wiki/linux.md)
|
||||
distributions.
|
||||
|
||||
In [Debian](/wiki/linux/debian.md) the APT package manager is used.
|
||||
It is also used for various Debian-based distributions.
|
||||
|
||||
### Debian: Usage
|
||||
|
||||
This section addresses various usages of the APT package manager.
|
||||
|
||||
#### Debian: Updating & Upgrading
|
||||
|
||||
This section addresses the updating of all packages managed by APT.
|
||||
To update the packages it is recommended to first update the package list with the following
|
||||
command.
|
||||
|
||||
```sh
|
||||
apt update
|
||||
```
|
||||
|
||||
Afterwards there are two possible update types without changing the major release version.
|
||||
|
||||
The following command - `upgrade` - updates the packages only if no new or previously removed dependencies are
|
||||
needed.
|
||||
It is generally used for day-to-day updating without bigger jumps between versions.
|
||||
|
||||
```sh
|
||||
apt upgrade
|
||||
```
|
||||
|
||||
The other option is `full-upgrade` which was previously also known as `dist-upgrade`.
|
||||
This command will also install, remove and replace dependencies if it is needed to update the
|
||||
package.
|
||||
It is mostly used for bigger updates like Kernel or release upgrade without changing the major
|
||||
version.
|
||||
|
||||
```sh
|
||||
apt full-upgrade
|
||||
```
|
||||
|
||||
## Arch Linux: Pacman and Yay
|
||||
|
||||
In [Arch Linux](/wiki/linux/arch-linux.md) there are 2 main types of
|
||||
package managers.
|
||||
The first is pacman, the default package manager.
|
||||
|
||||
For the second type there are many different managers to chose from.
|
||||
Those managers are handling for the Arch User Repositories (AUR).
|
||||
In this article yay is used as the go to AUR manager.
|
||||
yay is also a wrapper for pacman so yay can be used instead of pacman to
|
||||
install and update both AUR and main repository programs.
|
||||
It features the same syntax.
|
||||
|
||||
### Usage
|
||||
|
||||
This section addresses various usages of the arch linux package managers.
|
||||
|
||||
#### Ignoring Packages
|
||||
|
||||
Packages can be ignored by adding the package in `/etc/pacman.conf` under `IgnorePkg`.
|
||||
In the following example `waybar` is ignored from updates.
|
||||
To add more packages just add them separated by spaces.
|
||||
|
||||
```txt
|
||||
IgnorePkg = waybar
|
||||
```
|
||||
|
||||
To unignore the package from updates remove it from this line.
|
||||
|
||||
#### Downgrading Packages
|
||||
|
||||
Packages of the AUR can be downgraded by using the
|
||||
[Downgrade](https://github.com/archlinux-downgrade/downgrade) program.
|
||||
This program can then easily be used to an AUR package.
|
||||
This works like the following assuming the package `v4l2loopback-dmks` needs to be downgraded.
|
||||
|
||||
```sh
|
||||
sudo downgrade v4l2loopback-dmks
|
||||
```
|
||||
|
||||
Afterwards the target version can be selected and the downgrading process will conclude.
|
||||
After the downgrade of a package you will get asked if you want to
|
||||
[ignore future updates](#ignoring-packages).
|
||||
|
||||
#### Manual Installation of a `PKGBUILD` File
|
||||
|
||||
A `PKGBUILD` file is a [shell](/wiki/linux/shell.md) script that contains the installation
|
||||
information that is required by the Arch Linux.
|
||||
Using the `makepkg` command it can be installed like the following command shows.
|
||||
|
||||
```sh
|
||||
makepkg -sirc
|
||||
```
|
||||
|
||||
Afterwards it is installed on the system and can be further managed (especially uninstalled) by the
|
||||
Pacman package manager.
|
||||
|
||||
#### Installing an AUR Program with a Specific Version
|
||||
|
||||
The installation of a specific version of an AUR program can be easily achieved.
|
||||
For this navigate to the AUR page of the program to install.
|
||||
On the right-hand side click on `View Changes` and select the version you want to install in the
|
||||
commit list.
|
||||
Next to `download` a `.tar.gz` file can be downloaded which includes a `PKGBUILD` file.
|
||||
Afterwards it needs to be [uncompressed](/wiki/linux/tar.md#uncompressing-a-tar-archive).
|
||||
|
||||
#### Clear Cache
|
||||
|
||||
The cache of all packages except the one installed can be deleted by running the following command.
|
||||
|
||||
```sh
|
||||
pacman -Sc
|
||||
```
|
||||
|
||||
Alternatively the pacman cache can be deleted partly by running the following command which will
|
||||
clear the cache of pacman except for the latest version.
|
||||
The amount of versions to keep can be specified by changing the number in the following command
|
||||
accordingly.
|
||||
|
||||
```sh
|
||||
paccache -rvk1
|
||||
```
|
||||
|
||||
And finally the following command will remove all cached files that belong to uninstalled packages.
|
||||
Again the number can be changed to keep a specific number of versions.
|
||||
|
||||
```sh
|
||||
paccache -rvuk0
|
||||
```
|
||||
|
||||
Since `yay` mirrors the usage of `pacman` it can be used the same way and will clean both caches.
|
||||
|
||||
```sh
|
||||
yay -Sc
|
||||
```
|
||||
|
||||
Similar to `paccache` a command called [yaycache](https://github.com/aokellermann/yaycache) can be
|
||||
used.
|
||||
It follows the same options as `paccache`.
|
||||
|
||||
The clearing of the cache can be automated by using a [hook](#hook-clear-cache).
|
||||
|
||||
#### Enabling `multilib`
|
||||
|
||||
`multilib` is a repository that contains 32-bit software and libraries.
|
||||
By default it is not enabled.
|
||||
To enable it search and uncomment the following lines in the file `/etc/pacman.conf`.
|
||||
|
||||
```txt
|
||||
[multilib]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
```
|
||||
|
||||
#### Hooks
|
||||
|
||||
Hooks are commands that are run before or after installation of one or more packages.
|
||||
They are needed to have the `.hook` extension and can be found inside two directories.
|
||||
The first one is `/usr/share/libalpm/hooks/`.
|
||||
The second one is defined in `HookDir` inside the file `/etc/pacman.conf`.
|
||||
By default it points towards `/etc/pacman.d/hooks`.
|
||||
|
||||
Examples of hooks can be found in the following sections.
|
||||
|
||||
##### Hook: List Orphans
|
||||
|
||||
The following hook will display orphans after any package is update.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references a
|
||||
[gist by Strykar](https://gist.github.com/Strykar/3b3cd5bbdabe7e5c77f9414b2b4fe7e8).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Operation = Remove
|
||||
Type = Package
|
||||
Target = *
|
||||
|
||||
[Action]
|
||||
Description = Searching for orphaned packages...
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/bash -c "/usr/bin/pacman -Qtd || /usr/bin/echo '==> no orphans found.'"
|
||||
```
|
||||
|
||||
##### Hook: Clear Cache
|
||||
|
||||
The following hook will [clear the pacman cache](#clear-cache) except for the last version of a package.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references an
|
||||
[AUR comment by itaranto](https://aur.archlinux.org/packages/pacman-cleanup-hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Remove
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Target = *
|
||||
|
||||
[Action]
|
||||
Description = Removing unnecessary cached files (keeping the latest one)...
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/paccache -rvk1 && paccache -ruvk0
|
||||
```
|
||||
|
||||
##### Hook: Informant
|
||||
|
||||
The following hook will use [informant](https://github.com/bradford-smith94/informant) to check for
|
||||
Arch News that may require manual intervention and not allow the update if there are news unread.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references the
|
||||
[informant Github](https://github.com/bradford-smith94/informant/blob/master/informant.hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = *
|
||||
Target = !informant
|
||||
|
||||
[Action]
|
||||
Description = Checking Arch News with Informant...
|
||||
When = PreTransaction
|
||||
Exec = /usr/bin/informant check
|
||||
Depends = informant
|
||||
AbortOnFail
|
||||
```
|
||||
|
||||
##### Hook: Update Package Mirrorlist
|
||||
|
||||
The following hook will use [reflector](https://xyne.dev/projects/reflector/) to update the pacman
|
||||
mirrorlist.
|
||||
It will use german mirrors (`-c de`), will list the fastest 15 mirrors (`-n 15`) and only do so if
|
||||
the mirror was online in the last 24 hours (`-a 24`).
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references the
|
||||
[pacman-hooks Github](https://github.com/desbma/pacman-hooks/blob/master/reflector/reflector.hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = pacman-mirrorlist
|
||||
|
||||
[Action]
|
||||
Description = Updating pacman-mirrorlist with reflector...
|
||||
When = PostTransaction
|
||||
Depends = reflector
|
||||
Exec = /bin/bash -c 'reflector -c de -n 15 -a 24 > /etc/pacman.d/mirrorlist ; test -f /etc/pacman.d/mirrorlist.pacnew && mv -v /etc/pacman.d/mirrorlist.{pacnew,orig} || true'
|
||||
```
|
||||
|
||||
##### Hook: Kernel Reboot Needed
|
||||
|
||||
The following hook will use determine if a reboot is needed because the kernel was updated.
|
||||
It was found in a
|
||||
[reddit commend by progandy](https://www.reddit.com/r/archlinux/comments/dsnu81/comment/f6sogat).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Operation = Remove
|
||||
Type = File
|
||||
Target = usr/lib/modules/*
|
||||
|
||||
[Action]
|
||||
Description = Check for upgrade of running kernel...
|
||||
When = PostTransaction
|
||||
Exec = /bin/bash -c "[[ -f \"/proc/modules\" && ! -d \"/usr/lib/modules/$(uname -r)\" ]] && printf '==> WARNING: %s\n -> %s\n' 'Running kernel has been updated or removed!' 'A reboot is required!' || true"
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
This section will focus on errors and the fixing of errors of package managers.
|
||||
|
||||
#### `/usr/lib/firmware/nvidia/ad104` exists in filesystem linux-firmware-nvidia
|
||||
|
||||
This error comes from a decision to split the firmware modules into different parts.
|
||||
An easy way to fix it is by simply reinstalling the `linux-firmware` package and updating the
|
||||
packages of the system.
|
||||
|
||||
```sh
|
||||
pacman -Syu linux-firmware
|
||||
```
|
||||
|
||||
#### Update Mirrorlist
|
||||
|
||||
After a while not updating the system it is possible for the mirrorlist to be
|
||||
outdated.
|
||||
This can be fixed by updating it with the following command:
|
||||
|
||||
```sh
|
||||
curl -o /etc/pacman.d/mirrorlist https://archlinux.org/mirrorlist/all/
|
||||
```
|
||||
|
||||
#### Error While Importing Keys
|
||||
|
||||
Both `yay` and `pacman` use [GPG keys](/wiki/linux/gpg.md).
|
||||
It is possible that it runs into errors when importing new keys.
|
||||
If this happens you should try to restart the GPG key server
|
||||
[as explained in the GPG entry](/wiki/linux/gpg.md#restart-the-gpg-server).
|
||||
|
||||
#### Unknown Public Key
|
||||
|
||||
If the error `ERROR: One or more PGP signatures could not be verified!`, you
|
||||
have to manually receive the key and trust it.
|
||||
This can be done [as explained in the GPG entry](/wiki/linux/gpg.md#receive-a-key-and-trust-it).
|
||||
|
||||
The identifier of the key usually gets gets printed in the line above the error looking like
|
||||
`FAILED (unknown public key <KEYID>)`.
|
||||
|
||||
#### Error During Updating `is marginal trust`
|
||||
|
||||
If the error `[...] Key [...] is marginal trust` (also `of unknown trust`) occurs while updating
|
||||
the system, it can be fixed by running the following commands and then restarting
|
||||
the update process of the package manager.
|
||||
|
||||
```sh
|
||||
pacman -Sy archlinux-keyring
|
||||
pacman-key --populate archlinux
|
||||
pacman-key --refresh-keys
|
||||
```
|
||||
|
||||
#### Error During Updating `the following untracked working tree files would be overwritten`
|
||||
|
||||
The error `the following untracked working tree files would be overwritten` can happen when the
|
||||
cache features a changed version of the files used by yay to update the package.
|
||||
This can easily be fixed by removing the cache of the corresponding package.
|
||||
|
||||
#### Python `ModuleNotFoundError: No module named...`
|
||||
|
||||
This section is based on a
|
||||
[StackOverflow post by Helen](https://stackoverflow.com/questions/55923868/how-to-fix-modulenotfounderror-no-module-named-setuptools).
|
||||
|
||||
In this case the error stems from a missing package.
|
||||
Normally it can easily be fixed by installing that corresponding package.
|
||||
But please note that [pyenv](/wiki/programming_language/golang.md#setup) can hide packages if the
|
||||
global Python version is set to something other than `system`.
|
||||
This is especially the case on [Arch Linux-systems](/wiki/linux/arch-linux.md) because Python
|
||||
packages are also installed via [Pacman or Yay](#arch-linux-pacman-and-yay).
|
||||
In this case the global Version has to be changed to `system` or the package installed to the
|
||||
non-system Python version.
|
||||
|
||||
#### Error `exists in filesystem`
|
||||
|
||||
This section is based on a
|
||||
[reddit post by 194668PT](https://www.reddit.com/r/archlinux/comments/17jempk/pacman_exists_in_filesystem_errors/).
|
||||
|
||||
If an error shows up that describes that a file of a package `exists in filesystem` usually a
|
||||
permission/owner error happened.
|
||||
This can happen when running `pacman -Syyu`.
|
||||
To update the package either way the following command can be used.
|
||||
`<package name>` should be exchanged for the package that throws the error.
|
||||
|
||||
```sh
|
||||
sudo pacman -S --overwrite "*" <package name>
|
||||
```
|
||||
- [Debian](/wiki/linux/debian.md) and Debian-based distributions use the
|
||||
[APT](/wiki/linux/package_manager/apt.md) package manager
|
||||
- [Arch Linux](/wiki/linux/arch-linux.md) and Arch-based distributions use
|
||||
[Pacman]() and various managers for the AUR.
|
||||
|
||||
38
wiki/linux/package_manager/apt.md
Normal file
38
wiki/linux/package_manager/apt.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# APT
|
||||
|
||||
In [Debian](/wiki/linux/debian.md) the APT package manager is used.
|
||||
It is also used for various Debian-based distributions.
|
||||
|
||||
## Usage
|
||||
|
||||
This section addresses various usages of the APT package manager.
|
||||
|
||||
### Updating & Upgrading
|
||||
|
||||
This section addresses the updating of all packages managed by APT.
|
||||
To update the packages it is recommended to first update the package list with the following
|
||||
command.
|
||||
|
||||
```sh
|
||||
apt update
|
||||
```
|
||||
|
||||
Afterwards there are two possible update types without changing the major release version.
|
||||
|
||||
The following command - `upgrade` - updates the packages only if no new or previously removed dependencies are
|
||||
needed.
|
||||
It is generally used for day-to-day updating without bigger jumps between versions.
|
||||
|
||||
```sh
|
||||
apt upgrade
|
||||
```
|
||||
|
||||
The other option is `full-upgrade` which was previously also known as `dist-upgrade`.
|
||||
This command will also install, remove and replace dependencies if it is needed to update the
|
||||
package.
|
||||
It is mostly used for bigger updates like Kernel or release upgrade without changing the major
|
||||
version.
|
||||
|
||||
```sh
|
||||
apt full-upgrade
|
||||
```
|
||||
323
wiki/linux/package_manager/pacman_and_aur.md
Normal file
323
wiki/linux/package_manager/pacman_and_aur.md
Normal file
@@ -0,0 +1,323 @@
|
||||
# Pacman and AUR
|
||||
|
||||
In [Arch Linux](/wiki/linux/arch-linux.md) there are 2 main types of
|
||||
package managers.
|
||||
The first is pacman, the default package manager.
|
||||
|
||||
For the second type there are many different managers to chose from.
|
||||
Those managers are handling for the Arch User Repositories (AUR).
|
||||
|
||||
In this article yay is used as the go to AUR manager.
|
||||
yay is also a wrapper for pacman so yay can be used instead of pacman to
|
||||
install and update both AUR and main repository programs.
|
||||
It features the same syntax.
|
||||
|
||||
## Usage
|
||||
|
||||
This section addresses various usages of the arch linux package managers.
|
||||
|
||||
### Ignoring Packages
|
||||
|
||||
Packages can be ignored by adding the package in `/etc/pacman.conf` under `IgnorePkg`.
|
||||
In the following example `waybar` is ignored from updates.
|
||||
To add more packages just add them separated by spaces.
|
||||
|
||||
```txt
|
||||
IgnorePkg = waybar
|
||||
```
|
||||
|
||||
To unignore the package from updates remove it from this line.
|
||||
|
||||
### Downgrading Packages
|
||||
|
||||
Packages of the AUR can be downgraded by using the
|
||||
[Downgrade](https://github.com/archlinux-downgrade/downgrade) program.
|
||||
This program can then easily be used to an AUR package.
|
||||
This works like the following assuming the package `v4l2loopback-dmks` needs to be downgraded.
|
||||
|
||||
```sh
|
||||
sudo downgrade v4l2loopback-dmks
|
||||
```
|
||||
|
||||
Afterwards the target version can be selected and the downgrading process will conclude.
|
||||
After the downgrade of a package you will get asked if you want to
|
||||
[ignore future updates](#ignoring-packages).
|
||||
|
||||
### Manual Installation of a `PKGBUILD` File
|
||||
|
||||
A `PKGBUILD` file is a [shell](/wiki/linux/shell.md) script that contains the installation
|
||||
information that is required by the Arch Linux.
|
||||
Using the `makepkg` command it can be installed like the following command shows.
|
||||
|
||||
```sh
|
||||
makepkg -sirc
|
||||
```
|
||||
|
||||
Afterwards it is installed on the system and can be further managed (especially uninstalled) by the
|
||||
Pacman package manager.
|
||||
|
||||
### Installing an AUR Program with a Specific Version
|
||||
|
||||
The installation of a specific version of an AUR program can be easily achieved.
|
||||
For this navigate to the AUR page of the program to install.
|
||||
On the right-hand side click on `View Changes` and select the version you want to install in the
|
||||
commit list.
|
||||
Next to `download` a `.tar.gz` file can be downloaded which includes a `PKGBUILD` file.
|
||||
Afterwards it needs to be [uncompressed](/wiki/linux/tar.md#uncompressing-a-tar-archive).
|
||||
|
||||
### Clear Cache
|
||||
|
||||
The cache of all packages except the one installed can be deleted by running the following command.
|
||||
|
||||
```sh
|
||||
pacman -Sc
|
||||
```
|
||||
|
||||
Alternatively the pacman cache can be deleted partly by running the following command which will
|
||||
clear the cache of pacman except for the latest version.
|
||||
The amount of versions to keep can be specified by changing the number in the following command
|
||||
accordingly.
|
||||
|
||||
```sh
|
||||
paccache -rvk1
|
||||
```
|
||||
|
||||
And finally the following command will remove all cached files that belong to uninstalled packages.
|
||||
Again the number can be changed to keep a specific number of versions.
|
||||
|
||||
```sh
|
||||
paccache -rvuk0
|
||||
```
|
||||
|
||||
Since `yay` mirrors the usage of `pacman` it can be used the same way and will clean both caches.
|
||||
|
||||
```sh
|
||||
yay -Sc
|
||||
```
|
||||
|
||||
Similar to `paccache` a command called [yaycache](https://github.com/aokellermann/yaycache) can be
|
||||
used.
|
||||
It follows the same options as `paccache`.
|
||||
|
||||
The clearing of the cache can be automated by using a [hook](#hook-clear-cache).
|
||||
|
||||
### Enabling `multilib`
|
||||
|
||||
`multilib` is a repository that contains 32-bit software and libraries.
|
||||
By default it is not enabled.
|
||||
To enable it search and uncomment the following lines in the file `/etc/pacman.conf`.
|
||||
|
||||
```txt
|
||||
[multilib]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
```
|
||||
|
||||
### Hooks
|
||||
|
||||
Hooks are commands that are run before or after installation of one or more packages.
|
||||
They are needed to have the `.hook` extension and can be found inside two directories.
|
||||
The first one is `/usr/share/libalpm/hooks/`.
|
||||
The second one is defined in `HookDir` inside the file `/etc/pacman.conf`.
|
||||
By default it points towards `/etc/pacman.d/hooks`.
|
||||
|
||||
Examples of hooks can be found in the following sections.
|
||||
|
||||
#### Hook: List Orphans
|
||||
|
||||
The following hook will display orphans after any package is update.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references a
|
||||
[gist by Strykar](https://gist.github.com/Strykar/3b3cd5bbdabe7e5c77f9414b2b4fe7e8).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Operation = Remove
|
||||
Type = Package
|
||||
Target = *
|
||||
|
||||
[Action]
|
||||
Description = Searching for orphaned packages...
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/bash -c "/usr/bin/pacman -Qtd || /usr/bin/echo '==> no orphans found.'"
|
||||
```
|
||||
|
||||
#### Hook: Clear Cache
|
||||
|
||||
The following hook will [clear the pacman cache](#clear-cache) except for the last version of a package.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references an
|
||||
[AUR comment by itaranto](https://aur.archlinux.org/packages/pacman-cleanup-hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Remove
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Target = *
|
||||
|
||||
[Action]
|
||||
Description = Removing unnecessary cached files (keeping the latest one)...
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/paccache -rvk1 && paccache -ruvk0
|
||||
```
|
||||
|
||||
#### Hook: Informant
|
||||
|
||||
The following hook will use [informant](https://github.com/bradford-smith94/informant) to check for
|
||||
Arch News that may require manual intervention and not allow the update if there are news unread.
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references the
|
||||
[informant Github](https://github.com/bradford-smith94/informant/blob/master/informant.hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = *
|
||||
Target = !informant
|
||||
|
||||
[Action]
|
||||
Description = Checking Arch News with Informant...
|
||||
When = PreTransaction
|
||||
Exec = /usr/bin/informant check
|
||||
Depends = informant
|
||||
AbortOnFail
|
||||
```
|
||||
|
||||
#### Hook: Update Package Mirrorlist
|
||||
|
||||
The following hook will use [reflector](https://xyne.dev/projects/reflector/) to update the pacman
|
||||
mirrorlist.
|
||||
It will use german mirrors (`-c de`), will list the fastest 15 mirrors (`-n 15`) and only do so if
|
||||
the mirror was online in the last 24 hours (`-a 24`).
|
||||
It was found in a
|
||||
[reddit post by IBNash](https://www.reddit.com/r/archlinux/comments/dsnu81/hear_ye_archers_share_your_pacman_hooks/)
|
||||
which references the
|
||||
[pacman-hooks Github](https://github.com/desbma/pacman-hooks/blob/master/reflector/reflector.hook).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = pacman-mirrorlist
|
||||
|
||||
[Action]
|
||||
Description = Updating pacman-mirrorlist with reflector...
|
||||
When = PostTransaction
|
||||
Depends = reflector
|
||||
Exec = /bin/bash -c 'reflector -c de -n 15 -a 24 > /etc/pacman.d/mirrorlist ; test -f /etc/pacman.d/mirrorlist.pacnew && mv -v /etc/pacman.d/mirrorlist.{pacnew,orig} || true'
|
||||
```
|
||||
|
||||
#### Hook: Kernel Reboot Needed
|
||||
|
||||
The following hook will use determine if a reboot is needed because the kernel was updated.
|
||||
It was found in a
|
||||
[reddit commend by progandy](https://www.reddit.com/r/archlinux/comments/dsnu81/comment/f6sogat).
|
||||
|
||||
```txt
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Operation = Remove
|
||||
Type = File
|
||||
Target = usr/lib/modules/*
|
||||
|
||||
[Action]
|
||||
Description = Check for upgrade of running kernel...
|
||||
When = PostTransaction
|
||||
Exec = /bin/bash -c "[[ -f \"/proc/modules\" && ! -d \"/usr/lib/modules/$(uname -r)\" ]] && printf '==> WARNING: %s\n -> %s\n' 'Running kernel has been updated or removed!' 'A reboot is required!' || true"
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
This section will focus on errors and the fixing of errors of package managers.
|
||||
|
||||
### `/usr/lib/firmware/nvidia/ad104` exists in filesystem linux-firmware-nvidia
|
||||
|
||||
This error comes from a decision to split the firmware modules into different parts.
|
||||
An easy way to fix it is by simply reinstalling the `linux-firmware` package and updating the
|
||||
packages of the system.
|
||||
|
||||
```sh
|
||||
pacman -Syu linux-firmware
|
||||
```
|
||||
|
||||
### Update Mirrorlist
|
||||
|
||||
After a while not updating the system it is possible for the mirrorlist to be
|
||||
outdated.
|
||||
This can be fixed by updating it with the following command:
|
||||
|
||||
```sh
|
||||
curl -o /etc/pacman.d/mirrorlist https://archlinux.org/mirrorlist/all/
|
||||
```
|
||||
|
||||
### Error While Importing Keys
|
||||
|
||||
Both `yay` and `pacman` use [GPG keys](/wiki/linux/gpg.md).
|
||||
It is possible that it runs into errors when importing new keys.
|
||||
If this happens you should try to restart the GPG key server
|
||||
[as explained in the GPG entry](/wiki/linux/gpg.md#restart-the-gpg-server).
|
||||
|
||||
### Unknown Public Key
|
||||
|
||||
If the error `ERROR: One or more PGP signatures could not be verified!`, you
|
||||
have to manually receive the key and trust it.
|
||||
This can be done [as explained in the GPG entry](/wiki/linux/gpg.md#receive-a-key-and-trust-it).
|
||||
|
||||
The identifier of the key usually gets gets printed in the line above the error looking like
|
||||
`FAILED (unknown public key <KEYID>)`.
|
||||
|
||||
### Error During Updating `is marginal trust`
|
||||
|
||||
If the error `[...] Key [...] is marginal trust` (also `of unknown trust`) occurs while updating
|
||||
the system, it can be fixed by running the following commands and then restarting
|
||||
the update process of the package manager.
|
||||
|
||||
```sh
|
||||
pacman -Sy archlinux-keyring
|
||||
pacman-key --populate archlinux
|
||||
pacman-key --refresh-keys
|
||||
```
|
||||
|
||||
### Error During Updating `the following untracked working tree files would be overwritten`
|
||||
|
||||
The error `the following untracked working tree files would be overwritten` can happen when the
|
||||
cache features a changed version of the files used by yay to update the package.
|
||||
This can easily be fixed by removing the cache of the corresponding package.
|
||||
|
||||
### Python `ModuleNotFoundError: No module named...`
|
||||
|
||||
This section is based on a
|
||||
[StackOverflow post by Helen](https://stackoverflow.com/questions/55923868/how-to-fix-modulenotfounderror-no-module-named-setuptools).
|
||||
|
||||
In this case the error stems from a missing package.
|
||||
Normally it can easily be fixed by installing that corresponding package.
|
||||
But please note that [pyenv](/wiki/programming_language/golang.md#setup) can hide packages if the
|
||||
global Python version is set to something other than `system`.
|
||||
This is especially the case on [Arch Linux-systems](/wiki/linux/arch-linux.md) because Python
|
||||
packages are also installed via [Pacman or Yay](#arch-linux-pacman-and-yay).
|
||||
In this case the global Version has to be changed to `system` or the package installed to the
|
||||
non-system Python version.
|
||||
|
||||
### Error `exists in filesystem`
|
||||
|
||||
This section is based on a
|
||||
[reddit post by 194668PT](https://www.reddit.com/r/archlinux/comments/17jempk/pacman_exists_in_filesystem_errors/).
|
||||
|
||||
If an error shows up that describes that a file of a package `exists in filesystem` usually a
|
||||
permission/owner error happened.
|
||||
This can happen when running `pacman -Syyu`.
|
||||
To update the package either way the following command can be used.
|
||||
`<package name>` should be exchanged for the package that throws the error.
|
||||
|
||||
```sh
|
||||
sudo pacman -S --overwrite "*" <package name>
|
||||
```
|
||||
@@ -38,7 +38,8 @@ This is also described in the
|
||||
|
||||
A simple way to achieve this in Qt is the installation of
|
||||
[adwaita-qt6](https://github.com/FedoraQt/adwaita-qt) which is also available as an
|
||||
[AUR](/wiki/linux/package_manager.md#installing-an-aur-program-with-a-specific-version) package.
|
||||
[AUR](/wiki/linux/package_manager/pacman_and_aur.md#installing-an-aur-program-with-a-specific-version)
|
||||
package.
|
||||
After the installation it can be selected by `qt6ct` as described in the
|
||||
[configuration section](#configuration).
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ This section is based on an
|
||||
To fix it downgrade the packages `v4l2loopback-dkms` and `v4l2loopback-utils` to the last working
|
||||
version.
|
||||
For [Arch Linux](/wiki/linux/arch-linux.md) this can be achieved by using
|
||||
[Downgrade](/wiki/linux/package_manager.md#downgrading-packages).
|
||||
[Downgrade](/wiki/linux/package_manager/pacman_and_aur.md#downgrading-packages).
|
||||
|
||||
### `Error! Bad return status for module build on kernel`
|
||||
|
||||
@@ -100,4 +100,4 @@ When updating the `v4l2loopback` package this error can occur after the creation
|
||||
[initramfs](/wiki/linux/mkinitcpio.md).
|
||||
This may point to an incompatibility of the package and kernel version which can only but easily
|
||||
and temporarily be fixed by downgrading the package as described in
|
||||
[the corresponding package manager section](/wiki/linux/package_manager.md#downgrading-packages).
|
||||
[the corresponding package manager entry](/wiki/linux/package_manager/pacman_and_aur.md#downgrading-packages).
|
||||
|
||||
@@ -21,8 +21,8 @@ project is now unmaintained.
|
||||
An alternative to using this project is
|
||||
[Überzug++](https://github.com/jstkdng/ueberzugpp) that can be used as a drop-in
|
||||
alternative.
|
||||
It can be installed by the
|
||||
[Arch User Repository package `ueberzugpp`](/wiki/linux/package_manager.md#arch-linux-pacman-and-yay).
|
||||
On [Arch Linux](/wiki/linux/arch-linux.md) it can be installed by the
|
||||
[Arch User Repository](/wiki/linux/package_manager/pacman_and_aur.md) package `ueberzugpp`.
|
||||
After that you need to add 2 files to your path which can be found on
|
||||
[thimc' Repository](https://github.com/thimc/vifmimg):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user