Fix package tool errors and KillUserProcesses setup on Azure Linux/Mariner#4594
Draft
umfranci wants to merge 8 commits into
Draft
Fix package tool errors and KillUserProcesses setup on Azure Linux/Mariner#4594umfranci wants to merge 8 commits into
umfranci wants to merge 8 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Azure Linux/CBL-Mariner package-management reliability by (1) preventing _dnf_tool() from crashing when called before the install path initializes the package tool and (2) making KillUserProcesses=no configuration robust on distros where /etc/systemd/logind.conf may not exist.
Changes:
- Initialize
_dnf_tool_namewith a default value and lazily resolve/cachednfvstdnfinside_dnf_tool(). - Write
KillUserProcesses=novia a systemd logind drop-in (/etc/systemd/logind.conf.d/...) instead of editing/etc/systemd/logind.confdirectly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes two issues that hit Azure Linux / CBL-Mariner nodes during package operations:
_dnf_toolAttributeError —_dnf_tool_namewas only declared as a typeannotation and never assigned a default. Any code path that called
_dnf_tool()before the install path ran (e.g.
_update_packages,clean_package_cache,repolist) crashed with anAttributeError. Now_dnf_tool_nameis initializedto
""and resolved lazily inside_dnf_tool()(dnfif present, otherwisetdnf -q), with the result cached. Detection happens directly here instead ofcalling
_initialize_package_installation(), which avoids an unintendedsystemd-logindrestart and a possible recursion.set_kill_user_processesfailed on Azure Linux 4.0 — the code appendedKillUserProcesses=noto/etc/systemd/logind.confwithsed, but on AzureLinux 4.0 that file doesn't exist by default, so the append failed and the
setting was never applied. Now the setting is always written as a systemd
drop-in (
/etc/systemd/logind.conf.d/99-lisa-kill-user-processes.conf) with itsown
[Login]header. Drop-ins work uniformly across all Mariner/Azure Linuxversions (even when the base file is missing), the file is rewritten each time so
the operation is idempotent, and writes now fail loudly instead of being silently
ignored.
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
verify_os_update|verify_repository_installed
Impacted LISA Features:
CBLMariner (operating_system) - package install/update and KillUserProcesses setup
Tested Azure Marketplace Images:
Test Results