Why a package "Required By: None" & "Optional For: None" can't be detected as garbage (orphan) by pacman?

After the code package got it’s update of:

~/Desktop ······························································································································································································ 22:19:25
❯ cat /var/log/pacman.log | tail -n18
[2022-09-02T22:10:33+0300] [ALPM-SCRIPTLET] done
[2022-09-02T22:10:33+0300] [ALPM] transaction started
[2022-09-02T22:10:33+0300] [ALPM] installed electron19 (19.0.13-1)
[2022-09-02T22:10:34+0300] [ALPM] upgraded code (1.70.2-1 -> 1.71.0-1)
[2022-09-02T22:10:34+0300] [ALPM] upgraded python-setuptools (1:62.3.2-1 -> 1:62.3.3-1)
[2022-09-02T22:10:35+0300] [ALPM] transaction completed
[2022-09-02T22:10:35+0300] [ALPM] running '30-systemd-update.hook'...
[2022-09-02T22:10:35+0300] [ALPM] running '90-packagekit-refresh.hook'...
[2022-09-02T22:10:35+0300] [ALPM] running 'update-desktop-database.hook'...
[2022-09-02T22:11:35+0300] [PACMAN] Running 'pacman -Rns -'
[2022-09-02T22:11:39+0300] [ALPM] running 'texinfo-remove.hook'...
[2022-09-02T22:11:39+0300] [ALPM] transaction started
[2022-09-02T22:11:39+0300] [ALPM] removed liblouis (3.22.0-1)
[2022-09-02T22:11:39+0300] [ALPM] removed lib32-readline (8.1.002-1)
[2022-09-02T22:11:39+0300] [ALPM] transaction completed
[2022-09-02T22:11:39+0300] [ALPM] running '30-systemd-update.hook'...
[2022-09-02T22:11:39+0300] [ALPM] running '90-packagekit-refresh.hook'...
[2022-09-02T22:14:02+0300] [PAMAC] synchronizing package lists

I noticed that it switched to electron19:

❯ pacman -Qi electron19       
Name            : electron19
Version         : 19.0.13-1
Description     : Build cross platform desktop apps with web technologies
Architecture    : x86_64
URL             : https://electronjs.org/
Licenses        : MIT  custom
Groups          : None
Provides        : None
Depends On      : c-ares  ffmpeg  gtk3  libevent  libxslt  minizip  nss  re2  snappy
Optional Deps   : kde-cli-tools: file deletion support (kioclient5) [installed]
                  libappindicator-gtk3: StatusNotifierItem support [installed]
                  pipewire: WebRTC desktop sharing under Wayland [installed]
                  trash-cli: file deletion support (trash-put)
                  xdg-utils: open URLs with desktop’s default (xdg-email, xdg-open) [installed]
Required By     : code
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 179.13 MiB
Packager        : Bruno Pagani <EDIT: removed>
Build Date      : Sun 21 Aug 2022 11:38:30 MSK
Install Date    : Fri 02 Sep 2022 22:10:33 MSK
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature
❯ pacman -Qi code      
Name            : code
Version         : 1.71.0-1
Description     : The Open Source build of Visual Studio Code (vscode) editor
Architecture    : x86_64
URL             : https://github.com/microsoft/vscode
Licenses        : MIT
Groups          : None
Provides        : vscode
Depends On      : electron19  libsecret  libx11  libxkbfile  ripgrep
Optional Deps   : bash-completion: Bash completions [installed]
                  zsh-completions: ZSH completitons [installed]
                  x11-ssh-askpass: SSH authentication [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 95.45 MiB
Packager        : Massimiliano Torromeo <EDIT: removed>
Build Date      : Fri 02 Sep 2022 01:30:28 MSK
Install Date    : Fri 02 Sep 2022 22:10:34 MSK
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

But the older electron18 does not have any package that could use it under the hood:

~/Desktop ······························································································································································································ 22:22:05
❯ pactree -r electron19
electron19
└─code
~/Desktop ······························································································································································································ 22:22:08
❯ pactree -r electron18
electron18

~/Desktop ······························································································································································································ 22:22:14
❯ 
~/Desktop ······························································································································································································ 22:17:27
❯ pacman -Qi electron18        
Name            : electron18
Version         : 18.3.9-1
Description     : Build cross platform desktop apps with web technologies
Architecture    : x86_64
URL             : https://electronjs.org/
Licenses        : MIT  custom

Groups          : None
Provides        : None
Depends On      : c-ares  ffmpeg  gtk3  libevent  libxslt  minizip  nss  re2  snappy
Optional Deps   : kde-cli-tools: file deletion support (kioclient5) [installed]
                  libappindicator-gtk3: StatusNotifierItem support [installed]
                  pipewire: WebRTC desktop sharing under Wayland [installed]
                  trash-cli: file deletion support (trash-put)
                  xdg-utils: open URLs with desktop's default (xdg-email, xdg-open) [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 181.13 MiB
Packager        : Bruno Pagani <EDIT: removed>
Build Date      : Sun 21 Aug 2022 11:36:20 MSK
Install Date    : Sun 21 Aug 2022 22:09:00 MSK
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

But why the pacman can’t find the package as garbage/orphan?

I tried:

❯ su                   
Password: 
[pc Desktop]# pacman -Qtdq | pacman -Rns -
error: argument '-' specified with empty stdin

[pc Desktop]# pacman -Qqd | pacman -Rsu --print -
python-pyopenssl-22.0.0-1
python-markdown-3.4.1-1
python-fixtures-4.0.1-1
python-testtools-2.5.0-3
python-six-1.16.0-6
python-pbr-5.10.0-1
python-importlib-metadata-4.8.2-1
python-zipp-3.8.1-1
python-extras-1.0.0-10
python-cryptography-37.0.4-1
python-cffi-1.15.1-1
python-pycparser-2.21-3
python-ply-3.11-10
pulseaudio-rtp-16.1-1
pulseaudio-lirc-16.1-1
pulseaudio-jack-16.1-1
pipewire-media-session-docs-1:0.4.1-2
pigz-2.7-2
opera-ffmpeg-codecs-104.0.5112.102-1
lirc-1:0.10.1-12
libusb-compat-0.1.7-1
intellij-idea-ultimate-edition-jre-2022.2.1-1
gcc-12.2.0-1
libmpc-1.2.1-2
libisl-0.25-1
docker-scan-0.19.0-1
botan-2.19.2-1
bash-completion-2.11-2
[pc Desktop]#

About the pacman:

~/Desktop ······························································································································································································ 22:23:53
❯ pacman -Qi pacman       
Name            : pacman
Version         : 6.0.1-12
Description     : A library-based package manager with dependency support
Architecture    : x86_64
URL             : http://www.archlinux.org/pacman/
Licenses        : GPL
Groups          : base-devel
Provides        : pacman-contrib  pacman-init  libalpm.so=13-64
Depends On      : bash  glibc  libarchive  curl  gpgme  gettext  gawk  coreutils  gnupg  grep  fakeroot  perl  pacman-mirrors>=4.1.0
Optional Deps   : perl-locale-gettext: translation support in makepkg-template
                  diffutils: for pacdiff [installed]
                  findutils: for pacdiff --find [installed]
                  mlocate: for pacdiff --locate
                  sudo: privilege elevation for several scripts [installed]
                  vim: default merge program for pacdiff
                  haveged: for pacman-init.service [installed]
Required By     : appstream-glib  archlinux-keyring  base  downgrade  libpamac  manjaro-keyring  packagekit  pkgfile  yay
Optional For    : None
Conflicts With  : pacman-contrib  pacman-init
Replaces        : pacman-contrib  pacman-init
Installed Size  : 4.80 MiB
Packager        : Mark Wagie <EDIT: removed>
Build Date      : Wed 27 Jul 2022 17:18:10 MSK
Install Date    : Wed 27 Jul 2022 23:43:27 MSK
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

Thanks!


PS
I did the pamac update --force-refresh and pacman -Syyuu. It did not fix the problem.

PS2
I have the chaotic-aur repo added (and have skypeforlinux-stable-bin and perhaps something else from there) and also AUR turned on in pamac and have 3 packages installed from there (krusader-git, icaclient, opera-developer)

may be an orphan one day

will never be an orphan package (not a dependency for pacman)
only dependencies can be orphaned

3 Likes

Thanks!

But how can I search for all “Required By: None” & “Optional For: None”-typed packages on my Manjaro OS copy w/o checking was it explicitly installed or not? In order to get all package list of them and to decide which items I use and which do not and then to manually remove all unused.

#!/usr/bin/env bash

while read -r pkg; do
    deps=$(pactree -r $pkg)
    [[ "$deps" != "$pkg"  ]] && continue
    explicit=$(LANG=C pacman -Qi "$pkg" | awk '/^Install Reason/ {print $4}')
    [ "$explicit" != "Explicitly" ] && explicit=""
    printf "%30s \t %s \n" "$pkg" "$explicit"
done < <(pacman -Qq)

all packages with no return for pactree -r and, display if Explicitly installed or not


it’s at us to always add --asdeps if we want to install a dependency directly

pacman -Sh
  --asdeps         install packages as non-explicitly installed
1 Like

That just returns every single package installed with Explicitly next to the packages that are explicitly installed and nothing for those that are not.

You’re a script wizard, but I imagine there could be a better way.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.