Skip to content
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

WSL Can't start after enabling systemd #9477

Closed
1 of 2 tasks
falcon-Z opened this issue Jan 13, 2023 · 19 comments
Closed
1 of 2 tasks

WSL Can't start after enabling systemd #9477

falcon-Z opened this issue Jan 13, 2023 · 19 comments
Assignees

Comments

@falcon-Z
Copy link

falcon-Z commented Jan 13, 2023

Version

10.0.22621.1105

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.79.1

Distro Version

openSUSE-Leap-15.4

Other Software

No response

Repro Steps

Followed Instructions to enble Systemd from this Article

Set the system flag set in your WSL distro settings

You will need to edit the wsl.conf file to ensure systemd starts up on boot.

Add these lines to the /etc/wsl.conf (note you will need to run your editor with sudo privileges, e.g: sudo nano /etc/wsl.conf):

[boot]
systemd=true

And close out of the nano editor using CTRL+O to save and CTRL+X to exit.

Final steps

With the above steps done, close your WSL distro Windows and run wsl.exe --shutdown from PowerShell to restart your WSL instances. Upon launch you should have systemd running. You can check this with the command systemctl list-unit-files --type=service which should show your services’ status.

Expected Behavior

Expected WSL to start with Sytemd enabled

Actual Behavior

After Restarting WSL i had the following error

Catastrophic failure
Error code: Wsl/Service/CreateInstance/E_UNEXPECTED

[process exited with code 4294967295 (0xffffffff)]

I cannot access any Resources related to my distro anywhere from terminal to file explorer

Diagnostic Logs

WslLogs-2023-01-18_10-47-21.zip

No response

@sbradnick
Copy link
Contributor

I'm not sure if you actually put this:

[boot]
system=true

in /etc/wsl.conf, but the entry should be:

[boot]
systemd=true

Note it's systemd=true, not system=true.

@falcon-Z
Copy link
Author

Sorry, that was a typo due to Autocorrect. I've corrected it and i am certain i had the right entries in wsl.conf

in /etc/wsl.conf, but the entry should be:

[boot]
systemd=true

@falcon-Z
Copy link
Author

Just to be sure i tried reinstalling Open SUSE Leap and did the same to enable systemd and after Restarting WSl i experienced the same issue with the same error message

I also tried Open SUSE Tumbleweed and experienced no issues there systemd works as expected

@sbradnick
Copy link
Contributor

What version of Leap does Windows report is installed? I can't imagine it makes a huge difference, but I'm curious. Since systemd has been mainstream in WSL (i.e. post v1.0.0), I haven't had issues with it. Early on, there was an issue w/ what /sbin/init was pointing to, and that may not have even been with Leap.

2023-01-17-134251_914x455_scrot

Also, do you have any .wslconfig file in your home directory in Windows?

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 17, 2023

/logs

@ghost
Copy link

ghost commented Jan 17, 2023

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@OneBlue OneBlue self-assigned this Jan 17, 2023
@falcon-Z
Copy link
Author

Updated issue with logs see section Diagnostic logs for the log file

@ghost ghost removed the needs-author-feedback label Jan 18, 2023
@falcon-Z
Copy link
Author

@sbradnick app version seems different . in my case
Screenshot 2023-01-18 104411

Also, do you have any .wslconfig file in your home directory in Windows?

I dont know what you mean by home directory on windows. If you ean my user folder then i dont see a .wslconfig file and i dont think any such file exists in my system

I also had Leap reinstalled to check if .wslcinfig exists there and i couldn't find such file.

@sbradnick
Copy link
Contributor

I dont know what you mean by home directory on windows. If you ean my user folder then i dont see a .wslconfig file and i dont think any such file exists in my system

I suppose %HOMEPATH% or $env:HOMEPATH would be better in Windows ;) .wslconfig is a control file/mechanism for ALL WSL distros; whereas <some distro>:/etc/wsl.conf would be for a specific distro. I just wanted to remove the possibility of something [Windows] system wide interfering.

154.1.855.0 is what's offered up by the Store[front], but none of them have even been broken in this regard. I will install later versions from our build system from time to time, so that's most likely why you see a different version.

I also don't want to throw out "Well, it works for me." - but that is true. So you can do a fresh install of the distro and when the ONLY thing you do is add:

[boot]
systemd=true

to /etc/wsl.conf, then you get that error?

@falcon-Z
Copy link
Author

I suppose %HOMEPATH% or $env:HOMEPATH would be better in Windows ;)

😄 Thats true.

I just wanted to remove the possibility of something [Windows] system wide interfering.

I understand that and i dont think there is any global config for WSL on my system

So, you can do a fresh install of the distro and when the ONLY thing you do is add:

I did try that, same results. Either way I'll try again.

Like i said earlier Systemd works on Tumbleweed

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 23, 2023

Thank @falcon-Z.

I'm not seeing any WSL logs in the file you shared. Did you run wsl.exe while the log collection was running ?

To be sure, can you run: wsl.exe --shutdown, and run the log collection again (make sure to capture the error)

@ghost
Copy link

ghost commented Jan 30, 2023

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

@aahahocevar
Copy link

aahahocevar commented Feb 5, 2023

I'm having the same problem, just after enabling systemd:

imagen

Here is my logs

WslLogs-2023-02-05_18-55-12.zip

@OneBlue
Copy link
Collaborator

OneBlue commented Feb 7, 2023

@aahahocevar: I'm not seeing any logs (.etl) files in the trace you sent. Can you please try capturing them again ?

@sbradnick
Copy link
Contributor

See #9602 (comment) ; If you're having the same issue in Leap, this is most likely the fix ; I fixed it overall a few months ago (and since I add my repo to new installs, in general) I've gotten accustomed to zypper in -t pattern wsl_systemd which includes my fix.

@aahahocevar
Copy link

Nice!, it worked with "zypper in -t pattern wsl_base", thanks a lot!

@Lordxan
Copy link

Lordxan commented Mar 11, 2023

My WSL instance stopped working because of this line how can i fix it? Is there some kind of switch to start WSL instance without this config?

@jamesgecko
Copy link

jamesgecko commented Aug 12, 2023

Ran into this on a fresh openSUSE Leap 15.5 installation. It's still a problem, and neither this nor #9602 should be closed imho.

My WSL instance stopped working because of this line how can i fix it? Is there some kind of switch to start WSL instance without this config?

I was able to recover my installation with the instructions in #9602 for mounting the vhdx and enable systemd by adding the missing /sbin/init symlink also described in the ticket.

@jlriven
Copy link

jlriven commented Oct 29, 2024

wsl1 can switch to systemd?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants