Package, Dependencies and Config Path Updates to Support Azure Linux 4.0#4399
Package, Dependencies and Config Path Updates to Support Azure Linux 4.0#4399MadhurAggarwal wants to merge 9 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
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
GrubConfigandFips. - Update CBLMariner
set_kill_user_processes()to use/usr/lib/systemd/logind.confwhen/etc/systemd/logind.confis 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" |
There was a problem hiding this comment.
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).
| if not self._node.shell.exists( | ||
| self._node.get_pure_path(logind_conf) | ||
| ): | ||
| logind_conf = "/usr/lib/systemd/logind.conf" |
There was a problem hiding this comment.
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.
| 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" | |
| ), | |
| ) |
| sed.append( | ||
| text="KillUserProcesses=no", | ||
| file="/etc/systemd/logind.conf", | ||
| file=logind_conf, | ||
| sudo=True, | ||
| ) | ||
| self._node.tools[Service].restart_service("systemd-logind") |
There was a problem hiding this comment.
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.
|
|
||
| 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." |
There was a problem hiding this comment.
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.
| 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.", |
| # 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, |
There was a problem hiding this comment.
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.
| "blktrace", | ||
| "libaio", | ||
| "bc", | ||
| "sysstat", |
| ) | ||
|
|
||
| # Temporary Workaround to test xfs in Azurelinux 4.0 | ||
| # DO NOT MERGE |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.

Description
/usr/lib/systemd/logind.conf) for file/etc/systemd/logind.confdnf) for dnf tool nameRelated Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results