-
Notifications
You must be signed in to change notification settings - Fork 24.1k
systemd - fix issue with unknown capabilities in newer kernel #72337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
…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>
…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>
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.
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.
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)) |
There was a problem hiding this comment.
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'.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Related to issue ansible#71528 and PR ansible#72337 Co-authored-by: Martin Polden <mpolden@mpolden.no>
SUMMARY
A bug existed in
systemd
245 that did not properly handle unknown kernel capabilities gracefully. This resulted in incomplete output and anrc
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
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 hassystemd-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.