Skip to content

engineering: Add BLS entry support for grub boot arg extraction#679

Draft
Britel wants to merge 2 commits into
user/britel/azl4-2-esp-layoutsfrom
user/britel/azl4-2b-bls-grub
Draft

engineering: Add BLS entry support for grub boot arg extraction#679
Britel wants to merge 2 commits into
user/britel/azl4-2-esp-layoutsfrom
user/britel/azl4-2b-bls-grub

Conversation

@Britel

@Britel Britel commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Boot Loader Spec (BLS) support to the osmodifier grub.cfg parser. AZL4 (Fedora-based) uses BLS entries instead of inline linux commands in grub.cfg, which caused both AZL4 E2E test stages to fail.

Part 3 of the AZL4 enablement stack. Depends on PR #672 (ESP vendor-dir discovery).

Problem

extract_boot_args_from_grub_cfg() parses linux /boot/vmlinuz ... args lines from grub.cfg to sync boot args into /etc/default/grub. On AZL4, grub.cfg contains blscfg instead of inline menuentry blocks — the kernel command line lives in /boot/loader/entries/*.conf files. The parser found no linux line and bailed with "no linux line found in non-recovery menuentry."

This broke both AZL4 E2E stages:

  • Rollback: "Failed to extract boot args from grub.cfg"
  • Netlaunch: trident-install hit the same parser failure during install

Changes

Single file: crates/osmodifier/src/grub_cfg.rs

BLS fallback in extract_boot_args_from_grub_cfg()

When find_non_recovery_linux_lines() fails AND grub.cfg contains blscfg, fall back to reading boot args from BLS entry files.

New function extract_options_from_bls_entries()

  • Scans /boot/loader/entries/*.conf
  • Sorts lexically (matches grub's ordering)
  • Skips rescue/recovery entries (case-insensitive title match)
  • Returns the options line as a synthetic linux line for downstream parsing

Zero AZL3 impact

The BLS path only triggers when:

  1. find_non_recovery_linux_lines() finds zero results, AND
  2. grub.cfg content contains blscfg

AZL3 grub.cfg never contains blscfg (BLS is disabled via GRUB_ENABLE_BLSCFG=false). The fallback never fires on AZL3.

Testing

  • 3 unit tests: BLS fallback, rescue-skip, empty-entries-dir
  • Pipeline build 1133385: ALL 4 AZL4 stages passed (first time ever)
    • Rollback Testing AZL4: succeeded
    • Netlaunch Testing AZL4: succeeded
    • Both AZL4 image builds: succeeded
  • All AZL3 stages passed (Functional, Servicing, Runtime, E2E)

PR Stack

# Branch PR Description
1 azl4-1-grub-native #642 AZL4 distro detection + GRUB update path
2 azl4-2-esp-layouts #672 Generic EFI vendor-dir discovery + AZL4 ESP
3 azl4-2b-bls-grub this BLS entry support for boot arg extraction
4 azl4-5a-builder-infra Builder infra + image acquisition
5 azl4-5b-image-pipeline Image configs + pipeline stages
6 azl4-6-bm-test BM-simulated netlaunch stage
7 azl4-7a-qcow2-rust qcow2 base + offline-init
8 azl4-7b-rollback-stage VM rollback test stage

Britel and others added 2 commits June 5, 2026 11:40
AZL4 (Fedora-based) uses Boot Loader Spec entries instead of inline
linux commands in grub.cfg. When grub.cfg contains blscfg and no
inline linux lines, fall back to reading boot args from
/boot/loader/entries/*.conf.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant