Skip to content

systemd: add initrd-specific services

Summary

Decouple from a specific initrd generator (dracut) the systemd services that provide networking in the initrd using NM, thus allowing other systemd-based initrd generators to take advantage of it.

These new services are:

  • nm-config-initrd: it starts very early at boot, parses the kernel command line using nm-initrd-generator and sets the /run/NetworkManager/initrd/neednet flag to activate the other initrd services, and also sets the hostname if needed.
  • nm-initrd: it basically does the same job as the NetworkManager.service, but in the initrd.
  • nm-wait-online-initrd: ordered before network-online.target, it will allow other services that require networking to delay their start until NM has finished.

Purpose

  • Provide out-of-the-box networking for systemd-based initrds not generated with dracut.
  • Move NM related services to the upstream project where they should be maintained.

PS: the use of dbus in the initrd is arguable (see https://github.com/dracutdevs/dracut/issues/2378), so maybe go back to --configure-and-quit=initrd or something similar should be considered, but my main goal here is not to fix any inherent issues.

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
  • the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.

Merge request reports

Loading