fix: mask systemd units discouraged in WSL images - #18140
Conversation
There was a problem hiding this comment.
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. |
jeremycline
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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)
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>
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-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