Keeping kernel version from upgrading

Hello everyone, i have been running Tumbleweed for some time now and currently have kernel 6.9.1-1-default installed, is there a way to edit zypp.conf to make zypper keep the current kernel version untouched when i do zypper dup? i am happy with the current version and i dont want my kernel to be upgraded everytime when i do upgrade. Thanks in advance.

Lock the package?

Can i lock it throu zypp.conf file? not from yast

No. You can keep it from being purged, you cannot prevent installation of new kernels.

sudo zypper al kernel-de* will prevent both installation and removal of kernel-default, but would allow installation and removal of kernel-longterm. The system keeps such locks in /etc/zypp/locks, not in /etc/zypp/zypp.conf.

If you should wish to install a locked package, you may remove the lock with sudo zypper rl kernel-de* or sudo zypper rl kernel-default (whichever actually exists); or by sudo zypper in kernel-default[-<version>] and selecting from among the solutions presented by choosing remove lock. If a wildcard is included in a lock, then when remove lock is selected, zypper will not remove the lock, but instead ignore its existence and proceed with the transaction.

Thanks it seems this is the solution i am looking for, so instead of sudo zypper al kernel-de* can i use sudo zypper al kernel-default ? or maybe put the full kernel version inside ?

Using the full version in the lock will allow other versions to be added or removed. The difference in effect between the two rl examples I started with is zypper’s behavior when breach of lock is attempted, as explained in the last sentence of my prior response, remove vs. ignore as actual action when “remove” lock is selected.

1 Like

Thanks you very much for taking your time to help, the solution works. :slight_smile:

If you lock the kernel, you may also wish/need to lock closely related items such as virtual-box or the nvidia-driver. If these are not locked they make break or cause problems with later updates.

What I do is:

zypper al kernel-de* nvidia*G06* virtualbox*

I normally remove all these all these locks when I want update any of these related components.

In case the update doesn’t go well, have a plan on how to back out, either by using snapper, or via some other kind of backup. (Because I use ext4 for root, I also maintain an rsync duplicate of root which I refresh before any major update. I have scripts that slightly alter the duplicate to the point where it is bootable and where grub2-mkconfig/osprober on the original root will include the duplicate as a boot option.)

Removing them is an unnecessary step if you plan to relock them after upgrade. As I wrote, when locks include wild cards, zypper’s response substitutes ignore for remove.

# zypper al kernel-firmware-*
Specified lock has been successfully added.
# zypper up kernel-firmware-*
Loading repository data...
Reading installed packages...
Resolving package dependencies...
2 Problems:
Problem: 1: conflicting requests
Problem: 2: conflicting requests

Problem: 1: conflicting requests
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-firmware-intel-20240519-1.1.noarch[OSS]
  remove lock to allow removal of kernel-firmware-intel-20240510-2.1.noarch
 Solution 2: do not ask to install a solvable providing kernel-firmware-intel.noarch = 20240519-1.1

Choose from above solutions by number or skip, retry or cancel [1/2/s/r/c/d/?] (c): 1

Problem: 2: conflicting requests
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-firmware-radeon-20240519-1.1.noarch[OSS]
  remove lock to allow removal of kernel-firmware-radeon-20240510-2.1.noarch
 Solution 2: do not ask to install a solvable providing kernel-firmware-radeon.noarch = 20240519-1.1

Choose from above solutions by number or skip, retry or cancel [1/2/s/r/c/d/?] (c): 1

Resolving dependencies...
Resolving package dependencies...
The following 2 packages are going to be upgraded:
  kernel-firmware-intel kernel-firmware-radeon

2 packages to upgrade.
Overall download size: 0 B. Already cached: 11.7 MiB. No additional space will be used or freed after the operation.

Backend:  classic_rpmtrans
Continue? [y/n/v/...? shows all options] (y): y

Checking for file conflicts: ..............................................[done]
In cache kernel-firmware-intel-20240519-1.1.noarch.rpm  (1/2),        8.9 MiB
(1/2) Installing: kernel-firmware-intel-20240519-1.1.noarch ...............[done]
In cache kernel-firmware-radeon-20240519-1.1.noarch.rpm (2/2),        2.8 MiB
(2/2) Installing: kernel-firmware-radeon-20240519-1.1.noarch ..............[done]
Running post-transaction scripts ..........................................[done]

# zypper ll | grep mwar
46  | kernel-firmware-*    | package | (any)      |

Thanks, I was originally doing as you suggest.

My problem is remembering/finding what to be explicit about on zypper in ... line. For example, on my desktop, kernel-de* actually matches several different items:

zypper se kernel-de* | grep '^il'
il | kernel-default                 | The Standard Kernel                                           | package
il | kernel-default-devel           | Development files necessary for building kernel modules       | package
il | kernel-devel

And it’s similar with nvidia*G06* virtualbox*.

Finding myself uncertain as to what to put for ..., I find it easier to just removed the locks, do a zypper dup, and then relock using wildcards. But, yes, if I had a good grip on what’s required, I could leave the locks and just be explicit with zypper in .... Or, if I’m careful, the arguments to zypper in ... could be scripted.

You might be interested in this.

multiple kernel

By editing /etc/zypp/zypp.conf, you can keep the multiple kernel version at the same time.
And you can then set in YAST the default boot kernel.

1 Like

The following, in conjunction with kernel locking, allows the admin to decide if and when to install or remove a kernel:

# systemctl list-unit-files | grep purg
purge-kernels.service                  masked          enabled
# rpm -qa | egrep 'nel-def|nel-lon' | sort

I think this is a good option for those who only need to keep specific kernels and no other related packages.

I was using this (multiversion.kernels in /etc/zypp/zypp.conf), but nvidia and virtualbox updates would sometimes trip us this approach. I changed to zypper locking to better keep the kernel, nvidia, virtualbox in sync. Many would not have these extra requirements, so multiversion.kernels might be easier for those folk.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.