Skip to content

engineering: Add AZL4 distro detection and extend GRUB path to AZL4#642

Open
Britel wants to merge 3 commits into
mainfrom
user/britel/azl4-1-grub-native
Open

engineering: Add AZL4 distro detection and extend GRUB path to AZL4#642
Britel wants to merge 3 commits into
mainfrom
user/britel/azl4-1-grub-native

Conversation

@Britel

@Britel Britel commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds AZL4 (Azure Linux 4.0, Fedora-based) distro detection and wires it into the GRUB update flow so installs can target AZL4 correctly, including when the installer host OS differs from the image OS.

Changes

  • Extend OsRelease::get_distro() / Distro helpers to recognize VERSION_ID=4.x as AzureLinuxRelease::AzL4, plus ID_LIKE=fedora detection
  • Add is_azl4() helper on Distro
  • Add AZL4 Beta os-release test constant (Cloud Variant Beta)
  • Switch GRUB update selection to key off the image distro via image_distro(), and allow the existing GRUB update path to run for AZL4 as well
  • image_distro() falls back to host OS only when no image is mounted (not when distro is unrecognized)
  • Rename update_grub_config_azl3 to update_grub_config (serves both AZL3 and AZL4)
  • Update mkinitrd functional-test initramfs glob to handle AZL4 naming

PR Stack

# PR Description Diff
1 this (#642) AZL4 distro detection + GRUB update path vs main
2 #672 Generic EFI vendor-dir discovery + AZL4 ESP vs PR-1
3 #679 BLS entry support for boot arg extraction vs PR-2
4 Builder infra + image acquisition vs PR-3
5 Image configs + pipeline stages vs PR-4
6 BM-simulated netlaunch stage vs PR-5
7 qcow2 base + offline-init vs PR-6
8 VM rollback test stage vs PR-7

@Britel Britel force-pushed the user/britel/azl4-1-grub-native branch 5 times, most recently from 33d33ac to 701a853 Compare May 28, 2026 20:29
@Britel Britel changed the title engineering: Native /etc/default/grub editor for Azure Linux 4.0 engineering: Add AZL4 distro detection and extend GRUB path to AZL4 May 28, 2026
Comment thread crates/trident/src/engine/boot/grub.rs Outdated
@Britel Britel force-pushed the user/britel/azl4-1-grub-native branch 2 times, most recently from a5460e9 to 2da4ab6 Compare May 30, 2026 01:01
Implements AzureLinuxRelease::AzL4 variant, VERSION_ID 4.x parsing,
ID_LIKE=fedora matching, updated GRUB match arms for AzL3|AzL4,
and image_distro() fallback to host os-release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Britel Britel force-pushed the user/britel/azl4-1-grub-native branch from 2da4ab6 to 49b6d9b Compare June 3, 2026 01:04
@Britel Britel marked this pull request as ready for review June 3, 2026 19:14
@Britel Britel requested a review from a team as a code owner June 3, 2026 19:14
Copilot AI review requested due to automatic review settings June 3, 2026 19:14

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

Adds Azure Linux 4.0 (AzL4) recognition in os-release parsing and wires that into the GRUB update flow so installs can target AzL4 correctly (including when the installer host OS differs from the image OS).

Changes:

  • Extend OsRelease::get_distro() / Distro helpers to recognize VERSION_ID=4.x as AzureLinuxRelease::AzL4, plus add AzL4 sample os-release data for tests.
  • Switch GRUB update selection to key off the image distro, and allow the existing AzL3 GRUB update path to run for AzL4 as well.
  • Update mkinitrd functional-test initramfs glob to handle AzL4 naming (*.azl4.img).

Reviewed changes

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

Show a summary per file
File Description
crates/trident/src/engine/context/mod.rs Adds image_distro() logic to prefer image os-release with fallback to host.
crates/trident/src/engine/boot/grub.rs Uses ctx.image_distro() and extends GRUB update support to AzL4.
crates/osutils/src/testutils/osrelease.rs Adds mock AZL4 /etc/os-release content for tests.
crates/osutils/src/osrelease.rs Adds AzL4 detection, enum variant, and unit test coverage for parsing.
crates/osutils/src/mkinitrd.rs Adds AzL4 initramfs naming pattern for functional tests.

Comment thread crates/trident/src/engine/context/mod.rs
Comment thread crates/trident/src/engine/boot/grub.rs Outdated
Comment thread crates/osutils/src/osrelease.rs
image_distro() was falling back to the host os-release whenever the
image's distro was Distro::Other. This silently masked unrecognized
distros as the host distro, causing GRUB config to be written for
the wrong OS.

Now: if an image is mounted (self.image.is_some()), always use the
image's distro. Fallback to host only fires when no image is present
at all (functional tests, runtime operations).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The function now serves both AZL3 and AZL4. Remove version-specific
references from the doc comment and debug log messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 4, 2026 23:11

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 5 out of 5 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants