It is safe to execute this command

it is safe to execute this command?
i am a little confused about the dependencies and the warning

swh on Endeavour OS ~                                                                                                                                                                16:28:14
➜ LANG=C yay -Yc
[sudo] password for swh: 
checking dependencies...
:: bat-extras optionally requires rustfmt: Rust formatting for prettybat script
:: kate optionally requires rust: Rust LSP support
warning: dependency cycle detected:
warning: intel-oneapi-openmp will be removed after its intel-oneapi-compiler-dpcpp-cpp-runtime dependency

Package (41)                             Old Version        Net Change 

rust                                     1:1.69.0-3         -454,69 MiB
botan2                                   2.19.3-1             -7,40 MiB
cargo-audit                              0.17.6-1             -7,44 MiB
cbindgen                                 0.24.3-1             -3,64 MiB
cxxbridge                                1.0.95-1             -3,67 MiB
cython                                   0.29.35-1            -9,78 MiB
ddcutil                                  1.4.1-1              -1,74 MiB
element-web                              1.11.31-3           -51,40 MiB
embree                                   4.1.0-1             -39,28 MiB
gn                                       0.2088.5a004f94-1    -3,09 MiB
gperf                                    3.1-4                -0,22 MiB
graphicsmagick                           1.3.40-3            -13,65 MiB
i2c-tools                                4.3-4                -0,32 MiB
inkscape                                 1.2.2-7            -166,04 MiB
intel-oneapi-compiler-dpcpp-cpp-runtime  2023.1.0-1         -118,62 MiB
intel-oneapi-compiler-shared-opencl-cpu  2023.0.0-7         -389,70 MiB
intel-oneapi-compiler-shared-runtime     2023.1.0-1         -996,52 MiB
intel-oneapi-openmp                      2023.1.0-1          -70,10 MiB
lib2geom                                 1.2.2-2              -1,61 MiB
libcerf                                  1:2.3-2              -0,12 MiB
libibus                                  1.5.28-4           -108,93 MiB
libmalcontent                            0.11.1-2             -0,20 MiB
libmatio                                 1.5.23-3             -0,55 MiB
liborigin                                3.0.1-1              -0,51 MiB
lld                                      15.0.7-2             -6,63 MiB
lua53                                    5.3.6-1              -1,05 MiB
node-gyp                                 9.3.1-1              -4,43 MiB
nodejs                                   20.2.0-1            -58,78 MiB
nodejs-nopt                              7.1.0-1              -0,03 MiB
npm                                      8.19.2-2             -6,49 MiB
opencl-headers                           2:2022.09.30-1       -0,31 MiB
ostree                                   2023.3-1             -4,33 MiB
python-bcrypt                            4.0.1-2              -0,45 MiB
python-paramiko                          2.11.1-3             -2,40 MiB
python-pynacl                            1.4.0-6              -0,82 MiB
python-xlib                              0.33-2               -2,07 MiB
qt5-mqtt                                 5.15.2-9             -0,29 MiB
ragel                                    6.10-3               -2,18 MiB
readstat                                 1.1.9-1              -0,37 MiB
semver                                   7.3.8-1              -0,11 MiB
xorg-xcursorgen                          1.0.8-1              -0,02 MiB

Total Removed Size:  2539,99 MiB

:: Do you want to remove these packages? [Y/n] 

The warnings can all be ignored, they are normal.

Is it safe to run that command? It should be.

However, only you can know if you need/want any of those packages. Just because a package is an orphan doesn’t mean you do not need it.

Also, it is telling you it is removing the optional dependencies of other packages so you should consider if you are OK with that or not.

2 Likes

ok thanks @dalto . at least i understand the context now.
one more question. how should i run yay, let’s say i want to keep rust.

no stupid questions, i am still a beginner in terminal skills :wink:

If you want to keep rust you could mark it as explicitly installed.

sudo pacman -D --asexplicit rust
yay -Yc
5 Likes

ok i understand. once i have marked a program with sudo pacman -D --asexplicit prog it is no longer marked as orphan. so my system keeps this program for ‘life’.

@dalto thanks to you i still become a coder on my old days :joy:

3 Likes

I don’t think that Yay with the command

yay -Yc

would remove dependencies that are still needed.

If you are unsure you can check the version numbers in the cache of Pacman and Yay:
Rust as an example:

ls /var/cache/pacman/pkg | grep rust
ls ~/.cache/yay | grep rust

You will notice that there are sometimes more than 2 or 3 versions of certain programs.

It may also help to clean the package cache manually from time to time or to run a timer for it.
See also:
paccache

man paccache

It absolutely will remove the optional dependencies of other packages. Try it for yourself.

The recommended command from the arch wiki, pacman -Qtdq | sudo pacman -Rns - will also remove optional dependencies.

It is caused by the way pacman -Rs works.

In my case, it tries to remove cmake which is an optional dependency. There is nothing else on my systemd that provides cmake.

Yes, but which version. It should not touch the last 2 versions.

Therefore I have pointed to a comparison with the versions in the cache.

With me once “Botan” should be removed. I do not remember in which context.
This made me suspicious and I dug deeper and found that he wanted to remove the 3rd oldest version. This was correct.

It does not remove any needed dependencies from the pacman database view. But if the database isn’t well maintained and the installation reasons aren’t set correctly, caution is advised. Then packages, like rust in this case, will also removed.

You should also remember that pacman has no knowledge of the required dependencies of programs used in scripts.

For example, if I uninstalled the package scrot, the script config/i3/scripts/blur-lock that was installed by eos with the i3wm would no longer work. pacman knows nothing about this kind of dependency.

1 Like

Eh? Are you confusing yay -Yc with yay -Sc?

yay -Yc is for removing orphans. It has nothing to do with the package cache.

Again, it will absolutely remove optional dependencies even if the database is properly maintained. However, it will not remove required dependencies.

1 Like

I agree with you there and can understand your warning about acting too fast. :+1:

No.
Yay should not remove the last 2 versions of a program. For me it was the last 3 I do not need for a possible downgrade.
Hence the comparison to the version numbers in the cache.

I don’t understand, what does that have to do with removing orphans? There is only one version of package installed. Cache cleanup has nothing to do with removing orphans. They are completely unrelated.

1 Like

On Arch (and pretty much every other distro I’ve used), you can’t have multiple versions of the same package installed simultaneously. You’re confusing installed packages with package cache.

When it comes to “removing orphans”, what that terminology means is uninstalling packages that were once installed as dependencies for some other packages, but now are no longer dependencies for any package. This means any packages that were not explicitly installed, and on which nothing depends, including optional dependencies as well as build dependencies for AUR packages.

Optional dependencies should typically be marked as explicitly installed, since they are not pulled automatically and the user usually installs them manually. So cleaning up orphans should typically not touch these.

3 Likes

I’ve never noticed this since I always install optional packages as explicit. Because I want to consciously expand the range of functions of a program.

If I have an optional package with the installation reason “installed as a dependency”, then I can also remove it. Because it was unknowingly installed as a dependency of another package. Where I don’t seem to have appreciated the extra functionality.

Now I’ve learned something new, thank you @dalto

1 Like

I think the translation is bad. :upside_down_face:

For example, I have “Botan” on the system.
One active version and two old ones in the cache of Pacman.
I have

yay -Yc

executed. There I became cautious because I still had in memory that I need this.
So I ran a comparison and found that an even older version should be removed. I agreed with that.

How often RUST is present in the system I do not know. I just wanted to mention it. In my case, YAY has done everything right.

I am however your opinion that one should calmly ask here in the forum if one is unsure.

I hope now it is clear. :saluting_face:

I think you are confusing different concepts.

yay -Yc and the files in /var/cache/pacman/pkg are completely unrelated. There is no reason to consider the two together.

yay -Yc removes orphans. Orphans are packages that were installed as dependencies but are no longer required by other packages. This has nothing to do with the package cache. It doesn’t matter if you have 0 versions in the cache or 1000 versions. It is unrelated.

However, yay -Sc does clean the package cache. To be clear, that is a completely different command.

2 Likes

Why I had 2 active versions in the system I don’t know now.
Maybe it was caused by the last big Python update.

It is needed on my system for keepassxc and QT5 and QT6

Those are different packages, not different versions of the same package.

If you want to check for two different packages that provide the thing you do that by searching the database, not by looking in the cache.

For example, this command will show you all the packages on your system and what they provide:

expac -Q "%n - %P"
1 Like

Good tip. I’ll add it to my list. :wink:

In my case, we come closer to the matter even if one would have to dig further.

Summary
~> yay -Ssi "botan|botan2"
extra/botan 3.0.0-1 (2.4 MiB 8.3 MiB) (Installed)
    Crypto library written in C++
extra/botan2 2.19.3-1 (2.1 MiB 7.4 MiB) (Installed)
    Crypto library written in C++ (legacy version)

But I have no problems and do not want to hijack this thread. I can’t recreate it now either.

So this thread should be a good for and again. :woozy_face: