Skip to content

[BUG] regex in kernelpkg latest_available() fails on Debian Bullseye / Ubuntu Noble #68204

@benfiedler

Description

@benfiedler

Description
The kernelpkg.latest_available function throws an error on Ubuntu 24.04 / Debian 11
(same as original issue here , looks like there was never an actual resolution)

Attempting to execute it returns:

    The minion function caused an exception: Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 2028, in _thread_return
        return_data = minion_instance._execute_job_function(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1987, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
        ret = self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
        ret = _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
        return func(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
        ret = self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
        ret = _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/kernelpkg_linux_apt.py", line 87, in latest_available
        return f"{version.group(1)}-{version.group(2)}-{_kernel_type()}"
    AttributeError: 'NoneType' object has no attribute 'group'

Steps to Reproduce the behavior
# salt myubuntu24host kernelpkg.latest_available

Expected behavior
Should return a string and not an error :)

I logged the result variable from here and got the following result paired with the osfinger:

5.15.0.144.141  (Ubuntu-22.04)
6.8.0-64.67  (Ubuntu-24.04)
6.1.140-1-amd64 (Debian-11)

Simply adding a hyphen into the regex via a class seems to have 'fixed' the issue

$ diff -U 1 kernelpkg_linux_apt.py.3006.13 kernelpkg_linux_apt.py
--- kernelpkg_linux_apt.py.3006.13      2025-06-25 19:12:53.000000000 -0600
+++ kernelpkg_linux_apt.py      2025-07-21 15:59:32.457894885 -0600
@@ -85,3 +86,3 @@

-    version = re.match(r"^(\d+\.\d+\.\d+)\.(\d+)", result)
+    version = re.match(r"^(\d+\.\d+\.\d+)[\-\.](\d+)", result)
     return f"{version.group(1)}-{version.group(2)}-{_kernel_type()}"

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
    Salt Version:
              Salt: 3006.13

    Python Version:
            Python: 3.10.17 (main, Jun  9 2025, 20:41:48) [GCC 11.2.0]

    Dependency Versions:
              cffi: 1.14.6
          cherrypy: unknown
      cryptography: 42.0.5
          dateutil: 2.8.1
         docker-py: Not Installed
             gitdb: Not Installed
         gitpython: Not Installed
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.0.2
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.0.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 22.0
         pycparser: 2.21
          pycrypto: Not Installed
      pycryptodome: 3.19.1
            pygit2: Not Installed
      python-gnupg: 0.4.8
            PyYAML: 6.0.1
             PyZMQ: 23.2.0
            relenv: 0.19.3
             smmap: Not Installed
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.4

    System Versions:
              dist: ubuntu 24.04.2 noble
            locale: utf-8
           machine: x86_64
           release: 6.8.0-64-generic
            system: Linux
           version: Ubuntu 24.04.2 noble

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy