zypper rm --clean-deps doesn't remove all dependencies

E.g. when you install plasma5-session, it installs plasma-nm5 as dependency, but when you run “zypper rm --clean-deps plasma5-session”, it doesn’t remove plasma-nm5. Probably because plasma-nm5 installs package “Networks” of type “application” (wtf is this?), which depends on plasma-nm5 and marked as user installed (despite the fact that plasma-nm5 was installed as dependency). How do I disable this behaviour? Thanks.

You may try:

zypper rm --type application Networks

That works, but how should I know about this “Networks” package (or whatever it it) in the first place? Zypper doesn’t mention it at all when I install plasma-nm5. The only way know about it is to run “zypper se -i --requires plasma-nm5” and discover that there is some weird thing “application” called “Networks” that isn’t a package, but prevents plasma-nm5 from being automatically removed. That just seems counter-intuitive. You literally run “zypper in plasma5-workspace”, then “zypper rm --clean-deps plasma5-workspace” and it doesn’t remove all dependencies that you installed with “zypper in”. At least it should me marked as automatically installed, so that it wouldn’t interfere with --clean-deps.

There are patterns:

erlangen:~ # zypper se --installed-only --type pattern '*'
Loading repository data...
Reading installed packages...

S  | Name          | Summary                               | Type   
---+---------------+---------------------------------------+--------
i+ | apparmor      | AppArmor                              | pattern
i+ | base          | Base System                           | pattern
i  | devel_java    | Java Development                      | pattern
i+ | enhanced_base | Enhanced Base System                  | pattern
i+ | fonts         | Fonts                                 | pattern
i+ | games         | Games                                 | pattern
i+ | gnome         | GNOME Desktop Environment (Wayland)   | pattern
i  | gnome_x11     | GNOME Desktop Environment (X11)       | pattern
i+ | imaging       | Graphics                              | pattern
i+ | kde           | KDE Applications and Plasma 5 Desktop | pattern
i  | kde_pim       | KDE PIM Suite                         | pattern
i+ | kde_plasma    | KDE Plasma 5 Desktop Base             | pattern
i+ | lxde          | LXDE Desktop Environment              | pattern
i  | minimal_base  | Base System                           | pattern
i+ | multimedia    | Multimedia                            | pattern
i+ | office        | Office Software                       | pattern
i+ | sw_management | Software Management                   | pattern
i+ | x11           | X Window System                       | pattern
i+ | yast2_basis   | YaST System Administration            | pattern
erlangen:~ # 
erlangen:~ # zypper se --installed-only --type pattern kde
Loading repository data...
Reading installed packages...

S  | Name       | Summary                               | Type   
---+------------+---------------------------------------+--------
i+ | kde        | KDE Applications and Plasma 5 Desktop | pattern
i  | kde_pim    | KDE PIM Suite                         | pattern
i+ | kde_plasma | KDE Plasma 5 Desktop Base             | pattern
erlangen:~ # 

Each pattern consists of several packages:

erlangen:~ # zypper if --type pattern kde_plasma
Loading repository data...
Reading installed packages...


Information for pattern kde_plasma:
-----------------------------------
Repository      : Haupt-Repository (OSS)   
Name            : kde_plasma               
Version         : 20180709-3.1             
Arch            : noarch                   
Vendor          : openSUSE                 
Installed       : Yes                      
Visible to User : Yes                      
Summary         : KDE Plasma 5 Desktop Base
Description     :                          
    Base packages for the KDE Plasma 5 desktop environment.
Contents        :                          
    S  | Name                         | Type    | Dependency
    ---+------------------------------+---------+------------
    i+ | breeze5-cursors              | package | Required
    i+ | breeze5-decoration           | package | Required
    i+ | breeze5-icons                | package | Required
    i+ | breeze5-style                | package | Required
    i+ | desktop-data-openSUSE        | package | Required
    i+ | patterns-base-x11            | package | Required
    i+ | patterns-kde-kde_plasma      | package | Required
    i+ | plasma5-session              | package | Required
    i+ | polkit-default-privs         | package | Required
    i+ | xdg-user-dirs                | package | Required
    i+ | alsa-plugins-pulse           | package | Recommended
    i+ | baloo5-file                  | package | Recommended
    i+ | baloo5-kioslaves             | package | Recommended
    i+ | baloo5-tools                 | package | Recommended
    i+ | bluedevil5                   | package | Recommended
    i+ | breeze5-wallpapers           | package | Recommended
    i+ | ffmpegthumbs                 | package | Recommended
    i+ | kde-odf-thumbnail            | package | Recommended
    i+ | kde-print-manager            | package | Recommended
    i+ | kdeconnect-kde               | package | Recommended
    i+ | kdegraphics-thumbnailers     | package | Recommended
    i+ | kdenetwork4-filesharing      | package | Recommended
    i+ | kgamma5                      | package | Recommended
    i+ | khelpcenter5                 | package | Recommended
    i+ | kio-extras5                  | package | Recommended
    i+ | kwalletmanager5              | package | Recommended
    i+ | phonon4qt5-backend-gstreamer | package | Recommended
    i+ | pinentry-qt5                 | package | Recommended
    i+ | plasma-nm5                   | package | Recommended
    i+ | plasma5-addons               | package | Recommended
    i+ | plasma5-pa                   | package | Recommended
    i+ | plasma5-pk-updates           | package | Recommended
    i  | plasma5-session-wayland      | package | Recommended
    i+ | pulseaudio                   | package | Recommended
    i+ | pulseaudio-module-x11        | package | Recommended
    i+ | pulseaudio-module-zeroconf   | package | Recommended
    i+ | pulseaudio-utils             | package | Recommended
    i+ | sddm                         | package | Recommended

erlangen:~ # 

I’m talking not about patterns, but about “applications” (that’s another type of package). I didn’t even install any of KDE patterns. “zypper in plasma5-session” installs 22 packages, “zypper rm --clean-deps plasma5-session” removes 6 packages. The only installed patterns are apparmor, base, enhanced_base, minimal_base, sw_management and yanst2_basis.

Recommends ?

No, I disabled them in zypper.conf. “zypper se -i --requires plasma-nm5” shows plasma5-session package and Networks application, “zypper se -i --recommends plasma-nm5” shows plasma-nm5. After removing plasma5-session (which doesn’t remove plasma-nm5 with --clean-deps option) “zypper se -i --requires plasma-nm5” shows only Networks application, “zypper se -i --recommends plasma-nm5” shows plasma-nm5. “zypper if plasma-nm5” says that package is installed automatically, “zypper pa --unneeded” doesn’t find any unneeded packages. The problem is that I didn’t tell zypper to install Networks application, but it prevents plasma-nm5 from being automatically removed.

Try:

erlangen:~ # zypper rm --type application Networks
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 11 packages are going to be REMOVED:
  patterns-kde-kde patterns-kde-kde_imaging patterns-kde-kde_plasma plasma-nm5 plasma-nm5-lang plasma-nm5-openconnect plasma-nm5-openvpn plasma-nm5-pptp plasma-nm5-vpnc plasma5-session plasma5-session-wayland

The following 3 patterns are going to be REMOVED:
  kde kde_imaging kde_plasma

11 packages to remove.
After the operation, 6.3 MiB will be freed.
Continue? [y/n/...? shows all options] (y): n
erlangen:~ # 

I know about this command. What I’m trying to say, is that I shouldn’t tell zypper to do this, plasma-nm5 was installed as dependency. You install package that depends on plasma-nm5, then remove it with --clean-deps and zypper doesn’t remove plasma-nm5. It literally doesn’t do what it supossed to do. It looks more like a bug in zypper.

zypper actually has a rich assortment of concepts:

From man zypper:

Package Dependencies
Software packages depend on each other in various ways. Packages usually require or recommend other packages, but they can also conflict with other packages. Packages may support specific hardware or language settings.
Zypper uses a dependency solver to find out which packages need to be installed to satisfy the user’s request. See <http://old-en.opensuse.org/Software_Management/Dependencies&gt; for more information.

Automatically installed packages
Packages added by the dependency solver in order to resolve a user’s request are remembered as having been ‘automatically installed’. They may later be removed, if no more user installed packages depend on them (e.g. by
zypper remove --clean-deps).

   In the S+tatus+ column the search command distinguishes between user installed packages (i+) and automatically installed packages (i).

Repositories may change and you may end up with unneeded and orphaned items:

erlangen:~ # zypper packages --orphaned --unneeded 
Loading repository data...
Reading installed packages...
S  | Repository             | Name                 | Version    | Arch  
---+------------------------+----------------------+------------+-------
i+ | @System                | iscan                | 2.30.2-2   | x86_64
i+ | @System                | iscan-data           | 1.36.0-1   | noarch
i+ | @System                | iscan-plugin-gt-s650 | 1.1.0-2    | x86_64
i  | Haupt-Repository (OSS) | kwayland-integration | 5.13.4-1.1 | x86_64
i  | Haupt-Repository (OSS) | libqt5-qtwayland     | 5.11.1-2.1 | x86_64
erlangen:~ # 

But I didn’t remove any repositories. I install plasma5-session, which installs plasma-nm5 as dependency (which means that plasma5-session is the only user-installed package depending on plasma-nm5). plasma-nm5 is marked as automatically installed. Right away I remove plasma5-session with “zypper rm --clean-deps plasma5-session”, and it doesn’t remove plasma-nm5. It’s clearly a bug.

I am not sure as plasma-nm5 will be installed as a recommended package even if plasma5-session is not installed:

erlangen:~ # zypper install-new-recommends 
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 6 NEW packages are going to be installed:
  plasma-nm5 plasma-nm5-lang plasma-nm5-openconnect plasma-nm5-openvpn plasma-nm5-pptp plasma-nm5-vpnc

6 new packages to install.
Overall download size: 1.3 MiB. Already cached: 0 B. After the operation, additional 6.2 MiB will be used.
Continue? [y/n/...? shows all options] (y): n
erlangen:~ #

I disabled installation of recommends in zypper conf, and zypper says that no installed packages recommend plasma-nm5, and, after removal of plasma5-session, that no packages require plasma-nm5 (except of Networks application, which is not a package and also rpm doesn’t know about it). Still zypper pa --unneeded doesn’t find anything.

Try openSUSE:Submitting bug reports - openSUSE Wiki