Skip to content

[BUG] /etc/mariner-release check in get_distro() is dead code on Azure Linux — potential footgun #3602

@jonathanbrenes

Description

@jonathanbrenes

Describe the bug:

get_distro() checks for /etc/mariner-release to override osinfo[0] to "mariner". On Azure Linux, this file does not exist — the distro ships /etc/azurelinux-release instead.

if os.path.exists("/etc/mariner-release"):

Distro detection works correctly today because get_linux_distribution() (called earlier in the function) reads /etc/os-release (ID=azurelinux) and returns "azurelinux" before the /etc/mariner-release override is reached.

However, the dead code is a potential footgun:

  • If /etc/mariner-release is ever added to Azure Linux for backward compatibility, it would incorrectly override "azurelinux" back to "mariner" because the if block runs after get_linux_distribution().
  • There is no corresponding /etc/azurelinux-release check in the code for consistency with the other distro-specific overrides (oracle, euleros, photonos, etc.).

Current flow in get_distro():

osinfo = get_linux_distribution(0, 'alpine')  # returns 'azurelinux' from os-release
...
if os.path.exists("/etc/mariner-release"):  # does NOT exist on AZL — skipped
    osinfo[0] = "mariner"
# No check for /etc/azurelinux-release

Steps to reproduce:

python3 -c "import azurelinuxagent.common.version as v; print(v.DISTRO_NAME)"
# azurelinux  <-- works correctly today

ls /etc/*-release
# /etc/azurelinux-release  /etc/os-release  /etc/system-release
# No /etc/mariner-release exists

Distro and WALinuxAgent details:

  • Distro and Version: Azure Linux
  • WALinuxAgent version: 2.15.0.1 (waagent-2.15.0.1-1.azl4)

Additional context

This is a low-severity/informational issue. No functional impact today. Filing for awareness so the team can decide whether to:

  1. Add an /etc/azurelinux-release check for consistency
  2. Remove the /etc/mariner-release override entirely (since os-release handles detection)
  3. Leave as-is if considered harmless

Log file attached

N/A — no functional failure, detection works correctly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions