Skip to content

Enable Dracut's livenet rootfs handling when systemd-networkd is in use.#10706

Merged
gmileka merged 2 commits into3.0-devfrom
gmileka/dracut-livenet-downloader
Nov 12, 2024
Merged

Enable Dracut's livenet rootfs handling when systemd-networkd is in use.#10706
gmileka merged 2 commits into3.0-devfrom
gmileka/dracut-livenet-downloader

Conversation

@gmileka
Copy link
Copy Markdown
Contributor

@gmileka gmileka commented Oct 11, 2024

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Dracut provides a livenet module which allows the downloading of a liveos ISO image from a PXE server at boot time. However, this functionality is not implemented for systemd-networkd in Dracut 102 and earlier (see bug and fix).

It is desired to produce Azure Linux liveos ISO images that are PXE-ready. To enable this scenario, we need to ensure that Dracut's livenet module is functional on Azure Linux images.

There are two options:

  1. Upgrade dracut version to 103+.
  2. Patch the current Dracut version.

Given that Azure Linux has GA'ed, and given that Dracut introduced refactoring around the networking supported between 102 and 103, we opted to minimize the risk of upgrading at this time and go with patching the current Dracut version.

This change augments Dracut's livenet module with a daemon to be started when the network is up. The new daemon will then call the livenet module download script.

Regression Risk

Minimal.

To avoid side effects or conflicts with existing user configuration, this flow is only activated if the new rd.live.azldownloader kernel parameter is present and set to 'enabled' - otherwise, it is not activated.

Change Log
Does this affect the toolchain?
  • no
Associated issues
  • 9741
Links to CVEs
  • n/a
Test Methodology

Unit Tests

  • Ran MIC liveos ISO tests (tests include coverage for new scenario).

Functional Tests

  • Deploy a PXE server on the network.
  • Use MIC to generate a liveos iso (vhdx->iso) and specify the new --output-pxe-artifacts-dir parameter.
    • Attach the iso to a hyper-v VM
      • Verify the VM boots, and the user can log-in.
    • Deploy the iso artifacts to a PXE server and boot a PXE client on the same network.
      • Verify the PXE client boots, and that the user can log-in.
  • Use MIC to generate a liveos iso (iso->iso) and specify the new --output-pxe-artifacts-dir parameter.
    • Attach the iso to a hyper-v VM
      • Verify the VM boots, and the user can log-in.
    • Deploy the iso artifacts to a PXE server and boot a PXE client on the same network.
      • Verify the PXE client boots, and that the user can log-in.
      • Verify user settings from the first run (vhdx-iso) have been retained.

@gmileka gmileka force-pushed the gmileka/dracut-livenet-downloader branch 2 times, most recently from 97682ac to 58ed66a Compare October 14, 2024 19:53
@gmileka gmileka marked this pull request as ready for review October 14, 2024 20:04
@gmileka gmileka requested a review from a team as a code owner October 14, 2024 20:04
@gmileka gmileka force-pushed the gmileka/dracut-livenet-downloader branch 2 times, most recently from 92429a2 to b22bb77 Compare November 1, 2024 00:53
…PXE booting for liveos ISOs.

Dracut's livenet module can process root=live:http://artifacts-url at Dracut's parse phase.
However, it does not follow through with downloading the artifacts later - and consequently,
it does not attempt to pivot to the download rootfs image. This blocks the PXE boot flow
for liveos isos.

This change enables this flow by providing a downloader script that is attached to the
livenet module parse phase. That way, once livenet parsing claims the handling of the
kernel root parameter, it can also schedule the downloader to run after the network stack
is up.

To avoid possible conflicts with possible user extensions, the download is only activated
if the new 'rd.live.azldownloader' kernel parameter is present and set to 'enabled' -
otherwise, it is disabled.

Also, the downloader is just a stub that calls into Dracut's livenet root handler which
takes care of downloading.
@gmileka gmileka force-pushed the gmileka/dracut-livenet-downloader branch from b22bb77 to 601dfdc Compare November 1, 2024 21:26
@gmileka gmileka changed the title Update dracut livenet module with an iso downloader script to enable … Enable Dracut's livenet rootfs handling when systemd-networkd is in use. Nov 1, 2024
Comment thread SPECS/dracut/add-livenet-download-service.patch Outdated
Comment thread SPECS/dracut/90livenet/liveos-artifacts-download.service
Comment thread SPECS/dracut/add-livenet-download-service.patch Outdated
Comment thread SPECS/dracut/90livenet/liveos-artifacts-download.service
Comment thread SPECS/dracut/add-livenet-download-service.patch Outdated
@gmileka gmileka merged commit 5894457 into 3.0-dev Nov 12, 2024
@gmileka gmileka deleted the gmileka/dracut-livenet-downloader branch November 12, 2024 20:04
durgajagadeesh pushed a commit to durgajagadeesh/azurelinux_djpalli that referenced this pull request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants