I just upgraded to OpenSUSE 12.2 from OpenSUSE 12.1 by changing all of my repositories to target 12.2 (instead of 12.1). Now that I've upgraded, I've found a bunch of packages that have no repository*, which the YaST Software Manager marks with red text in the version column. I can scroll through these and remove every single one, but I'm wondering if the zypper search (zypper se) or the Software Manager has any way to target/select all of these at once.

*- These packages had a repository (OpenSUSE 12.1 something), but since I replaced those repositories with the 12.2 repositories, they no longer have a repository association. This doesn't create a problem, because the 12.2 repositories should contain everything I need to run my system.

rpm -qa --qf '%-30{DISTRIBUTION} %{NAME}\n'| sort

gives you a list of all repos used by your packages. Finding the ones you don't want is left as an exercise to the reader. :-).

| improve this answer | |

Using Martin's answer/guidance, I wrote a quick script to take a string of packages to remove, zremove.sh:


while read line
        pkgs="$pkgs $line"

zypper rm $pkgs

After noticing that all of my packages "without a repository" had a distribution of openSUSE 12.1 in the rpm query, I issued this command to locate and remove all of them:

rpm -qa --qf '%{DISTRIBUTION} : %{NAME}\n' | grep "openSUSE 12.1 :" | sed 's/openSUSE 12.1 : //' | sudo zremove.sh

This doesn't generally answer the question of how to find all packages without a backing repository, but it did solve my initial issue.

| improve this answer | |

Packages that have 'lost' their repository or were installed directly from a .rpm file will show Repository: @System when you do a zypper info on them. So in theory it should be possible to find them all with a zypper packages --repo @System --installed-only but this is still missing in libzypp (openSUSE Bug 770239 - 'zypper pa' lacks support for @System repo).

As a workaround one has to do a zypper info on each installed package and filter for those who have the repository @System:

rpm -qa --queryformat="%{n}\n" | while read p; do zypper info $p | grep -q '^Repository: @System' && echo $p; done

Quite slow but does the job.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.