Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers 3

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. :-).

share|improve this answer
add comment
up vote 0 down vote accepted

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

#!/bin/sh

pkgs=""
while read line
do
        pkgs="$pkgs $line"
done

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.

share|improve this answer
add comment

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 I 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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