Bug 1220800 - purge kernels does not work
Summary: purge kernels does not work
Status: RESOLVED INVALID
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Kernel (show other bugs)
Version: Current
Hardware: x86-64 openSUSE Tumbleweed
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: openSUSE Kernel Bugs
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-01 16:46 UTC by Michael Hirmke
Modified: 2024-03-01 19:50 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hirmke 2024-03-01 16:46:15 UTC
Running purge-kernels.service doesn't do anything on my machine.
I tested with touching /boot/do_purge_kernels and starting the service:

systemd[1]: Starting Purge old kernels...
systemd[1]: Started Purge old kernels.
zypper[13717]: Reading installed packages...
zypper[13717]: Preparing to purge obsolete kernels...
zypper[13717]: Configuration:
zypper[13717]: Running kernel release: 6.7.6-1-default
zypper[13717]: Running kernel arch: x86_64
zypper[13717]: Resolving package dependencies...
zypper[13717]: Nothing to do.
systemd[1]: purge-kernels.service: Deactivated successfully.

I use a file in /etc/zypp/multiversion.d, containing:

provides:multiversion(6.5.9-1.3)
provides:multiversion(6.6.11-1.1)
provides:multiversion(latest-2)
provides:multiversion(latest-1)
provides:multiversion(latest)
provides:multiversion(running)

In /etc/zypp.conf I commented out all multiversion settings, but it also doesn't work with them activated.
Comment 1 Michael Hirmke 2024-03-01 16:46:58 UTC
Same when running

zypper purge-kernels
Comment 2 Michal Suchanek 2024-03-01 16:54:25 UTC
Any reason why it should do anything?

What is /etc/zypp/multiversion.d and where it is documented?
Comment 3 Michael Hirmke 2024-03-01 17:25:41 UTC
It is documented in zypp.conf:

##
## Defining directory which may contain additional multiversion definitions.
##
## If the directory exists, each file in this directory is scanned, expecting
## one valid multiversion list entry per line. Empty lines and lines starting
## with '#' are ignored.
## ------------------------- [/etc/zypp/multiversion.d/example file begin] -----------------------
## # An alternate way to enable kernel packages being
## # installed in parallel:
##
## provides:multiversion(kernel)
## ------------------------- [/etc/zypp/multiversion.d/example file end] -----------------------
##
## Valid values: A directory
## Default value: {configdir}/multiversion.d
##
## multiversiondir = /etc/zypp/multiversion.d
Comment 4 Michal Suchanek 2024-03-01 18:02:18 UTC
Your file is, however, not in this format.

Also you did not say why do you expect purge-kernels to do anything in particular.
Comment 5 hui 2024-03-01 18:05:49 UTC
- you run purge-kernels
- you set up multiversion

Both points are fine. But this report lacks all informations which explain what the problem is.

- how many kernels are actaully installed?
- what do you expect from purge-kernels?
- what do you expect from purge-kernels when there are no kernels to purge at all?
- what is the actual error?


purge-kernels only removes all excess kernels that are not defined in any multiversion setting.
Comment 6 Michal Suchanek 2024-03-01 18:12:59 UTC
Apparently there is no error, and nothing to remove as seen in the original report:

