Skip to content

Fix systemd-tmpfiles failure on systemd v261+ with systemd boot disabled - #41491

Merged
Feng Wang (chemwolf6922) merged 3 commits into
masterfrom
user/chemwolf6922/fix-systemd-tmpfiles-failure-in-non-systemd-booted-distro
Sep 2, 2026
Merged

Fix systemd-tmpfiles failure on systemd v261+ with systemd boot disabled#41491
Feng Wang (chemwolf6922) merged 3 commits into
masterfrom
user/chemwolf6922/fix-systemd-tmpfiles-failure-in-non-systemd-booted-distro

Conversation

@chemwolf6922

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

In systemd v261, the systemd's tmpfiles.d/x11.conf was changed from D! to D. 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

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

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.conf override 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.conf succeeds 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.

@chemwolf6922
Feng Wang (chemwolf6922) merged commit acf3319 into master Sep 2, 2026
11 checks passed
@chemwolf6922
Feng Wang (chemwolf6922) deleted the user/chemwolf6922/fix-systemd-tmpfiles-failure-in-non-systemd-booted-distro branch September 2, 2026 00:08
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.

WSLg read-only /tmp/.X11-unix breaks dpkg --configure on distros not booting systemd (systemd-tmpfiles exit 73)

3 participants