Skip to content
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

fix: Ensure user linger is closed on EL10 #165

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tasks/cancel_linger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,42 @@
list | length == 0
- __podman_linger_secrets.stdout == ""
changed_when: true
register: __cancel_linger
args:
removes: /var/lib/systemd/linger/{{ __podman_linger_user }}

- name: Wait for user session to exit closing state # noqa no-handler
command: loginctl show-user -P State {{ __podman_linger_user | quote }}
register: __user_state
changed_when: false
until: __user_state.stdout != "closing"
when: __cancel_linger is changed
ignore_errors: true

# see https://github.com/systemd/systemd/issues/26744#issuecomment-2261509208
- name: Handle user stuck in closing state
when:
- __cancel_linger is changed
- __user_state is failed
block:
- name: Stop logind
service:
name: systemd-logind
state: stopped

- name: Wait for user session to exit closing state
command: loginctl show-user -P State {{ __podman_linger_user | quote }}
changed_when: false
register: __user_state
until: __user_state.stderr is match(__pat) or
__user_state.stdout != "closing"
failed_when:
- not __user_state.stderr is match(__pat)
- __user_state.stdout == "closing"
vars:
__pat: "Failed to get user: User ID .* is not logged in or lingering"

- name: Restart logind
service:
name: systemd-logind
state: started
Loading