Skip to content

Conversation

samdoran
Copy link
Contributor

SUMMARY

A bug existed in systemd 245 that did not properly handle unknown kernel capabilities gracefully. This resulted in incomplete output and an rc of 1 when querying for the service status. It is possible to get service status by other means. This PR works around this issue by getting service status using other commands in the event of a failure due to this bug.

Fixes #71528

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/systemd.py

ADDITIONAL INFORMATION

I'm not sure of a good way to test this. I setup a Fedora 32 VM running the 5.8 kernel and systemd-245.4-1.fc32.src.rpm. Our Fedora 32 test image has systemd-245.6-2.fc32.x86_64 but the kernel version of the Docker host would need to be 5.8 in order to invoke the failure.

Since this is a very specific workaround to a bug that is already fixed, it may be ok to not have tests for this PR.

A bug existed in systemd 245 that did not properly handle unknown kernel
capabilities gracefully. This resulted in incomplete output when querying
for the service status. It is possible to get service status by other means.
This PR works around this issue by getting service status using other commands
in the event of a failure due to this bug.
@ansibot ansibot added affects_2.11 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category labels Oct 25, 2020
@bcoca bcoca merged commit db84e2c into ansible:devel Oct 26, 2020
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 26, 2020
@samdoran samdoran deleted the issue/71528-systemd-lies branch October 26, 2020 19:29
samdoran added a commit to samdoran/ansible that referenced this pull request Oct 26, 2020
…le#72337)

A bug existed in systemd 245 that did not properly handle unknown kernel
capabilities gracefully. This resulted in incomplete output when querying
for the service status. It is possible to get service status by other means.
This PR works around this issue by getting service status using other commands
in the event of a failure due to this bug.
(cherry picked from commit db84e2c)

Co-authored-by: Sam Doran <sdoran@redhat.com>
samdoran added a commit to samdoran/ansible that referenced this pull request Oct 26, 2020
…e#72337)

A bug existed in systemd 245 that did not properly handle unknown kernel
capabilities gracefully. This resulted in incomplete output when querying
for the service status. It is possible to get service status by other means.
This PR works around this issue by getting service status using other commands
in the event of a failure due to this bug.
(cherry picked from commit db84e2c)

Co-authored-by: Sam Doran <sdoran@redhat.com>
evrardjp added a commit to evrardjp/ansible-keepalived that referenced this pull request Nov 2, 2020
Without this, molecule testing and some other environments are
broken and can't install keepalived.

This should fix it until the fix above is backported to stable
Ansible branches.
evrardjp added a commit to evrardjp/ansible-keepalived that referenced this pull request Nov 3, 2020
Without this, molecule testing and some other environments are
broken and can't install keepalived.

This should fix it until the fix above is backported to stable
Ansible branches.
evrardjp added a commit to evrardjp/ansible-keepalived that referenced this pull request Nov 3, 2020
elif err and rc == 1 and 'Failed to parse bus message' in err:
result['status'] = parse_systemctl_show(to_native(out).split('\n'))

(rc, out, err) = module.run_command("{systemctl} list-units '{unit}*'".format(systemctl=systemctl, unit=unit))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samdoran I believe you should use systemctl list-units --all . Without --all flag the inactive (dead) services will be not listed. Plz see my comment for more info #71528 (comment)

root@Ubuntu18:/# systemctl list-units actions.runner.monolithprojects-ansible-github_actions_runne.Ubuntu18.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

root@Ubuntu18:/# systemctl list-units --all actions.runner.monolithprojects-ansible-github_actions_runne.Ubuntu18.service
UNIT                                                                          LOAD   ACTIVE   SUB  DESCRIPTION                                                                             
actions.runner.monolithprojects-ansible-github_actions_runne.Ubuntu18.service loaded inactive dead GitHub Actions Runner (monolithprojects-ansible-github_actions_runner-testrepo.Ubuntu18)

1 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried with #72363? I believe list-unit-files should take care of this issue.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, did not notice that open PR. Yes list-unit-files works too. Thanks.

Copy link
Contributor Author

@samdoran samdoran Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that's great news. Thank you for confirming. I was hoping I didn't have to fix this yet again. :) I have opened backport PRs for 2.9 and 2.10, so this fix will be in the next .z release of Ansible 2.9 and 2.10.

samdoran added a commit to samdoran/ansible that referenced this pull request Nov 20, 2020
Related to issue ansible#71528 and PR ansible#72337

Co-authored-by: Martin Polden <mpolden@mpolden.no>
@ansible ansible locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Service is in unknown state
4 participants