Ask / Submit

Clean out orphaned packages

asked 2014-12-17 08:45:20 +0300

blabber gravatar image

updated 2014-12-17 15:46:43 +0300

dulog gravatar image

Toying around with apps from openrepos pulls in different packages as dependencies. When uninstalling an app only the app and not the orphaned dependencies are removed.

Is there a way to get rid of dangling orphaned dependencies?

edit retag flag offensive close delete


The question is: is it safe? I mean.. An OS that uses dependencies for apps to work, maybe have commond dependencies. The solution for safety (but not for space) is MacOS

palikao ( 2016-12-13 11:16:46 +0300 )edit

3 Answers

Sort by » oldest newest most voted

answered 2014-12-18 10:52:33 +0300

blabber gravatar image

updated 2014-12-18 17:17:49 +0300

Following magullos hint I created following script, that prints all installed packages with their corresponding repository (zypper has to be installed).

#! /bin/sh
pkcon get-packages \
    | awk '/^Install/ { print $2 }' \
    | while read PACKAGE; do
            REPO=`zypper wp "$PACKAGE" \
                    | awk 'BEGIN{FS="|"} /^i/{print $6}'`
            printf '%s\t%s\n' "$PACKAGE" "$REPO"

Filtering further you can at least get all packages installed from openrepos:

sh | awk '$2 ~ "^openrepos" {print $0}'
edit flag offensive delete publish link more

answered 2014-12-17 10:44:23 +0300

I think is not so easy, I've already asked something similar in the past, but could not get a real answer. Here's my suggestion: - install zypper, it's the only way you can get info on packages origin (pkcon doesn't provide this info) ( - with a full list of installed packages, you could do something like (never tried):

pkcon get-packages | grep ^Installed | zypper what-provides

It should show installed packages and their info. You should be able to remove unwanted packages from here.

edit flag offensive delete publish link more


You should put this as an answer, very good job! Thanks!

magullo ( 2014-12-18 15:44:59 +0300 )edit

Done. Thanks for the hint ;)

blabber ( 2014-12-18 17:18:40 +0300 )edit

Doesn't work (PackageKit blocks zypper).

V10lator ( 2015-09-30 16:39:47 +0300 )edit

Probably related to new enforcing policies. Which SO version are you using?

magullo ( 2015-09-30 16:55:04 +0300 )edit ...

V10lator ( 2015-09-30 16:57:10 +0300 )edit

answered 2016-12-12 16:04:57 +0300

ghling gravatar image

You can do it the manual way by listing all packages that were installed as dependency and then removing each one by hand:

First, list the packages, that were recently installed with:

rpm -qa --last | head

This lists the last 10 packages, which may include those that are installed when you enable developer mode. In this case, just omit "| head", so the command ist: rpm -qa --last

Now, you should (hopefully) find all packages that were installed at the same time with the package you want to remove. Remove them with

pkcon remove <packages (without version number)>
edit flag offensive delete publish link more
Login/Signup to Answer

Question tools



Asked: 2014-12-17 08:45:20 +0300

Seen: 1,521 times

Last updated: Dec 12 '16