-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix WSL systemd detection #19994
Fix WSL systemd detection #19994
Conversation
@n1hility PTAL |
32b1f89
to
6eb32f9
Compare
Thanks for the PR @Syquel ! Is there a use-case you have for wanting to enable the built-in systemd? To support this properly a different bootstrap/start of machine would be required. The reason we don't yet have built-in support for this mode is because of a WSL bug that breaks user systemd services (used by podman), which is only fixed in preview releases (1.3.14+) |
Hi! I have been using WSL with systemd and podman for ~9 months now successfully (even before the official support) and after applying this patch the podman windows client works too. My use case is the cgroupv2 support provided by systemd. You are right that simply bootstrapping the WSL machine via podman machine init is not enough at the moment, but with a few minor customizations it works without any issues. This patch simply enables the podman windows client to acknowledge that the podman "server" is running on a WSL machine with systemd enabled. As stated in my last review comment I am not sure about only checking PID 1 for systemd, but the general approach to check the actually invoked executable should be correct. // EDIT |
[NO NEW TESTS NEEDED] Signed-off-by: Frederik Boster <[email protected]>
6eb32f9
to
5b990c3
Compare
Could someone take a look, please? |
code looks fine, what say you @n1hility |
LGTM |
/lgtm The change itself is fine so will merge it but until we have formal native systemd support can't promise there won't be other issues (don't consider it supported). |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, Syquel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This reverts commit 5b990c3. PR containers#19994 Causes wsl nsenter script to infinitely loop in standard operation [NO NEW TESTS NEEDED] Signed-off-by: Jason T. Greene <[email protected]>
Does this PR introduce a user-facing change?
If WSL is configured to use systemd by setting
boot.systemd=true
in/etc/wsl.conf
, WSL creates a Symlink from/sbin/init
to/usr/lib/systemd/systemd
and starts systemd via/sbin/init
.podman machine start
,podman machine ssh
and other commands check if systemd is running via isSystemdRunning() and fail if it is not detected.Because isSystemdRunning() incorrectly checks for the command name "/lib/systemd/systemd" instead of the executable path it does not detect systemd running as "/sbin/init".