Skip to content

fix: mask systemd units discouraged in WSL images - #18140

Open
mfrw wants to merge 3 commits into
4.0from
mfrw/wsl-systemd
Open

fix: mask systemd units discouraged in WSL images#18140
mfrw wants to merge 3 commits into
4.0from
mfrw/wsl-systemd

Conversation

@mfrw

@mfrw mfrw commented Jul 27, 2026

Copy link
Copy Markdown
Member

WSL manages networking, DNS resolution, the console/TTY, /tmp and early
/dev setup on behalf of the distribution. systemd units that duplicate
that management cause DNS/boot breakage under WSL and are flagged by WSL's
distribution validator (validate-modern.py: DISCOURAGED_SYSTEM_UNITS), as
seen on the "Validate tar based distributions changes" check for the WSL
registration PR. WSL maintainers additionally called out the console units
in review.

Add a Kiwi config.sh hook that masks the discouraged units so they resolve
to /dev/null:

  • systemd-networkd.service
  • systemd-networkd-wait-online.service
  • systemd-resolved.service
  • systemd-vconsole-setup.service
  • getty@tty1.service
  • tmp.mount
  • systemd-tmpfiles-setup-dev.service
  • systemd-tmpfiles-setup-dev-early.service

systemd-vconsole-setup.service and getty@tty1.service are masked because
WSL configures the TTY itself; both fail when several distros try to claim
the console in parallel, and tty1 is unreachable under WSL.

Masking (not delisting) is required for the networking/DNS daemons:
azurelinux-release defines %fedora=43, so systemd.spec's
%{?fedora:Recommends: systemd-networkd/resolved} are active and the image's
patternType="plusRecommended" pulls them in as weak deps regardless of the
explicit package list. The two explicit package lines are dropped as well
to reflect intent, but masking is what actually neutralizes the units.

systemd-tmpfiles-setup.service is intentionally left enabled: wsl-setup
relies on it to materialize the WSLg X11/Wayland/PulseAudio socket links,
so masking it would break GUI application support.

Signed-off-by: Muhammad Falak R Wani falakreyaz@gmail.com

@mfrw
mfrw requested a review from a team as a code owner July 27, 2026 04:12
Copilot AI review requested due to automatic review settings July 27, 2026 04:12

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

Masks WSL-incompatible systemd units and removes redundant explicit networking packages.

Changes:

  • Adds a KIWI configuration hook to mask discouraged units.
  • Removes explicit systemd networking packages.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
base/images/wsl/wsl.kiwi Removes explicit networkd/resolved packages.
base/images/wsl/config.sh Masks WSL-incompatible systemd units.

Comment thread base/images/wsl/config.sh
@mfrw mfrw changed the title wsl: mask systemd units discouraged in WSL images fix(wsl): mask systemd units discouraged in WSL images Jul 27, 2026

@jeremycline jeremycline left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the Kiwi config script, while it works, is something of a last resort and we should try to keep them as minimal as possible.

In Fedora, other variants define a preset file in the fedora-release packages, and an example of disabling a unit is in the IoT flavor, so we could add a WSL variant and install it from the fedora-release-wsl subpackage. I think we can make a good case for it upstream and then all the derivative images will also inherit it.

If you want, I can review a patch before you send it upstream or I can prepare it if you're not comfortable doing so.

@tobiasb-ms tobiasb-ms 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.

Agree with comment #18140 (review):

Agree that assuming this technique works it's preferable to a config script.

Note that we use a manual/local version of azurelinux-release rather than trying to munge fedora-release with overlays, etc. And we (like fedora) do have a wsl package.

Also, look at CoPilot's comment: #18140 (comment)

@mfrw mfrw changed the title fix(wsl): mask systemd units discouraged in WSL images fix: mask systemd units discouraged in WSL images Jul 28, 2026
mfrw added 2 commits July 28, 2026 08:19
WSL manages networking, DNS resolution, the console/TTY, /tmp and early
/dev setup on behalf of the distribution. systemd units that duplicate
that management cause DNS/boot breakage under WSL and are flagged by WSL's
distribution validator (validate-modern.py: DISCOURAGED_SYSTEM_UNITS), as
seen on the "Validate tar based distributions changes" check for the WSL
registration PR. WSL maintainers additionally called out the console units
in review.

Add a Kiwi config.sh hook that masks the discouraged units so they resolve
to /dev/null:
  - systemd-networkd.service
  - systemd-networkd-wait-online.service
  - systemd-resolved.service
  - systemd-vconsole-setup.service
  - getty@tty1.service
  - tmp.mount
  - systemd-tmpfiles-setup-dev.service
  - systemd-tmpfiles-setup-dev-early.service

systemd-vconsole-setup.service and getty@tty1.service are masked because
WSL configures the TTY itself; both fail when several distros try to claim
the console in parallel, and tty1 is unreachable under WSL.

Masking (not delisting) is required for the networking/DNS daemons:
azurelinux-release defines %fedora=43, so systemd.spec's
%{?fedora:Recommends: systemd-networkd/resolved} are active and the image's
patternType="plusRecommended" pulls them in as weak deps regardless of the
explicit package list. The two explicit package lines are dropped as well
to reflect intent, but masking is what actually neutralizes the units.

systemd-tmpfiles-setup.service is intentionally left enabled: wsl-setup
relies on it to materialize the WSLg X11/Wayland/PulseAudio socket links,
so masking it would break GUI application support.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Copilot AI review requested due to automatic review settings July 28, 2026 02:49
@mfrw
mfrw force-pushed the mfrw/wsl-systemd branch from dfe6314 to e33d4e4 Compare July 28, 2026 02:49

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 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread base/images/wsl/config.sh Outdated
Comment thread base/images/wsl/config.sh Outdated
Copilot AI review requested due to automatic review settings July 29, 2026 00:17

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 2 out of 2 changed files in this pull request and generated no new comments.

@mfrw mfrw closed this Jul 29, 2026
@mfrw mfrw reopened this Jul 29, 2026
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.

4 participants