Skip to content

Fix package tool errors and KillUserProcesses setup on Azure Linux/Mariner#4594

Draft
umfranci wants to merge 8 commits into
mainfrom
umfranci/dnf-tool-fix-13072026
Draft

Fix package tool errors and KillUserProcesses setup on Azure Linux/Mariner#4594
umfranci wants to merge 8 commits into
mainfrom
umfranci/dnf-tool-fix-13072026

Conversation

@umfranci

Copy link
Copy Markdown
Collaborator

Description

Fixes two issues that hit Azure Linux / CBL-Mariner nodes during package operations:

  1. _dnf_tool AttributeError_dnf_tool_name was only declared as a type
    annotation 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 an AttributeError. Now _dnf_tool_name is initialized
    to "" and resolved lazily inside _dnf_tool() (dnf if present, otherwise
    tdnf -q), with the result cached. Detection happens directly here instead of
    calling _initialize_package_installation(), which avoids an unintended
    systemd-logind restart and a possible recursion.

  2. set_kill_user_processes failed on Azure Linux 4.0 — the code appended
    KillUserProcesses=no to /etc/systemd/logind.conf with sed, but on Azure
    Linux 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 its
    own [Login] header. Drop-ins work uniformly across all Mariner/Azure Linux
    versions (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

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

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:

  • microsoftcblmariner cbl-mariner 2-gen2 latest
  • microsoftcblmariner azurelinux-3 3-gen2 latest
  • Azure Linux 4.0 image

Test Results

Image VM Size Result
microsoftcblmariner cbl-mariner 2-gen2 latest Standard_D2s_v5 PASSED
microsoftcblmariner azurelinux-3 3-gen2 latest Standard_D2s_v5 PASSED
Azure Linux 4.0 image Standard_D2s_v5 PASSED
Copilot AI review requested due to automatic review settings July 13, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_name with a default value and lazily resolve/cache dnf vs tdnf inside _dnf_tool().
  • Write KillUserProcesses=no via a systemd logind drop-in (/etc/systemd/logind.conf.d/...) instead of editing /etc/systemd/logind.conf directly.
Comment thread lisa/operating_system.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 06:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 14, 2026 06:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread lisa/operating_system.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants