Salt: Systemd update 241 on archlinux breaks systemd.py version() function

Created on 21 Feb 2019  路  7Comments  路  Source: saltstack/salt

Description of Issue/Question

The version 241 of systemd introduced recently on archlinux has a different output for its version. Because of this different output, systemd.py can't parse it correctly and therefore leads to Unable to determine systemd version from systemctl from salt.

Output of systemctl --version on its latest version of archlinux : systemd 241 (241.7-2-arch)
salt/utils/systemd.py:68 expects a version formatted like systemd 241

Versions Report

salt : salt 2018.3.3-2 (from arch repo )
systemd: systemd 241 (241.7-2-arch) +PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

Bug P2 fixed-pending-your-verification severity-medium

Most helpful comment

I'm also running into this on Debian Buster which is now a stable release.

All 7 comments

https://github.com/saltstack/salt/blob/b44f0f1d0fd564690c6e45c6dd061c0e84d76def/salt/utils/systemd.py#L68

Change from ret = int(outstr.splitlines()[0].split()[-1]) to ret = int(outstr.splitlines()[0].split()[1]) may fix this issue, but I'm unsure if it will works on each plateform and versions of systemd unfortunately

@fayak Thanks for the report.

For reference, this problem also shows up as follows in the sysctl module. The fix above fixes this issue too.
Comment: An exception occurred in this state: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/salt/state.py", line 1919, in call **cdata['kwargs']) File "/usr/lib/python3/dist-packages/salt/loader.py", line 1918, in wrapper return f(*args, **kwargs) File "/usr/lib/python3/dist-packages/salt/states/sysctl.py", line 58, in present config = __salt__['sysctl.default_config']() File "/usr/lib/python3/dist-packages/salt/modules/linux_sysctl.py", line 54, in default_config and salt.utils.systemd.version(__context__) >= 207: TypeError: '>=' not supported between instances of 'NoneType' and 'int'

Please also backport that patch to the 2018.3 release branch.

The changes from https://github.com/saltstack/salt/pull/51946 haven't made it yet in the packages?
This is still an issue in 2019.2 so far apparently:

~]# pacman -Q salt
salt 2019.2.0-2
~]# salt -V
Salt Version:
           Salt: 2019.2.0
...

System Versions:
           dist:   
         locale: UTF-8
        machine: x86_64
        release: 4.19.36-1-MANJARO
         system: Linux
        version: Not Installed
 ~]# systemctl --version
systemd 242 (242.16-1-manjaro)
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid



md5-bcadcf1e8eea07320d8db12d23e9c2f7



~]# salt-call state.apply
[ERROR   ] Unable to determine systemd version from systemctl --version, output follows:
systemd 242 (242.16-1-manjaro)
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

After I made those change from the PR manually, it works fine.

I'm also running into this on Debian Buster which is now a stable release.

Was this page helpful?
0 / 5 - 0 ratings