Blacklist specific version of a package in Zypper

I know that Zypper can lock packages, but I am wondering if Zypper can block just a certain version of a package. (On a side note, I don’t like forcing users to use the English SDB site with the “en” in the URL’s domain; is there a generic URL I can use?)

In my particular case, I have found that the latest kernel version causes problems on my computer, so I want to remove that version and use an older version. However, I don’t want to cease all updates to the kernel. I tried

zypper addlock kernel-default-#.#.#-#.#

But, that lock didn’t seem to block anything.

Try something like:

zypper addlock kernel-default = 4.1.45

or

zypper addlock kernel-default >= 4.1.45

(the latter would of course lock 4.1.45 and all newer kernels)

See also https://en.opensuse.org/openSUSE:Libzypp_locks_file for more details, which is referenced by the page you mention btw.

IMHO the latter will redirect standardout of the command to the file =.

Yeah right, and it will lock kernel 4.1.45, not higher than 4.1.45 as a result.

So this needs to be put into quotes:

zypper addlock "kernel-default >= 4.1.45"

PS: something like this should also work (to lock only a range of versions):

zypper al "kernel-default >= 4.1.45 < 4.1.46"

Yep; I skipped over the locks file page because I assumed I would be dealing with the command line only.

I tried your method and it worked; thanks! I did discover that for any query string, I needed to enclose it in quotes. Otherwise, zypper would add three separate entries to the locks file (one for “packagename”, “=”, and the version “#.#.#”). The page also used a double-equals operator, rather than a single equals operator, but both seem to accomplish the same thing. In the end, I used something like the following command for my purposes:

zypper addlock "kernel-default == 4.1.45"