0

I'm trying to remove an old kernel from openSUSE. The openSUSE version is Tumbleweed (20191128), and the old kernel is 5.1.16.

The manpage for Zypper is here. It looks like Zypper supports wildcards (if I am parsing the manpage correctly), but I am not getting the syntax correct. I am not sure how to tell the package manager to match the wildcard during the remove.

How do I tell Zypper to remove packages matching *5.1.16*?


> ls /boot/
boot.readme                  sysctl.conf-5.1.16-1-default
config-5.1.16-1-default      sysctl.conf-5.3.12-1-default
config-5.3.12-1-default      System.map-5.1.16-1-default
grub2                        System.map-5.3.12-1-default
initrd                       vmlinux-5.1.16-1-default.gz
initrd-5.1.16-1-default      vmlinux-5.3.12-1-default.gz
initrd-5.3.12-1-default      vmlinuz
symvers-5.1.16-1-default.gz  vmlinuz-5.1.16-1-default
symvers-5.3.12-1-default.gz  vmlinuz-5.3.12-1-default

> sudo zypper remove *5.1.16*
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
'*5.1.16*' not found in package names. Trying capabilities.
No provider of '*5.1.16*' found.
Resolving package dependencies...

Nothing to do.

> sudo zypper remove '*5.1.16*'
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
'*5.1.16*' not found in package names. Trying capabilities.
No provider of '*5.1.16*' found.
Resolving package dependencies...

Nothing to do.

1 Answer 1

1

The wildcards work only for package names, not for version numbers:

To update individual packages, specify one or more package names. You can use the * and ? wildcard characters in the package names to specify multiple packages matching the pattern.

you could however do something like:

rpm -qa | grep "5.1.16" | xargs zypper rm
2
  • Thanks Chris. Forgive my ignorance... Shouldn't the package name have the version in it? Otherwise, how does the package manager differentiate between different versions of the package?
    – jww
    Dec 4, 2019 at 14:39
  • yes, your package files contain the version number in their name, but zypper doesn't really look at the filename but at the metadata that is inside and chose to match only on the package name (not filename)
    – Chris Maes
    Dec 4, 2019 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .