Need help with zypper addlock matching

I’m hoping someone can share some wisdom about how zypper addlock matching / globbing works. As a concrete example of what I’m trying to do, how would you construct a pattern that allows a current kernel series to update (in my case I have 6.1.12 installed), but doesn’t allow a new major version to install automatically (6.2.x)?

I can do a broadly matching glob like…

sudo zypper al kernel-de*

And that will certainly match the default kernel packages. But it’s too broad, and I don’t want to hold back updates within a kernel series that I have installed. If I have 6.1 installed, I want the system to update without intervention all the way through 6.1.12, but not update to 6.2.

I’ve tried various things like…

sudo zypper al kernel-default\<=6.2*
sudo zypper al kernel-default=6.2*
sudo zypper al kernel-default=6.1.12

But all of those allow the kernel to update automatically from 6.1.12 to 6.2.x. What am I doing wrong?

@Plow5995 Hi and welcome to the Forum :smile:
Just configure /etc/zypp/zypp.conf to keep that version. See https://forums.opensuse.org/t/no-boot-with-kernel-6-2/164791/15

kernel does not follow semantic versioning, and I don’t recall a patch version being released for a previous minor kernel release. We are at 6.2.x so there would not be any other 6.1.x.

Instead, you should be prepared for a broken kernel upgrade. Setup libzypp/zypper to keep more than the default (running,latest) two kernel versions. For instance, add oldest or latest-1. If a broken kernel appears, select a previous kernel next time, and grub will keep booting that version.

sudo zypper al kernel-default-6.2*

Note that a lock can be overridden by an appropriate answer to zypper asking for permission. It will remove the lock as reported if there are no wildcards in the lock. However when using a wildcard in a lock, zypper will make the same report, but it will merely override the lock, not remove it. Thus, you could lock all kernels with sudo zypper al kernel-de*, and yet remove (or install) selected kernels only by appropriate answers to the questions from sudo zypper rm kernel-default.

To achieve your desired result, you can use a combination of version constraints and wildcards in your zypper addlock command. Here’s an example of a pattern that should work: sudo zypper al 'kernel-default<6.2*’

This will add a lock on all kernel-default packages with a version less than 6.2, which should include all 6.1.x versions but exclude any 6.2.x versions. Note the use of single quotes around the pattern to prevent shell globbing before zypper processes the command.

Alternatively, you could explicitly list the specific versions you want to lock, like this: sudo zypper al kernel-default=6.1.12

This will add a lock on the specific version 6.1.12 of the kernel-default package, which will prevent any updates to a different version, including 6.2.x.

Keep in mind that adding locks to specific packages or versions can potentially cause issues with package dependencies and updates, so use this approach with caution and be sure to review any updates or package changes carefully.

Once 6.2 was published for Tubleweed there will be no more updates for 6.1.

All mine work as expected:

# zypper ll | wc -l
49
# zypper ll | grep \=
# zypper ll | grep \-
---+-----------------------------------------------------------+---------+------------+--------
1  | *-lang                                                    | package | (any)      |
5  | adobe-source*-fonts                                       | package | (any)      |
6  | agfa-font*                                                | package | (any)      |
11 | desktop-data-openSUSE-15.0.20171024-lp153.1.53.noarch.rpm | package | (any)      |
15 | gnome-keyring-pam                                         | package | (any)      |
16 | google-opensans-font*                                     | package | (any)      |
17 | google-poppin*-fonts                                      | package | (any)      |
18 | google-robot*-font*                                       | package | (any)      |
19 | graphviz-gnome                                            | package | (any)      |
23 | gtk?-immodule*                                            | package | (any)      |
28 | kde-oxygen-font*                                          | package | (any)      |
29 | kernel-az*                                                | package | (any)      |
30 | kernel-de*                                                | package | (any)      |
31 | kernel-kv*                                                | package | (any)      |
32 | kernel-pree*                                              | package | (any)      |
33 | kernel-rt*                                                | package | (any)      |
34 | kernel-sy*                                                | package | (any)      |
37 | man-pages-posix                                           | package | (any)      |
38 | misc-console-fon*                                         | package | (any)      |
39 | plasma5-*-branding-openSUSE                               | package | (any)      |
#

I am a bit late to this show, but be aware that, apart from all the good advice given here, this is a dangerous way to live. Whenever there are “characters special to the shell” in a word of the command you type, and you want those characters not to be interpreted by the shell, but going unchanged through to the command (in this case zypper), quote those words!.

zypper al 'kernel-default\<=6.2*'

Even with the slightest doubt: quote! When this good practice becomes an automatic habit, it will save you a lot of (unpleasant) surprises when using the shell.

Wrong. There is extra backslash, which changes the meaning of this string.

Correct observation.

zypper al 'kernel-default<=6.2*'

is already better. It shows that the OP did quote part of what should have been quoted. A case of changing things until it works as hoped for (but not until it was correct)?

Rather than responding to a bunch of the great suggestions individually with some duplicative content, I figured I’d consolidate into one. Unfortunately, none of the responses actually work, and a dup will happily upgrade to 6.2.

sudo zypper al ‘kernel-default<6.2’

foo@localhost:~> uname -r
6.1.12-1-default

foo@localhost:~> sudo zypper al 'kernel-default<6.2*'
Specified lock has been successfully added.
foo@localhost:~> zypper ll

# | Name                  | Type    | Repository | Comment
--+-----------------------+---------+------------+--------
1 | kernel-default < 6.2* | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

The following 16 NEW packages are going to be installed:
  binutils gcc gcc12 kernel-default-6.2.4-1.1 kernel-default-devel-6.2.4-1.1 kernel-devel-6.2.4-1.1 libasan8 libctf0 libctf-nobfd0 libitm1 liblsan0 libtsan2 make site-config virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3 zfs-kmp-default-2.1.9_k6.2.4_1-1.58

The following package requires a system reboot:
  kernel-default-6.2.4-1.1

16 new packages to install.
Overall download size: 270.4 MiB. Already cached: 0 B. After the operation, additional 622.8 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): n

sudo zypper al kernel-default=6.1.12

foo@localhost:~> sudo zypper al kernel-default=6.1.12
Specified lock has been successfully added.
foo@localhost:~> zypper ll

# | Name                    | Type    | Repository | Comment
--+-------------------------+---------+------------+--------
1 | kernel-default = 6.1.12 | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

The following 16 NEW packages are going to be installed:
  binutils gcc gcc12 kernel-default-6.2.4-1.1 kernel-default-devel-6.2.4-1.1 kernel-devel-6.2.4-1.1 libasan8 libctf0 libctf-nobfd0 libitm1 liblsan0 libtsan2 make site-config virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3 zfs-kmp-default-2.1.9_k6.2.4_1-1.58

The following package requires a system reboot:
  kernel-default-6.2.4-1.1

16 new packages to install.
Overall download size: 270.4 MiB. Already cached: 0 B. After the operation, additional 622.8 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): n

Again but this time with the full version string.
sudo zypper al kernel-default=6.1.12-1.1

foo@localhost:~> sudo zypper al kernel-default=6.1.12-1.1
Specified lock has been successfully added.
foo@localhost:~> zypper ll

# | Name                        | Type    | Repository | Comment
--+-----------------------------+---------+------------+--------
1 | kernel-default = 6.1.12-1.1 | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

The following 16 NEW packages are going to be installed:
  binutils gcc gcc12 kernel-default-6.2.4-1.1 kernel-default-devel-6.2.4-1.1 kernel-devel-6.2.4-1.1 libasan8 libctf0 libctf-nobfd0 libitm1 liblsan0 libtsan2 make site-config virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3 zfs-kmp-default-2.1.9_k6.2.4_1-1.58

The following package requires a system reboot:
  kernel-default-6.2.4-1.1

16 new packages to install.
Overall download size: 270.4 MiB. Already cached: 0 B. After the operation, additional 622.8 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): n

sudo zypper al kernel-default-6.2

foo@localhost:~> sudo zypper al kernel-default-6.2*
Specified lock has been successfully added.
foo@localhost:~> zypper ll

# | Name                | Type    | Repository | Comment
--+---------------------+---------+------------+--------
1 | kernel-default-6.2* | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

