OpenSUSE LEAP 15.0 - Can not remove old installed kernels

Here is the problem. I want to upgrade from LEAP 15.0 to 15.1.

I ran the repository refresh and system update as a start. In the past I’ve been concerned that my root system was a bit small (it’s around 24GB) and that old kernels might cause the new system to run out of disk space, so I learned to remove older kernels using zypper.
Today I noticed that my root directory was down to around 5GB and I was concerned that there might be old kernels still installed. So I checked and sure enough there are a ton of kernels listed with zypper se -s ‘kernel*’. So I decided to look up how to remove them again, both with Yast and zypper. There were so many kernels and related dependencies that I preferred not to do it with zypper, but preferably with Yast.

I looked up how to manage multiple versions of kernels with Yast. The docs say that you go to View -> Packages -> Mutliversion Packages, then check the Versions tab for the package of interest. Then to remove undesired versions you click the white box until the box gets a red check mark, and then accept and the unwanted version is removed.

Well, I click on the white box and I get a green arrow, indicating that version will be installed - and no matter how I click, there is no red check mark indicating how to uninstall that version. Unless I’m missing something I can’t remove old kernels using Yast.

So I resign myself to doing it via zypper. So I use the above search command to list the installed kernels, and I key in, for example, zypper rm kernel-default-4.12.14-lp150.11.4 - which is one of the kernels which are listed in the search output with a “v” in the status column indicating it is “another version installed”. I get the following response from zypper:


zypper rm kernel-default-4.12.14-lp150.11.4
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
Package 'kernel-default-4.12.14-lp150.11.4' not found.
Resolving package dependencies...
Nothing to do.

  1. It would seem the repositories are broken - except they show up fine in Yast and zypper; or 2) that for some reason it can’t find the kernel-default package which zypper itself has listed as being installed.

Here are my repos as listed by zypper:


Repository priorities in effect:                                                                                                                                                                                                               (See 'zypper lr -P' for details)
      90 (raised priority)  :  1 repository  
      99 (default priority) : 17 repositories

#  | Alias                               | Name                                    | Enabled | GPG Check | Refresh | URI                                                                                            
---+-------------------------------------+-----------------------------------------+---------+-----------+---------+------------------------------------------------------------------------------------------------
 1 | Kernel:stable                       | Kernel:stable                           | No      | ----      | ----    | https://download.opensuse.org/repositories/Kernel:/stable/standard                             
 2 | MEGAsync                            | MEGAsync                                | Yes     | (r ) Yes  | Yes     | https://mega.nz/linux/MEGAsync/openSUSE_Leap_15.0/                                             
 3 | download.opensuse.org-non-oss       | Main Repository (NON-OSS)               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.0/repo/non-oss/                              
 4 | download.opensuse.org-non-oss_1     | Update Repository (Non-Oss)             | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.0/non-oss/                                         
 5 | download.opensuse.org-oss           | Main Repository (OSS)                   | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.0/repo/oss/                                  
 6 | download.opensuse.org-oss_1         | Main Update Repository                  | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.0/oss                                              
 7 | google-chrome                       | google-chrome                           | Yes     | (r ) Yes  | Yes     | http://dl.google.com/linux/chrome/rpm/stable/x86_64                                            
 8 | http-download.opensuse.org-032dc754 | home:jmairboeck                         | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/home:/jmairboeck/openSUSE_Leap_15.0/                 
 9 | http-download.opensuse.org-5941b6aa | X11:Unity                               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/X11:/Unity/openSUSE_Leap_15.0/                       
10 | http-download.opensuse.org-722b7fe1 | openSUSE:Leap:15.0:Update               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.0/oss/                                             
11 | http-download.opensuse.org-a1e8b295 | home:awissu:NonFree                     | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/home:/awissu:/NonFree/openSUSE_Leap_15.0/            
12 | kernel-repo                         | kernel-repo                             | No      | ----      | ----    | http://download.opensuse.org/repositories/Kernel:/HEAD/standard/                               
13 | openSUSE-Leap_15.0-1_1              | openSUSE-Leap 15.0-1                    | Yes     | (r ) Yes  | No      | iso:///?iso=openSUSE-Leap-15.0-DVD-x86_64.iso&url=dir%3A%2FData5%2FLinuxPrograms2%2FOpenSUSEISO
14 | openSUSE_Leap_15.0                  | openSUSE_Leap_15.0 KDE:Applications     | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/KDE:/Applications:/18.04/openSUSE_Leap_15.0/         
15 | openSUSE_Leap_15.0_1                | openSUSE_Leap_15.0 KDE:Extra            | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/KDE:/Extra/openSUSE_Leap_15.0/                       
16 | openSUSE_Leap_15.0_2                | Mozilla                                 | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/mozilla/openSUSE_Leap_15.0/                          
17 | packman                             | packman                                 | Yes     | (r ) Yes  | Yes     | http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.0/                             
18 | repo-debug                          | openSUSE-Leap-15.0-Debug                | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.0/repo/oss/                            
19 | repo-debug-non-oss                  | openSUSE-Leap-15.0-Debug-Non-Oss        | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.0/repo/non-oss/                        
20 | repo-debug-update                   | openSUSE-Leap-15.0-Update-Debug         | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.0/oss/                                       
21 | repo-debug-update-non-oss           | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.0/non-oss/                                   
22 | repo-source                         | openSUSE-Leap-15.0-Source               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/source/distribution/leap/15.0/repo/oss/                           
23 | repo-source-non-oss                 | openSUSE-Leap-15.0-Source-Non-Oss       | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/source/distribution/leap/15.0/repo/non-oss/                       
24 | teamviewer                          | TeamViewer - x86_64                     | Yes     | (r ) Yes  | No      | http://linux.teamviewer.com/yum/stable/main/binary-x86_64/       

The reason I have kernel-repo and kernel-stable is because I was messing around with kernels back when I had an issue that I wanted to be sure that openSUSE Leap 15 could report proper temperature on my new AMD Ryzen machine last December. Apparently new kernels weren’t available for Leap 15.0, so I added kernel repositories to get later kernels. I’m not sure if that has anything to do with the current issue.

I had the following in /etc/zypp/zypp.conf:

linux-2ywh:/home/richardhack # cat /etc/zypp/zypp.conf | grep multiversion
##      provides:multiversion(kernel)   - all packages providing 'multiversion(kernel)'
multiversion = provides:multiversion(kernel)
## Defining directory which may contain additional multiversion definitions.
## one valid multiversion list entry per line. Empty lines and lines starting
## ------------------------- [/etc/zypp/multiversion.d/example file begin] -----------------------
## provides:multiversion(kernel)
## ------------------------- [/etc/zypp/multiversion.d/example file end] -----------------------
## Default value: {configdir}/multiversion.d
# multiversiondir = /etc/zypp/multiversion.d
## above multiversion variable is set. Packages can be specified as
## Default: Do not delete any kernels if multiversion = provides:multiversion(kernel) is set
multiversion.kernels = latest,latest-1,running, oldest


I assume the presence of “oldest” is why I had these old kernels around. I changed that to remove oldest, so now I only have latest, latest-1, and running.

I also checked the purge kernels service and it was enabled and it ran after the zypper update I did but it did not remove the really old kernels.

I also note this bug report here:

**Bug 1117086 - **Automatic cleanup of old kernels not working
https://bugzilla.opensuse.org/show_bug.cgi?id=1117086

I have these kernels installed and they are fine:


linux-2ywh:/home/richardhack # zypper se -si 'kernel*'
Loading repository data...
Reading installed packages...

S  | Name                 | Type    | Version              | Arch   | Repository       
---+----------------------+---------+----------------------+--------+------------------
i+ | kernel-default       | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-default       | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)
i+ | kernel-default-devel | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-default-devel | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)
i+ | kernel-devel         | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-devel         | package | 5.2.rc5-3.1.ga562f5a | noarch | (System Packages)
i+ | kernel-docs          | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-firmware      | package | 20190618-267.1       | noarch | (System Packages)
i+ | kernel-macros        | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-source        | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-source        | package | 5.2.rc5-3.1.ga562f5a | noarch | (System Packages)
i+ | kernel-syms          | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-syms          | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)


But I also have all these installed according to the search command:


v  | kernel-default                  | package    | 4.12.14-lp150.12.61.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.61.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.58.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.58.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.48.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.48.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.45.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.45.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.28.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.28.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.25.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.25.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.22.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.22.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.19.2    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.19.2    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.16.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.16.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.13.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.13.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.10.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.10.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.7.1     | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.7.1     | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.4.1     | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.4.1     | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.11.4       | x86_64 | Main Repository (OSS)    
v  | kernel-default                  | package    | 4.12.14-lp150.11.4       | x86_64 | openSUSE-Leap 15.0-1    

Those are the ones I’d like to get rid of. So how I can force the system to remove these old kernels I have hanging around?

Thanks in advance for any assistance.

Did you try what was suggested near the end of the bug report you’re referencing?

touch /boot/do_purge_kernels and reboot. After the reboot, please post the output of
sudo systemctl status purge-kernels

Posting status of course is suggested only if your kernels aren’t purged according to your current configuration what to retain.

BTW -
You shouldn’t have installed kernel sources and kernel syms… Unless you’re actually building kernels you won’t need source packages… and don’t have any idea why you’d need syms…

TSU

v  | kernel-default                  | package    | 4.12.14-lp150.12.61.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.61.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.58.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.58.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.48.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.48.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.45.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.45.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.28.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.28.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.25.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.25.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.22.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.22.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.19.2    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.19.2    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.16.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.16.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.13.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.13.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.10.1    | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.10.1    | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.7.1     | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.7.1     | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.12.4.1     | x86_64 | Main Update Repository   
v  | kernel-default                  | package    | 4.12.14-lp150.12.4.1     | x86_64 | openSUSE:Leap:15.0:Update
v  | kernel-default                  | package    | 4.12.14-lp150.11.4       | x86_64 | Main Repository (OSS)    
v  | kernel-default                  | package    | 4.12.14-lp150.11.4       | x86_64 | openSUSE-Leap 15.0-1

These kernels are not installed.

But I also have all these installed according to the search command:

If you mean:

zypper se -s kernel

That shows all avaible Kernels (installed and not installed).
Only this shows installed kernel:

linux-2ywh:/home/richardhack # zypper se -si 'kernel*'
Loading repository data...
Reading installed packages...

S  | Name                 | Type    | Version              | Arch   | Repository       
---+----------------------+---------+----------------------+--------+------------------
i+ | kernel-default       | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-default       | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)
i+ | kernel-default-devel | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-default-devel | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)
i+ | kernel-devel         | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-devel         | package | 5.2.rc5-3.1.ga562f5a | noarch | (System Packages)
i+ | kernel-docs          | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-firmware      | package | 20190618-267.1       | noarch | (System Packages)
i+ | kernel-macros        | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-source        | package | 5.2.rc7-1.1.g2d405cc | noarch | (System Packages)
i+ | kernel-source        | package | 5.2.rc5-3.1.ga562f5a | noarch | (System Packages)
i+ | kernel-syms          | package | 5.2.rc7-1.1.g2d405cc | x86_64 | (System Packages)
i+ | kernel-syms          | package | 5.2.rc5-3.1.ga562f5a | x86_64 | (System Packages)

See man zypper

I did do the touch and the reboot. No apparent effect.

I don’t recall specifically asking for sources and syms - although I might have. More likely some package I installed at some point requested it or installed them by default. I can’t answer that question.

Does not the “v” status mark indicate “additional also installed”? What does that mean if they are not installed?

I also did the zypper search to show only installed kernels, which is what I listed.

So if those kernels are not installed, how can I remove them from the listing, since I don’t particularly need to see them. Does the system keep track of everything that used to be installed?

Does not the “v” status mark indicate “additional also installed”? What does that mean if they are not installed? I just looked at the zypper manual and it says this:

The Status column can contain the following values:

           i       installed
           v       a different version is installed

Why would it say a “different version is installed” if in fact they aren’t installed? That makes no sense. Or does it mean “this version is not installed - a different version is installed” - that would make more sense.

I also did the zypper search to show only installed kernels, which is what I listed.

So if those kernels are not installed, how can I remove them from the listing, since I don’t particularly need to see them. Does the system keep track of everything that used to be installed?

Sorry, botched the edit so it replied twice.

As it turns out, dkms wanted those packages. I wasn’t aware of that of what dkms is, so I looked it up in Yast and apparently I don’t need it, so I got rid of it and then got rid of the source and syms package. Those two gained me another 3GB of space in the root directory, which might be enough to enable me to upgrade to 15.1.

Still not sure why I’m seeing all these packages that aren’t installed - or used to be installed - however? Any way I can get rid of them, or is that list of packages just all the stuff the repos have available for installation? If that’s the case, I guess I don’t have anything to worry about space-wise, as I have around 8.6GB of root space remaining out of the 24GB I have allocated to the root directory.

Think of the “v” status as meaning “other aVailable versions”

So if those kernels are not installed, how can I remove them from the listing, … ?

It would have helped if you had included the actual command that was typed. The command you want is (from a recently upgraded machine):

rayh@yoga3:~> zypper se -i -s kernel
Loading repository data...
Reading installed packages...

S  | Name            | Type    | Version               | Arch   | Repository       
---+-----------------+---------+-----------------------+--------+------------------
i+ | kernel-default  | package | 4.12.14-lp150.12.61.1 | x86_64 | (System Packages)
i+ | kernel-default  | package | 4.12.14-lp151.28.7.1  | x86_64 | 15.1-update      
i  | kernel-firmware | package | 20190312-lp151.2.3.1  | noarch | 15.1-update      
rayh@yoga3:~>

P.S. Does anyone know the significance of the “i+” as compared to “i” status?

Or does it mean “this version is not installed - a different version is installed”

Yes.
You have installed kernel-default in Version 5.2.xxxxx, but you could also install it in Version 4.4.yyyyy.

I just looked that up in the zypper man page, It says “**i+ **installed by user request” - as opposed to “iinstalled automatically (by the resolver, see section Automatically installed packages)”.

Where I got confused was that v is explained as “a different version is installed” - and I interpreted “is installed” to mean a previous version is still installed. The way it should be worded is “this version is not installed.” Oh, well…

When you install an application that requires kernel modules to be built,
You can optionally enable dkms which will enable your kernel modules to automatically update with each kernel module update.
If you compile your kernel modules without dkms support, then each time your kernel is upgraded, your existing kernel modules may cease to function and you’ll have to re-build them each time it happens.

That may have also been when you incorrectly added kernel soruce and sym packages… As I described those are not used for building kernel modules. Instead, you would have been required to install the kernel development packages which provide the kernel source headers, not the kernel source.

TSU