Dependency error when uninstalling packages

Hi friends, I’m sorry if this is a very basic question, but what exactly does this error mean?

I used -Rns, Rn and Rs, but got the same error. I understand that Lutris is using a dependency on p7zip (I don’t know why), but it seems that it needs it to continue working.

So does that mean I can’t remove p7zip, since lutris would have downloaded p7zip anyway in order to work, even if I hadn’t installed p7zip first?

Is this more or less how this works?

Thanks in advance!

[mylinux@eos ~]$ yay -Rns p7zip
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing p7zip breaks dependency 'p7zip' required by lutris
 -> exit status 1
[mylinux@eos ~]$ yay -Rs p7zip
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing p7zip breaks dependency 'p7zip' required by lutris
 -> exit status 1
[mylinux@eos ~]$ yay -Rn p7zip
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing p7zip breaks dependency 'p7zip' required by lutris
 -> exit status 1

Yes.

You can check the dependencies of lutris, when it is already installed, by for example the following command:

pacman -Qi lutris | grep Depends

For a package, say X for example, which is not already installed on your system:

pacman -Si X | grep Depends

1 Like

yay prohibits you from removing p7zip because p7zip is needed for lutris to function and you still have lutris installed on your system.

$ pacman -Si lutris
Repository      : extra
Name            : lutris
Version         : 0.5.16-1
Description     : Open Gaming Platform
Architecture    : any
URL             : https://lutris.net
Licenses        : GPL3
Groups          : None
Provides        : None
Depends On      : cabextract  curl  gdk-pixbuf2  glib2  gnome-desktop  gobject-introspection-runtime  gtk3  hicolor-icon-theme  mesa-utils  p7zip  pango  psmisc  python  python-cairo
                  python-certifi  python-dbus  python-distro  python-evdev  python-gobject  python-lxml  python-moddb  python-pillow  python-requests  python-urllib3  python-yaml  unzip
                  webkit2gtk-4.1  xdg-desktop-portal-impl  xorg-xrandr
Optional Deps   : gamemode: Allows games to request a temporary set of optimisations
                  gvfs: GVFS backend
                  innoextract: Extract Inno Setup installers
                  lib32-gamemode: Allows games to request a temporary set of optimisations
                  lib32-vkd3d: DirectX 12 support
                  lib32-vulkan-icd-loader: Vulkan support
                  python-protobuf: Battle.net support
                  vkd3d: DirectX 12 support
                  vulkan-icd-loader: Vulkan support
                  vulkan-tools: Vulkan support
                  wine: Windows support
                  xorg-xgamma: Restore gamma on game exit
Conflicts With  : None
Replaces        : None
Download Size   : 1770.92 KiB
Installed Size  : 9755.55 KiB
Packager        : Robin Candau <antiz@archlinux.org>
Build Date      : Tue 16 Jan 2024 04:25:43 PM +08
Validated By    : MD5 Sum  SHA-256 Sum  Signature

Pay attention to the “Depends on” section. p7zip is among the required packages for lutris to work.

If you want to remove p7zip normally, you cannot have any packages on your system that depends on p7zip (p7zip cannot be listed in the “Depends on” section in any other packages installed on your system)

That’s not really how it works. If you forcibly remove p7zip despite yay’s warning, lutris won’t magically download p7zip from the arch repos in order to work. That does not happen. What’s more likely to happen in this case is that lutris will crash during runtime because it fails to find a missing .so file or binary.

The package manager and AUR helper is not responsible for maintaining package integrity beyond the installation and/or upgrading phase. If you do not heed its warning and forcibly remove needed dependencies, you’re on your own. If you’re lucky, only lutris is affected, in which case you just have to reinstall it. If you’re unlucky, you might end up breaking a dozen more packages that depend on p7zip and you end up in a FUBAR situation.

4 Likes

Thank you both very much, friends. I have tried it for myself and you are right. I removed lutris first, and then tried to remove p7zip, and it worked!

So, it means that lutris needed one of the “Dependencies (2)” or “Required By (29)” that p7zip was using, but the 2 programs used the same dependency:

image
image

It would be nice if 2 programs share the same dependency, the dependency installed could be left for the other program that still uses it, but I suppose it can’t because it is made in such a way that when you uninstall a program everything is clean without lost dependencies, etc

EDIT:

“Required By” I just realized that they are not dependencies, they are packages/programs!

The easiest way to check the dependencies of a package is to use the pactree command. For example,

$ pactree -r p7zip

Or if you want colorized output:

$ pactree -rc p7zip

What do you mean? This is already pacman’s behavior. If you use pacman -Rs <some_package>, pacman will remove the package and all of the package’s dependencies if and only if those dependencies are not required by any other package and that they are not explicitly installed. Pacman is clever enough to know that if you’ve explicitly installed a package, you probably need to use that package yourself, not just to fulfill the dependency of another package.

3 Likes

Wait, I don’t understand. You mean pacman behaves differently than yay?

I know that, as we have seen above, yay does not uninstall packages if their dependencies are shared and used by other programs. When I uninstalled lutris, I was able to uninstall p7zip and all its dependencies.

So Pacman works differently? I have always used yay because I was taught that way here in this forum, and because it can handle arch and aur packages, but I really don’t know if there is a difference between them.

No. That is not what I meant.

You should re-read your own statement.

This statement literally says the opposite of the actual behavior. It says that the dependency can’t be left behind for other packages that also require it, which is false. My earlier reply was meant to correct that.

No. Yay uses pacman under the hood. So it makes no sense for yay to work differently.

1 Like

Sorry, you’re right, I always use Google Translate because my English is very bad, most of my messages don’t make sense or are confusing when translated :sweat: thanks for the clarification!

1 Like

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