The following 16 NEW packages are going to be installed:
  binutils gcc gcc12 kernel-default-6.2.4-1.1 kernel-default-devel-6.2.4-1.1 kernel-devel-6.2.4-1.1 libasan8 libctf0 libctf-nobfd0 libitm1 liblsan0 libtsan2 make site-config virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3 zfs-kmp-default-2.1.9_k6.2.4_1-1.58

The following package requires a system reboot:
  kernel-default-6.2.4-1.1

16 new packages to install.
Overall download size: 270.4 MiB. Already cached: 0 B. After the operation, additional 622.8 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): n

The only thing that works so far in sticking to a major kernel version is something like what I mentioned in my original post. But again, I want all upgrades within that major version to happen seamlessly. I don’t want to have to manually update them every time. This example uses 6.1. But I’ll want the same thing soon for 6.2. Let’s say I update to the current 6.2.4 today. I want 6.2.5, 6.2.6, 6.2.7, etc. to happen with no user intervention needed in a dup. But I don’t want 6.3 to install once that is released. At that point I’d change my zypper lock to block 6.3.

foo@localhost:~> sudo zypper al kernel-de*
Specified lock has been successfully added.
foo@localhost:~> zypper ll

# | Name       | Type    | Repository | Comment
--+------------+---------+------------+--------
1 | kernel-de* | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

Problem: the to be installed zfs-kmp-default-2.1.9_k6.2.4_1-1.58.x86_64 requires 'kernel-uname-r = 6.2.4-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.4-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.4-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.4-1.1.25.28.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.4-1.1.25.28.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.4-1.1.25.28.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: deinstallation of zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 3: keep obsolete zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.4-1.1.25.28.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.4-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break zfs-kmp-default-2.1.9_k6.2.4_1-1.58.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

Problem: the to be installed virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3.x86_64 requires 'kernel-uname-r = 6.2.4-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.4-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.4-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.4-1.1.25.28.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.4-1.1.25.28.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.4-1.1.25.28.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: Following actions will be done:
  deinstallation of virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
  deinstallation of virtualbox-7.0.6-5.1.x86_64
 Solution 3: keep obsolete virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.4-1.1.25.28.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.4-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break virtualbox-kmp-default-7.0.6_k6.2.4_1-5.3.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

The following 11 items are locked and will not be changed by any action:
 Available:
  kernel-debug kernel-debug-devel kernel-debug-vdso kernel-default-base kernel-default-base-rebuild kernel-default-vdso
 Installed:
  kernel-default kernel-default-devel kernel-devel virtualbox-kmp-default zfs-kmp-default
Nothing to do.

@Plow5995 Hi, yes you let the kernel upgrade, BUT then you use YaST bootloader to select the kernel to boot as the old one, OR select it from grub.

No need to lock etc, just set the version you wish to keep as I described and carry on with using zypper dup… I doesn’t matter that a newer version is installed, you just want to keep the older one to boot from and not be removed.

Just keep adding the versions you want and rock on…

Thanks for the suggestion. I’m not worried about system breakage and I’m comfortable with snapper rollbacks. Options like configuring that in /etc/zypp/zypp.conf aren’t what I want because that just controls the purge-kernels service. It isn’t that I just want to keep a known good kernel around. I specially don’t want to install a new major kernel version immediately due to compatibility with software that doesn’t update quite as quickly like ZFS.

The zypper addlock functionality seems to be exactly what I need, unfortunately it just doesn’t seem to work for kernel packages. Or it does, and someone out there will have some new syntax suggestion.

man zypper says:

Package Locks Management
Package locks serve the purpose of preventing changes to the set of installed packages on the system. Locks are stored as queries in /etc/zypp/locks file (see also locks(5)).
Packages matching a query are then forbidden to change their installed status; an installed package can’t be removed or upgraded, not installed package can’t be installed.
When requesting to install, upgrade or remove such locked package, you will get a dependency problem dialog

So if you have installed kernel 6.1.x and want all kernels 6.1.n but not kernel 6.2.x then you need to lock any kernel >= 6.2.

Looking at the examples in man locks

EXAMPLES
...
       Versioned Lock
           Do not install new GCC. This format is used when converting from the openSUSE-10.3 lock format.

           -----locks-----
           solvable_name: gcc
           match_type: glob
           version: > 4.2

the entry in /etc/zypp/locks should probably look like this

           solvable_name: kernel-default
           match_type: glob
           version: >= 6.2

What does your current entry in /etc/zypp/locks look like?

1 Like

@Plow5995 so you can always build from source for the third party modules, create an OBS account and link the packages and trigger your own rebuild? Or just grab the src rpms and rpmbuild --rebuild them.

I see zfs packages have been rebuilt for 6.2.4?
https://build.opensuse.org/package/binaries/filesystems/zfs/openSUSE_Tumbleweed

Based on @susejunky post, the correct command line would be:

sudo zypper al 'kernel-de* >= 6.2.0'

Where 6.2 is the major version you don’t want installed.

Which is completely equivalent to “zypper al kernel-default” on Tumbleweed.

On my system (openSUSE Tumbleweed 20230315)

zypper al kernel-default results in

type: package
match_type: glob
case_sensitive: on
solvable_name: kernel-default

and `zypper al ‘kernel-de* >= 6.2.0’ results in

type: package
version: >= 6.2.0
match_type: glob
case_sensitive: on
solvable_name: kernel-de*

To me the two results do not look the same. However I have not tested whether they yield the same resulting behavior.

Considering the current snapshot, it’s equivalent to zypper al kernel-de*, yes, since there would be no other version < 6.2.0. But it appears this command line is sensible, as long as the given major version is not yet available in TW.

Now we are getting somewhere! Thanks for this. It will do what I need, but there were some interesting (at least to me) observations while playing with this some more.

First, the solver is noisier and needs more help when using

sudo zypper al 'kernel-de* >= 6.2.0'

Instead of just answering the questions about the two kmp packages for ZFS and VirtualBox I have to answer 3 more for the kernel and kernel devel packages (including a noarch one?).

foo@localhost:~> uname -r
6.1.12-1-default
foo@localhost:~> zypper ll

# | Name                | Type    | Repository | Comment
--+---------------------+---------+------------+--------
1 | kernel-de* >= 6.2.0 | package | (any)      | 

foo@localhost:~> sudo zypper dup
[sudo] password for root: 
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...
3 Problems:
Problem: problem with the installed kernel-default-6.1.12-1.1.x86_64
Problem: problem with the installed kernel-default-devel-6.1.12-1.1.x86_64
Problem: problem with the installed kernel-devel-6.1.12-1.1.noarch

Problem: problem with the installed kernel-default-6.1.12-1.1.x86_64
 Solution 1: Following actions will be done:
  deinstallation of kernel-default-6.1.12-1.1.x86_64
  deinstallation of virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
  deinstallation of zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
  deinstallation of virtualbox-7.0.6-5.1.x86_64
 Solution 2: keep obsolete kernel-default-6.1.12-1.1.x86_64
 Solution 3: remove lock to allow installation of kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]

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

Problem: problem with the installed kernel-default-devel-6.1.12-1.1.x86_64
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-devel-6.2.6-1.1.i586[download.opensuse.org-oss]
  install kernel-default-devel-6.2.6-1.1.i586 despite the inferior architecture
 Solution 2: deinstallation of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 3: keep obsolete kernel-default-devel-6.1.12-1.1.x86_64
 Solution 4: remove lock to allow installation of kernel-default-devel-6.2.6-1.1.x86_64[download.opensuse.org-oss]

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

Problem: problem with the installed kernel-devel-6.1.12-1.1.noarch
 Solution 1: deinstallation of kernel-devel-6.1.12-1.1.noarch
 Solution 2: keep obsolete kernel-devel-6.1.12-1.1.noarch
 Solution 3: remove lock to allow installation of kernel-devel-6.2.6-1.1.noarch[download.opensuse.org-oss]

Choose from above solutions by number or skip, retry or cancel [1/2/3/s/r/c/d/?] (c): 2
Resolving dependencies...
Computing distribution upgrade...

Problem: the to be installed zfs-kmp-default-2.1.9_k6.2.6_1-1.61.x86_64 requires 'kernel-uname-r = 6.2.6-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.6-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: deinstallation of zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 3: keep obsolete zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break zfs-kmp-default-2.1.9_k6.2.6_1-1.61.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

Problem: the to be installed virtualbox-kmp-default-7.0.6_k6.2.6_1-5.4.x86_64 requires 'kernel-uname-r = 6.2.6-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.6-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: Following actions will be done:
  deinstallation of virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
  deinstallation of virtualbox-7.0.6-5.1.x86_64
 Solution 3: keep obsolete virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break virtualbox-kmp-default-7.0.6_k6.2.6_1-5.4.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

The following 11 items are locked and will not be changed by any action:
 Available:
  kernel-debug kernel-debug-devel kernel-debug-vdso kernel-default-base kernel-default-base-rebuild kernel-default-vdso
 Installed:
  kernel-default kernel-default-devel kernel-devel virtualbox-kmp-default zfs-kmp-default
Nothing to do.

Here it is with using sudo zypper al kernel-de*

foo@localhost:~> zypper ll

# | Name       | Type    | Repository | Comment
--+------------+---------+------------+--------
1 | kernel-de* | package | (any)      | 

foo@localhost:~> sudo zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

Problem: the to be installed zfs-kmp-default-2.1.9_k6.2.6_1-1.61.x86_64 requires 'kernel-uname-r = 6.2.6-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.6-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: deinstallation of zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 3: keep obsolete zfs-kmp-default-2.1.9_k6.1.12_1-1.36.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break zfs-kmp-default-2.1.9_k6.2.6_1-1.61.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

Problem: the to be installed virtualbox-kmp-default-7.0.6_k6.2.6_1-5.4.x86_64 requires 'kernel-uname-r = 6.2.6-1-default', but this requirement cannot be provided
  not installable providers: kernel-default-6.2.6-1.1.i586[download.opensuse.org-oss]
                   kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
                   kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 1: Following actions will be done:
  remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.i586[download.opensuse.org-oss]
  remove lock to allow removal of kernel-default-devel-6.1.12-1.1.x86_64
 Solution 2: Following actions will be done:
  deinstallation of virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
  deinstallation of virtualbox-7.0.6-5.1.x86_64
 Solution 3: keep obsolete virtualbox-kmp-default-7.0.6_k6.1.12_1-3.2.x86_64
 Solution 4: remove lock to allow installation of kernel-default-base-6.2.6-1.1.25.29.x86_64[download.opensuse.org-oss]
 Solution 5: remove lock to allow installation of kernel-default-6.2.6-1.1.x86_64[download.opensuse.org-oss]
 Solution 6: break virtualbox-kmp-default-7.0.6_k6.2.6_1-5.4.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/5/6/c/d/?] (c): 3
Resolving dependencies...
Computing distribution upgrade...

The following 11 items are locked and will not be changed by any action:
 Available:
  kernel-debug kernel-debug-devel kernel-debug-vdso kernel-default-base kernel-default-base-rebuild kernel-default-vdso
 Installed:
  kernel-default kernel-default-devel kernel-devel virtualbox-kmp-default zfs-kmp-default
Nothing to do.

I could always just switch to the latter once a new major version comes out. Ideally I’d be able to pass in something during the dup to default to “keep obsolete”. I played with --solver-focus Installed but that doesn’t do what I want.

The second issue is that the locks never seem to match on installed packages. The above work by the glob matching a package from the repositories. But if I do something like trying to keep the exact installed version, it doesn’t match the installed package and will upgrade to 6.2.x. E.g. one of…

sudo zypper al 'kernel-de* = 6.1.12'
sudo zypper al 'kernel-de* = 6.1.12-1.1'
sudo zypper al 'kernel-default = 6.1.12'
sudo zypper al kernel-default=6.1.12

And in a similar way, your suggestion but using less than or equal seems like it should work.

sudo zypper al 'kernel-de* <= 6.2.0'

That should match the installed 6.1.12 package and hold it, but it doesn’t.

Anyway, thanks for all the help. If anyone has a way to force the solver to use the ‘keep obsolete’ option that would be great.