RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2170104 - [Azure][WALA][RHEL-8] systemd service should not use python3
Summary: [Azure][WALA][RHEL-8] systemd service should not use python3
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: WALinuxAgent
Version: 8.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Vitaly Kuznetsov
QA Contact: Yuxin Sun
URL:
Whiteboard:
: 2170211 (view as bug list)
Depends On:
Blocks: 2174895 2175255
TreeView+ depends on / blocked
 
Reported: 2023-02-15 16:31 UTC by Klaas Demter
Modified: 2023-05-16 10:15 UTC (History)
10 users (show)

Fixed In Version: WALinuxAgent-2.7.0.6-8.el8_8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2174895 2175255 (view as bug list)
Environment:
Last Closed: 2023-05-16 08:44:25 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github Azure WALinuxAgent issues 2728 0 None open [BUG][RHEL8] systemd service should not use python3 2023-02-15 16:31:16 UTC
Github Azure WALinuxAgent pull 2729 0 None open Fixes #2728 Change rhel service file to not use python 2023-02-15 16:31:16 UTC
Gitlab redhat/rhel/src walinuxagent merge_requests 16 0 None None None 2023-02-21 10:41:28 UTC
Red Hat Issue Tracker RHELPLAN-148846 0 None None None 2023-02-16 10:04:06 UTC
Red Hat Product Errata RHBA-2023:2944 0 None None None 2023-05-16 08:44:33 UTC

Description Klaas Demter 2023-02-15 16:31:17 UTC
Description of problem:
This is a cross post from
https://github.com/Azure/WALinuxAgent/issues/2728
the Microsoft people do not seem to see that they are the ones supplying the service file that is doing the wrong thing here, so maybe this needs to be patched downstream.

it seems on systems where python3 is not pointing to the same python version as platform-python waagent fails to start. This happens because it tries to directly use python3 in the systemd service file.

Easiest fix I could come up with is: https://github.com/Azure/WALinuxAgent/pull/2729 -- do not use python3 at all in the service file but use waagent directly. It's executeable and contains the right shebang.


Version-Release number of selected component (if applicable):


How reproducible:
Have python3 point to an appstream python that is not 3.6


Actual results:
WALinuxAgent no longer starts


Expected results:
WALinux starts and does not use python3 to execute

Comment 1 Yuxin Sun 2023-02-16 10:17:44 UTC
Hi Klaas,

Thank you for reporting this issue! We also have a BZ#2170211 to track this issue. Would you mind me to duplicate this issue to BZ#2170211 and track in that one? Thanks!

Comment 2 Klaas Demter 2023-02-16 10:44:32 UTC
@yuxisun 
can you make that other report public - in that case I don't care if this bug lives on or the other one? But judging from the number 2170211 should be a duplicate of 2170104 :)

Greetings
Klaas

Comment 3 Yuxin Sun 2023-02-20 10:16:12 UTC
(In reply to Klaas Demter from comment #2)
> @yuxisun 
> can you make that other report public - in that case I don't care if this
> bug lives on or the other one? But judging from the number 2170211 should be
> a duplicate of 2170104 :)
> 
> Greetings
> Klaas

Hi Klaas,

I double checked these 2 issues and they are actually not exactly the same issues. So I'd like to still track them separately. Thanks!


Hi Vitaly,

I can reproduce this issue. Could you please help to check which one we should use in both waagent.service and /usr/sbin/waagent? /usr/bin/python3 or /usr/libexec/platform-python? Thanks! (In the spec file the RHEL-8 WALA package requires python36)

Comment 4 Klaas Demter 2023-02-21 08:49:36 UTC
(In reply to Yuxin Sun from comment #3)
> 
> Hi Vitaly,
> 
> I can reproduce this issue. Could you please help to check which one we
> should use in both waagent.service and /usr/sbin/waagent? /usr/bin/python3
> or /usr/libexec/platform-python? Thanks! (In the spec file the RHEL-8 WALA
> package requires python36)

My idea was to remove python from the service file and just let /usr/sbin/waagent handle the interpreter choice. Is there any advantage of using python directly inside the service file?

Comment 5 Vitaly Kuznetsov 2023-02-21 09:11:19 UTC
(In reply to Yuxin Sun from comment #3)

> I can reproduce this issue. Could you please help to check which one we
> should use in both waagent.service and /usr/sbin/waagent? /usr/bin/python3
> or /usr/libexec/platform-python? Thanks! (In the spec file the RHEL-8 WALA
> package requires python36)

I also think that relying on the shabang in /usr/sbin/waagent is the right fix here.

Comment 10 Kyle Walker 2023-02-21 16:45:31 UTC
*** Bug 2170211 has been marked as a duplicate of this bug. ***

Comment 15 Robert McSwain 2023-02-24 20:13:45 UTC
Yuxin, This does help one of my customers. One more question from case 03440559


I understand the LinuxDiagnostic extension install will fail on RHEL8. I am trying to use the images published by RedHat on the Azure MarketPlace. This one too fails as Python2. Do you have any plans to change this behavior in the images published by RedHat to make it work. 

"imageReference": {
                        "publisher": "RedHat",
                        "offer": "RHEL",
                        "sku": "8-LVM",
                        "version": "8.7.2022112213"
                    },

Comment 19 Klaas Demter 2023-03-03 07:32:26 UTC
(In reply to Robert McSwain from comment #15)
> Yuxin, This does help one of my customers. One more question from case
> 03440559
> 
> 
> I understand the LinuxDiagnostic extension install will fail on RHEL8. I am
> trying to use the images published by RedHat on the Azure MarketPlace. This
> one too fails as Python2. Do you have any plans to change this behavior in
> the images published by RedHat to make it work. 
> 
> "imageReference": {
>                         "publisher": "RedHat",
>                         "offer": "RHEL",
>                         "sku": "8-LVM",
>                         "version": "8.7.2022112213"
>                     },

I think you're wrong here about this, the extension is not made by Red Hat (neither is the image btw), you have to complain to the Microsoft Team in charge of the Linux Diagnostic Extension, but I'd say for now it's on purpose: https://github.com/MicrosoftDocs/azure-docs/issues/91647

Greetings
Klaas

Comment 20 Klaas Demter 2023-03-03 08:24:35 UTC
@mrezanin will there be a zstream backport of this to 8.7 ?

Comment 21 Yuxin Sun 2023-03-03 11:34:24 UTC
(In reply to Klaas Demter from comment #19)
> (In reply to Robert McSwain from comment #15)
> > Yuxin, This does help one of my customers. One more question from case
> > 03440559
> > 
> > 
> > I understand the LinuxDiagnostic extension install will fail on RHEL8. I am
> > trying to use the images published by RedHat on the Azure MarketPlace. This
> > one too fails as Python2. Do you have any plans to change this behavior in
> > the images published by RedHat to make it work. 
> > 
> > "imageReference": {
> >                         "publisher": "RedHat",
> >                         "offer": "RHEL",
> >                         "sku": "8-LVM",
> >                         "version": "8.7.2022112213"
> >                     },
> 
> I think you're wrong here about this, the extension is not made by Red Hat
> (neither is the image btw), you have to complain to the Microsoft Team in
> charge of the Linux Diagnostic Extension, but I'd say for now it's on
> purpose: https://github.com/MicrosoftDocs/azure-docs/issues/91647
> 
> Greetings
> Klaas

Thanks Klass! I also opened an issue in LAD upstream: https://github.com/Azure/azure-linux-extensions/issues/1681

> @mrezanin will there be a zstream backport of this to 8.7 ?

Yes. We've already requested for 8.7.z and is waiting for approval now. Thanks!

Comment 22 Yash Mankad 2023-03-03 16:19:32 UTC
(In reply to Klaas Demter from comment #20)
> @mrezanin will there be a zstream backport of this to 8.7 ?

Approving zstream for 8.7.
The 8.7 clone will be created shortly.

Comment 34 Klaas Demter 2023-03-17 06:54:37 UTC
@mrezanin I can't see the PR, does this also change the dependencies from python3.6 to platform python? I noticed walinuxagent gets removed when a user removes python3.6

Comment 35 Klaas Demter 2023-03-22 15:30:49 UTC
Patch https://gitlab.com/redhat/centos-stream/rpms/WALinuxAgent/-/blob/c8s/wla-Use-platform-python-in-waagent.service.patch
I am guessing this also needs to go into rhel9/c9s

Greetings
Klaas

Comment 36 Vitaly Kuznetsov 2023-03-22 16:04:16 UTC
(In reply to Klaas Demter from comment #35)
> Patch
> https://gitlab.com/redhat/centos-stream/rpms/WALinuxAgent/-/blob/c8s/wla-Use-platform-python-in-waagent.service.patch
> I am guessing this also needs to go into rhel9/c9s

WALinuxAgent in RHEL9/C9S does not override shebang in /usr/sbin/waagent, it is 

#!/usr/bin/python3

and waagent.service calling it with

ExecStart=/usr/bin/python3 -u /usr/sbin/waagent -daemon

doesn't really change anything. Also, using /usr/bin/python3 is recommended in RHEL9:
(https://access.redhat.com/solutions/6736391):

"""
The /usr/libexec/platform-python is implemented as a symbolic link to /usr/bin/python3 . Although this platform-python
symlink is deprecated in RHEL 9 and is added for backwards compatibility with RHEL 8.

The /usr/bin/python3 is used by Red Hat shipped applications and is recommended to be used for third party applications,
User scripts and custom use of python library instead of /usr/libexec/platform-python
"""

Comment 37 Klaas Demter 2023-03-22 16:10:46 UTC
hehe okay, I actually did not know that, not using rhel9 that much yet, I still think it would be cleaner to let waagent decide the python version, but well - if it works and doesn't break then I don't care :)

Comment 38 Vitaly Kuznetsov 2023-03-22 16:16:18 UTC
(In reply to Klaas Demter from comment #37)
> hehe okay, I actually did not know that, not using rhel9 that much yet, I
> still think it would be cleaner to let waagent decide the python version,
> but well - if it works and doesn't break then I don't care :)

Generally, I agree that overriding /usr/sbin/waagent's shebang in waagent.service is not
a good idea, hope https://github.com/Azure/WALinuxAgent/pull/2729 will get accepted.

Comment 39 Klaas Demter 2023-03-22 16:20:46 UTC
So Microsoft considers that file to be Red Hats problem, https://github.com/Azure/WALinuxAgent/issues/2728#issuecomment-1479788371 , maybe give them a kick in the PR, maybe we can finally close this for good :)

Comment 42 errata-xmlrpc 2023-05-16 08:44:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (WALinuxAgent bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2944


Note You need to log in before you can comment on or make changes to this bug.