Skip to content

[BUG][RHEL8] systemd service should not use python3 #2728

@Klaas-

Description

@Klaas-

Describe the bug: A clear and concise description of what the bug is.
Hi,
it seems on systems where python3 is not pointing to the same python version as platform-python waagent fails to start. This happens because you try to directly use python3 in the systemd service file.

  1. Section of the log where the error occurs.
Traceback (most recent call last):
  File "/usr/sbin/waagent", line 35, in <module>
    import azurelinuxagent.agent as agent
ModuleNotFoundError: No module named 'azurelinuxagent'
  1. Steps to reproduce the behavior.
    I'd guess this happens on any rhel8 system where /usr/bin/python3 is not pointing to python 3.6 (platform-python)

Distro and WALinuxAgent details (please complete the following information):

  • Distro and Version: Red Hat Enterprise Linux release 8.7 (Ootpa)
  • WALinuxAgent version
WALinuxAgent-2.7.0.6 running on redhat 8.7
Python: 3.6.8
Goal state agent: 2.8.0.11
$ python3 --version
Python 3.9.13

Additional context
Workaround: Create an override for the waagent.service file, something like this:

# /etc/systemd/system/waagent.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/libexec/platform-python -u /usr/sbin/waagent -daemon

This happens because WALinuxAgent uses platform-python (3.6 on RHEL8).

head -n1 /usr/sbin/waagent
#!/usr/libexec/platform-python

I am guessing you could also change it to start /usr/sbin/waagent directly, without python, then it will work as well because /usr/sbin/waagent has the correct shebang and is executable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions