Fix systemd-tmpfiles failure on systemd v261+ with systemd boot disabled - #41491
Merged
Feng Wang (chemwolf6922) merged 3 commits intoSep 2, 2026
Conversation
2 tasks
Copilot started reviewing on behalf of
Feng Wang (chemwolf6922)
September 1, 2026 03:43
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses systemd-tmpfiles failures on systemd v261+ in WSLg-enabled distros that do not boot with systemd by ensuring WSL always generates a /run/tmpfiles.d/x11.conf override when the read-only X11 socket mount is established. This prevents distro-provided tmpfiles.d/x11.conf rules from attempting to chmod/chown the read-only /tmp/.X11-unix mount when systemd-tmpfiles is invoked outside the boot sequence (e.g., during dpkg postinst).
Changes:
- Move generation of the
/run/tmpfiles.d/x11.confoverride from systemd unit generation to X11 mount initialization so it applies regardless of whether systemd is used as PID 1. - Update Windows unit tests to validate the override file exists and that
systemd-tmpfiles --create --boot x11.confsucceeds under WSLg. - Remove the previous override generation logic from
GenerateSystemdUnits().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/linux/init/config.cpp |
Generates /run/tmpfiles.d/x11.conf during X11 mount setup for non-system distros, ensuring the override exists even when systemd boot is disabled. |
src/linux/init/init.cpp |
Removes the prior tmpfiles override generation from systemd unit generation, avoiding reliance on the systemd path. |
test/windows/UnitTests.cpp |
Adds coverage asserting the override file exists when WSLg is enabled and systemd-tmpfiles succeeds; asserts absence when WSLg is disabled. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ben Hillis (benhillis)
approved these changes
Sep 1, 2026
Feng Wang (chemwolf6922)
deleted the
user/chemwolf6922/fix-systemd-tmpfiles-failure-in-non-systemd-booted-distro
branch
September 2, 2026 00:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
In systemd v261, the systemd's
tmpfiles.d/x11.confwas changed fromD!toD. systemd/systemd@5474cad.This means the systemd-tmpfiles command will try to execute it when called out of the boot sequence. In the linked issue's case, it's called by the post install script by dpkg. This will fail as the wsl override is not in place when systemd is disabled.
This PR enables the wsl override file generation for all distros with wslg enabled, regardless of if the distro boots with systemd.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Update tests:
UnitTests::UnitTests::GuiApplications