Skip to content

Package, Dependencies and Config Path Updates to Support Azure Linux 4.0#4399

Draft
MadhurAggarwal wants to merge 9 commits intomicrosoft:mainfrom
MadhurAggarwal:madagg/azurelinux_4.0_changes
Draft

Package, Dependencies and Config Path Updates to Support Azure Linux 4.0#4399
MadhurAggarwal wants to merge 9 commits intomicrosoft:mainfrom
MadhurAggarwal:madagg/azurelinux_4.0_changes

Conversation

@MadhurAggarwal
Copy link
Copy Markdown
Member

@MadhurAggarwal MadhurAggarwal commented Mar 27, 2026

Description

  • Support for CBL Mariner 4.0 Version
  • Added 4.0 specific Path (/usr/lib/systemd/logind.conf) for file /etc/systemd/logind.conf
  • Added Default Value (dnf) for dnf tool name
  • Updated List of Packages & Dependencies to install for 4.0

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:

Impacted LISA Features:

Tested Azure Marketplace Images:

Test Results

Image VM Size Result
PASSED / FAILED / SKIPPED

Copilot AI review requested due to automatic review settings March 27, 2026 13:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 extends LISA’s Azure Linux (CBL Mariner) compatibility to cover 4.0 by reusing existing AZL3 implementations and adjusting OS-level configuration paths/defaults to match AZL4 layout and tooling expectations.

Changes:

  • Treat Azure Linux 4.0 as compatible with existing AZL3 implementations for GrubConfig and Fips.
  • Update CBLMariner set_kill_user_processes() to use /usr/lib/systemd/logind.conf when /etc/systemd/logind.conf is absent (AZL4 path change).
  • Set a default value for CBLMariner’s _dnf_tool_name.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
lisa/tools/grub_config.py Adds AZL 4.0 support in the GrubConfig factory + updates the unsupported-distro message.
lisa/tools/fips.py Adds AZL 4.0 support in the FIPS factory + updates the unsupported-distro message.
lisa/operating_system.py Defaults CBLMariner dnf tool name and adds AZL4 logind.conf path fallback for KillUserProcesses.

def __init__(self, node: Any) -> None:
super().__init__(node)
self._dnf_tool_name: str
self._dnf_tool_name: str = "dnf"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Setting _dnf_tool_name default to "dnf" can cause CBLMariner to run dnf before _initialize_package_installation() has had a chance to detect whether only tdnf is available. Since RPMDistro._install_packages/_uninstall_packages call _dnf_tool() without first calling _initialize_package_installation(), consider ensuring tool selection is initialized before any package operation (e.g., lazy-init inside _dnf_tool() or overriding _install_packages/_uninstall_packages to gate on _first_time_installation).

Copilot uses AI. Check for mistakes.
Comment on lines +2141 to +2144
if not self._node.shell.exists(
self._node.get_pure_path(logind_conf)
):
logind_conf = "/usr/lib/systemd/logind.conf"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The fallback to /usr/lib/systemd/logind.conf is not validated for existence. If neither /etc/systemd/logind.conf nor /usr/lib/systemd/logind.conf exists, sed -i will fail and this method will raise unexpectedly. Consider checking the fallback path too and either creating /etc/systemd/logind.conf (preferred) or raising a clear error/skip when systemd config is not present.

Suggested change
if not self._node.shell.exists(
self._node.get_pure_path(logind_conf)
):
logind_conf = "/usr/lib/systemd/logind.conf"
shell = self._node.shell
primary_path = self._node.get_pure_path(logind_conf)
if not shell.exists(primary_path):
fallback_logind_conf = "/usr/lib/systemd/logind.conf"
fallback_path = self._node.get_pure_path(fallback_logind_conf)
if shell.exists(fallback_path):
logind_conf = fallback_logind_conf
else:
# Neither primary nor fallback exist; create the primary config file
self._log.debug(
"Neither /etc/systemd/logind.conf nor /usr/lib/systemd/logind.conf "
"exists. Creating /etc/systemd/logind.conf."
)
self._node.execute(
"mkdir -p /etc/systemd && touch /etc/systemd/logind.conf",
sudo=True,
shell=True,
expected_exit_code=0,
expected_exit_code_failure_message=(
"Failed to create /etc/systemd/logind.conf"
),
)

Copilot uses AI. Check for mistakes.
Comment on lines 2145 to 2150
sed.append(
text="KillUserProcesses=no",
file="/etc/systemd/logind.conf",
file=logind_conf,
sudo=True,
)
self._node.tools[Service].restart_service("systemd-logind")
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

set_kill_user_processes() always uses sed.append(...) and restarts systemd-logind, so repeated calls will keep appending duplicate KillUserProcesses=no lines and repeatedly restart the service (this is also currently invoked from _initialize_package_installation). Making the change idempotent (e.g., replace existing KillUserProcesses= or check if the setting already exists before editing/restarting) would avoid config bloat and unnecessary service churn.

Copilot uses AI. Check for mistakes.

raise UnsupportedDistroException(
os=node.os, message="FIPS tool only supported on CBLMariner 2.0 and 3.0."
os=node.os, message="FIPS tool only supported on CBLMariner 2.0, 3.0 and 4.0."
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The UnsupportedDistroException(...) call is now long enough to violate the repo's flake8 max-line-length = 88 setting, which will fail linting. Please wrap the arguments across multiple lines (similar to grub_config.py) so each line stays within 88 chars.

Suggested change
os=node.os, message="FIPS tool only supported on CBLMariner 2.0, 3.0 and 4.0."
os=node.os,
message="FIPS tool only supported on CBLMariner 2.0, 3.0 and 4.0.",

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 27, 2026 14:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings March 27, 2026 19:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment on lines +2139 to +2147
# Azure Linux 4.0 moved logind.conf to /usr/lib/systemd/
logind_conf = "/etc/systemd/logind.conf"
if not self._node.shell.exists(
self._node.get_pure_path(logind_conf)
):
logind_conf = "/usr/lib/systemd/logind.conf"
sed.append(
text="KillUserProcesses=no",
file="/etc/systemd/logind.conf",
file=logind_conf,
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Editing the vendor config at /usr/lib/systemd/logind.conf is brittle (package updates may overwrite it) and may not be the correct override location for systemd. Prefer writing the setting to /etc/systemd/logind.conf (create it if missing) or a drop-in under /etc/systemd/logind.conf.d/, and keep /usr/lib untouched.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 28, 2026 03:52
"blktrace",
"libaio",
"bc",
"sysstat",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Image sysstat is available in 4.0 but fails to install due to missing pcp

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 15 out of 15 changed files in this pull request and generated 1 comment.

@MadhurAggarwal MadhurAggarwal changed the title Madagg/azurelinux 4.0 changes Package, Dependencies and Config Path Updates to Support Azure Linux 4.0 Mar 28, 2026
)

# Temporary Workaround to test xfs in Azurelinux 4.0
# DO NOT MERGE
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This seems to be a bug (missing symlink in pkg-config package) in 4.0 Alpha image, added a workaround to test xfs. will remove this once upstream gets fixed.

)

# Temporary Workaround to test xfs in Azurelinux 4.0
# DO NOT MERGE
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is only issue in Alpha1 image.
Fix is present in azurelinux-stage1-compact package. installing that package creates this symlink. in stage2 image this change would not be required.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants