Keeps kernel of a specific version

I would like to keep the kernel of the specific version, for example 6.5.9.
However, I found there seems to be two ways to specify its version.

kernel-default              | package | 6.5.9-1.3    | x86_64 | (System Packages)
Kernel: 6.5.9-1-default x86_64

So for the parameter of “multiversion.kernels” in /etc/zypp/zypp.conf, which of the following code is the correct way to specify the kernel version?

Is

multiversion.kernels = latest,latest-1,latest-2,latest-3,6.5.9-1.3,oldest,running

or

multiversion.kernels = latest,latest-1,latest-2,6.5.9-1-default,oldest,running

Thank you.

https://en.opensuse.org/SDB:Keep_multiple_kernel_versions

Thank you for your reply.
I have read that page, but still not very sure which of “3,6.5.9-1.3” or “6.5.9-1-default” is the correct way to specify kernel version.
I guess it should be the way of “3,6.5.9-1.3”.
But I am not very sure, that’s why I am asking here.

It is written in both articles and also in /etc/zypp/zypp.conf

## 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
##
## Default: Do not delete any kernels if multiversion = provides:multiversion(kernel) is set

https://en.opensuse.org/SDB:Keep_multiple_kernel_versions#Configure_the_multiversion_kernel_feature

It should be the package version, not the internal kernel version string (output of uname -r).

Rather than config file tinkering, you may use zypper locking instead, as with any installed package:

sudo zypper al kernel-default-6.5.9*

You can be more explict with the version if you wish, but the wildcard has a special meaning to zypper, which is when you wish to override a lock, rather than abandoning a current transaction to remove it, followed by repeating the original transaction, zypper will simply ignore it, while reporting it will “remove” it.

Does

rpm -qf --queryformat '%{VERSION}-%{RELEASE}\n' /boot/vmlinuz

deliver the correct package version?

For my system, it displays:

5.14.21-150500.55.31.1
5.14.21-150500.55.36.1

rpm tells all:

erlangen:~ # rpm -qf /usr/lib/modules/6.6.1-1-default/vmlinuz
kernel-default-6.6.1-1.1.x86_64
erlangen:~ # zypper addlock kernel-default-6.6.1-1.1.x86_64
Specified lock has been successfully added.
erlangen:~ # zypper locks

# | Name                            | Type    | Repository | Comment
--+---------------------------------+---------+------------+--------
1 | kernel-default-6.6.1-1.1.x86_64 | package | (any)      | 

erlangen:~ # 

Yes, it does. The final .1 in package releases is rebuild counter which can be omitted (zypper will compare first the full version+release and then the version+release with stripped off rebuild counter). This is probably more relevant for Tumbleweed where packages may be rebuilt without any functional changes and so without increasing version or release.

Thanks for all yours suggestions. :grinning:

In my system

com@mypc:~> rpm -qf --queryformat '%{VERSION}-%{RELEASE}\n' /boot/vmlinuz
6.5.9-1.3
6.6.1-1.1
6.6.2-1.1

So looks like those are the version number which should be specified in defining the which kernel should be kept.

I had the same confusion with the version numbers so my solution was to use ‘oldest’ in /etc/zypp/zypp.conf
I added it when the new kernel (6.6) was installed so it kept 6.5.9
When the 6.7 comes I’ll comment out ‘oldest’, run zypper purge-kernels and uncomment it again.