zypper[13717]: Nothing to do.
systemd[1]: purge-kernels.service: Deactivated successfully.
Comment 7 Michael Hirmke 2024-03-01 18:41:21 UTC
(In reply to Michal Suchanek from comment #6)
> Apparently there is no error, and nothing to remove as seen in the original
> report:
> 
> zypper[13717]: Nothing to do.
> systemd[1]: purge-kernels.service: Deactivated successfully.

Probably my file has the wrong syntax, but the following kernels are installed:

kernel-default-6.5.9-1.3
kernel-default-6.6.1-1.1
kernel-default-6.6.10-1.1
kernel-default-6.6.11-1.1
kernel-default-6.6.2-1.1
kernel-default-6.6.3-1.1
kernel-default-6.6.6-1.1
kernel-default-6.6.7-1.1
kernel-default-6.6.9-1.1
kernel-default-6.7.2-1.3
kernel-default-6.7.4-1.1
kernel-default-6.7.5-1.1
kernel-default-6.7.6-1.1

So with

provides:multiversion(6.5.9-1.3)
provides:multiversion(6.6.11-1.1)
provides:multiversion(latest-2)
provides:multiversion(latest-1)
provides:multiversion(latest)
provides:multiversion(running)

I'd expect these ones to be removed:

kernel-default-6.6.1-1.1
kernel-default-6.6.10-1.1
kernel-default-6.6.2-1.1
kernel-default-6.6.3-1.1
kernel-default-6.6.6-1.1
kernel-default-6.6.7-1.1
kernel-default-6.6.9-1.1

Not correct?
Comment 8 Michael Hirmke 2024-03-01 18:43:02 UTC
(In reply to Michal Suchanek from comment #4)
> Your file is, however, not in this format.
> 

So what would be the correct format?
Comment 9 Michal Suchanek 2024-03-01 19:03:27 UTC
(In reply to Michael Hirmke from comment #3)

> ## provides:multiversion(kernel)

Also from the same file:

## Comma separated list of kernel packages to keep installed in parallel, if the
## above multiversion variable is set. Packages can be specified as
## 2.6.32.12-0.7 - Exact version to keep
## latest        - Keep kernel with the highest version number
## latest-N      - Keep kernel with the Nth highest version number
## running       - Keep the running kernel
## oldest        - Keep kernel with the lowest version number (the GA kernel)
## oldest+N      - Keep kernel with the Nth lowest version number
##
## Note: This entry is not evaluated by libzypp, but by the
##       purge-kernels service (via /sbin/purge-kernels).
##
## Default: Do not delete any kernels if multiversion = provides:multiversion(kernel) is set
multiversion.kernels = latest,latest-1,running
Comment 10 Michael Hirmke 2024-03-01 19:10:41 UTC
(In reply to Michal Suchanek from comment #9)
> (In reply to Michael Hirmke from comment #3)
> 
> > ## provides:multiversion(kernel)
> 
> Also from the same file:
> 
> ## Comma separated list of kernel packages to keep installed in parallel, if
> the
> ## above multiversion variable is set. Packages can be specified as
> ## 2.6.32.12-0.7 - Exact version to keep
> ## latest        - Keep kernel with the highest version number
> ## latest-N      - Keep kernel with the Nth highest version number
> ## running       - Keep the running kernel
> ## oldest        - Keep kernel with the lowest version number (the GA kernel)
> ## oldest+N      - Keep kernel with the Nth lowest version number
> ##
> ## Note: This entry is not evaluated by libzypp, but by the
> ##       purge-kernels service (via /sbin/purge-kernels).
> ##
> ## Default: Do not delete any kernels if multiversion =
> provides:multiversion(kernel) is set
> multiversion.kernels = latest,latest-1,running

Sorry, I didn't get that - I already commented out
## provides:multiversion(kernel)

Or do you mean, the syntax is
multiversion.kernels = latest,latest-1,running
also in multiversiond.d/xyz?

This would mean, I can't have an extra line for every kernel version to keep?
Comment 11 hui 2024-03-01 19:32:05 UTC
You should read zypp.conf in complete.

Your content of /etc/zypp/multiversion.d is invalid. The correct format is "provides:multiversion(kernel)". Nothing more nothin less. No versions. 
This file only defines Packages (names) which can be installed in different versions at the same time. But as the kernel package is already defined as "multiversion = provides:multiversion(kernel)" one chapter above in zypp.conf, your /etc/zypp/multiversion.d is useless at all...

To define which kernels you want to keep, you need to utilise the "multiversion.kernels = latest,latest-1,latest-2,latest-3,running" line as explained in zypp.conf.
Comment 12 Michael Hirmke 2024-03-01 19:38:33 UTC
(In reply to hui from comment #11)
> You should read zypp.conf in complete.
> 
> Your content of /etc/zypp/multiversion.d is invalid. The correct format is
> "provides:multiversion(kernel)". Nothing more nothin less. No versions. 
> This file only defines Packages (names) which can be installed in different
> versions at the same time. But as the kernel package is already defined as
> "multiversion = provides:multiversion(kernel)" one chapter above in
> zypp.conf, your /etc/zypp/multiversion.d is useless at all...
> 
> To define which kernels you want to keep, you need to utilise the
> "multiversion.kernels = latest,latest-1,latest-2,latest-3,running" line as
> explained in zypp.conf.

Ok, thx - I've read the file in complete, but obviously I misunderstood it.
So a file in mulitversion.d could contain

provides:multiversion(kernel)
provides:multiversion(package1)
provides:multiversion(package2)
...

So there is no way I could add one line per version I'd like to keep?
Comment 13 Michal Suchanek 2024-03-01 19:39:19 UTC
It's for the one and only provides:multiversion(kernel)

##
## Packages which can be installed in different versions at the same time.
##
## Packages are selected either by name, or by provides. In the later case
## the string must start with "provides:" immediately followed by the capability.
##
## Example:
##      kernel                          - just packages whith name 'kernel'
##      provides:multiversion(kernel)   - all packages providing 'multiversion(kernel)'
##                                        (kenel and kmp packages should do this)
## Valid values:
##      Comma separated list of packages.
##
## Default value:
##      empty
##
multiversion = provides:multiversion(kernel)

##
## Defining directory which may contain additional multiversion definitions.
##
## If the directory exists, each file in this directory is scanned, expecting
## one valid multiversion list entry per line. Empty lines and lines starting
## with '#' are ignored.
## ------------------------- [/etc/zypp/multiversion.d/example file begin] -----------------------
## # An alternate way to enable kernel packages being
## # installed in parallel:
##
## provides:multiversion(kernel)
## ------------------------- [/etc/zypp/multiversion.d/example file end] -----------------------
##
## Valid values: A directory
## Default value: {configdir}/multiversion.d
##
# multiversiondir = /etc/zypp/multiversion.d
Comment 14 Michael Hirmke 2024-03-01 19:50:13 UTC
Thx4all!