4

In a system using Zypper for package management (openSuse, in my case) how can one get a list of all installed packages that are not associated with a currently enabled repository?

Real problem: When upgrading distributions (e.g., from openSuse 12.1 to 12.2), I disable all non-standard repositories that I've enabled. Often, I only added them to get a new version of a particular tool, but that newer version is included by default in the updated distribution. Sometimes though, additional packages were installed from the repository, but I don't know how to detect those. The system works, but those packages will never be updated since I removed the providing repository after the upgrade.

David B.
  • 245
  • 1
  • 3
  • 7

3 Answers3

3

The option pa is probably more appropriate:

zypper pa -i

lists all the installed packages and their available versions and repositories. You can choose to list only the packages belonging to a certain repository with the -r flag:

zypper pa -i -r openSUSE-12.1

from there on you can use the strategies proposed by @ernestopheles to find the ones matching your needs.

Chris Maes
  • 586
  • 3
  • 11
  • I've started using `zypper pa -i | grep @System`; I used to use `zypper search -i -s -t package | grep "| (System Packages)\s*$"` – ShadSterling Jun 17 '17 at 13:20
3

It is a bit about messing around with zypper inquiries.

1) Find installed packages, which come from non-opensuse-distribution-repositories:

zypper search -s | grep "i |" | grep -vi "| patch" | grep -vi "| opensuse" > list1.txt

2) Find packages, which are available from opensuse repositories (no matter whether they are installed or not):

zypper search -s | grep "v |" | grep -vi "| patch" | grep -i "| opensuse" > list2.txt

3) Identify packages from list1, which are not represented in list2:

cat list1.txt | cut -d " " -f3 | cut -d " " -f1 | while read line
do
    if [ "$(cat list2.txt | grep -i $line)" = "" ]; then
        echo "$line"
    fi
done

This should kind of solve the case (tested on openSUSE 11.3).

s-m-e
  • 381
  • 1
  • 12
2

In more recent versions of openSUSE you can use

zypper pa --orphaned

to list those packages.