You are not logged in.

#1 2024-01-20 17:01:11

anthony93
Member
Registered: 2021-07-31
Posts: 11

[SOLVED] Understanding the --unneeded flag for pacman -R

There is a command recommended in the Arch Wiki for detecting unneeded packages:

$ pacman -Qqd | pacman -Rsu --print -

Based on my current understanding, pacman -Qqd generates a list of packages that are installed as dependencies, which is then piped into

pacman -Rsu -- print -

Which then prints out a list of those packages (from the initial list) that will actually be removed.

On my system, the list is as follows:

$ pacman -Qqd | pacman -Rsu --print -
python-chardet-5.2.0-1
libsoup-2.74.3-1
gnu-free-fonts-20120503-8
acpi_call-1.2.2-178
ca-certificates-20220905-1
ca-certificates-mozilla-3.96.1-1

What I don't understand is why some packages are included in the list even though they are required by other packages?

For instance, ca-certificates is required by other packages:

$ pacman -Qi ca-certificates
Name            : ca-certificates
Version         : 20220905-1
Description     : Common CA certificates (default providers)
Architecture    : any
URL             : https://src.fedoraproject.org/rpms/ca-certificates
Licenses        : GPL
Groups          : None
Provides        : None
Depends On      : ca-certificates-mozilla
Optional Deps   : None
Required By     : curl  neon  python-certifi  qca-qt5
Optional For    : openssl
Conflicts With  : ca-certificates-cacert<=20140824-4
Replaces        : ca-certificates-cacert<=20140824-4
Installed Size  : 0.00 B
Packager        : Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Build Date      : Tue 06 Sep 2022 05:59:24 AM +08
Install Date    : Thu 13 Jul 2023 07:13:46 PM +08
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

According to pacman's man page:

-u, --unneeded
           Removes targets that are not required by any other packages. This is mostly useful when removing a group without using the -c option, to avoid breaking any dependencies.

Shouldn't the presence of the --unneeded flag cause ca-certificates to be omitted from the list?

Last edited by anthony93 (2024-01-21 07:41:42)

Offline

#2 2024-01-20 17:13:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,621
Website

Re: [SOLVED] Understanding the --unneeded flag for pacman -R

I'd wager you also have ca-certificates-utils installed which provides ca-certificates and thus technically satisfies the dependency of other packages like curl.  I'd recommend using the -t flag for the initial -Q command.

Last edited by Trilby (2024-01-20 17:15:58)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2024-01-21 07:40:48

anthony93
Member
Registered: 2021-07-31
Posts: 11

Re: [SOLVED] Understanding the --unneeded flag for pacman -R

Trilby wrote:

I'd wager you also have ca-certificates-utils installed which provides ca-certificates and thus technically satisfies the dependency of other packages like curl.  I'd recommend using the -t flag for the initial -Q command.

Indeed, you are correct. Everything is clear now. Thanks.

Offline

Board footer

Powered by FluxBB