microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.18k stars 805 forks source link

systemd Not Booting Up in WSL 2 Despite Configuration in wsl.conf #11690

Open owlcode3 opened 2 months ago

owlcode3 commented 2 months ago

Windows Version

Microsoft Windows [Version 10.0.21996.1]

WSL Version

WSL 2

Are you using WSL 1 or WSL 2?

Kernel Version

5.10.102.1

Distro Version

Ubuntu-20.04

Other Software

No response

Repro Steps

1. Install WSL and Ubuntu 22.04:

2. Configure wsl.conf:

[boot] systemd=true

3. Restart WSL:

wsl --shutdown

4. Start WSL and Verify systemd:

Expected Behavior

The command should output systemd, indicating that systemd is running as the init system.

Actual Behavior

The output is not systemd, and running systemctl status returns the following error:

System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

Diagnostic Logs

Log File:

WslLogs-2024-06-13_15-29-23.zip

@OneBlue Please review the logs and provide guidance. Thank you!

github-actions[bot] commented 2 months ago

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Diagnostic information
Appx package is not installed

github-actions[bot] commented 2 months ago
Diagnostic information ``` Issue was edited and new log file was found: https://github.com/user-attachments/files/15822158/WslLogs-2024-06-13_15-29-23.zip Appx package is not installed ```
benhillis commented 2 months ago

Is systemd=true on a separate line like this:

[boot]
systemd=true
owlcode3 commented 2 months ago

Is systemd=true on a separate line like this:


[boot]

systemd=true

Yes it's

yilmazdurmaz commented 2 months ago

as a first aid, please delete your current ubuntu and reinstall it, but do not edit config file.

Last time I have checked (around 6 months), Ubuntu 22.04 image had a working configuration file, and the editor you have used might have broken its content. that is why I ask to leave the file alone.

also give the output for this command: wsl --version

yilmazdurmaz commented 2 months ago

Kernel Version

5.10.102.1

I could only see now this detail in your main post.

This kernel is the old one that is incompatible with systemd. please follow latest answers in the other discussion on how to get the correct one.

you will need version 5.15.xxx

craigloewen-msft commented 2 months ago

Could you also try making sure you're on the latest WSL version? Please try running wsl --install or wsl --update to update. You'll know you're on latest if you run wsl --version and it has a readable output.

owlcode3 commented 2 months ago

as a first aid, please delete your current ubuntu and reinstall it, but do not edit config file.

Last time I have checked (around 6 months), Ubuntu 22.04 image had a working configuration file, and the editor you have used might have broken its content. that is why I ask to leave the file alone.

also give the output for this command: wsl --version

I've uninstall and reinstall it multiples, It does'work. The wsl --version command does not work on my powerShell cl

owlcode3 commented 2 months ago

uninstall and reinstal

Kernel Version

5.10.102.1

I could only see now this detail in your main post.

This kernel is the old one that is incompatible with systemd. please follow latest answers in the other discussion on how to get the correct one.

you will need version 5.15.xxx

Installing wsl should means It'll comes with the latest kernel version. It doesn't in my case

yilmazdurmaz commented 2 months ago

Installing wsl should means It'll comes with the latest kernel version. It doesn't in my case

Unfortunately this is our bleeding open wound.

All our problems start here with the old version still in existence and it is installed by default anytime someone tries to install WSL. This is partly due to using windows 10 versions, as it had accumulated many sub-versions over the years.

Installing the newer, systemd compatible version has its pain all the time, and now it seems the store version (which previously was working) is broken and that dism method is the only one I read working for the moment.

You will need to experiment with the installation until you finally get at least 5.15.xxx kernel.

owlcode3 commented 2 months ago

Installing wsl should means It'll comes with the latest kernel version. It doesn't in my case

Unfortunately this is our bleeding open wound.

All our problems start here with the old version still in existence and it is installed by default anytime someone tries to install WSL. This is partly due to using windows 10 versions, as it had accumulated many sub-versions over the years.

Installing the newer, systemd compatible version has its pain all the time, and now it seems the store version (which previously was working) is broken and that dism method is the only one I read working for the moment.

You will need to experiment with the installation until you finally get at least 5.15.xxx kernel.

I've tried updating and upgrading. It doesn't update to the latest version still. Now I can't even seems to get ubuntu to launch after downloading It. I'm being met with this error WslRegisterDistribution failed with error: 0x8037010d Error: 0x8037010d The virtual machine or container JSON document is invalid.

yilmazdurmaz commented 2 months ago

This last error is a bit annoying as I am unfamiliar with that.

My experience with the WSL installation steps had no problems so far, so I am having hard times when someone fails to get the correct kernel version. (You may notice this in my posts that my help is all about steps after getting past this step).

Other than a complete system reinstall (if possible), unfortunately I am failing to offer you any advice to follow.

Can you please search for, or open a new issue, why you are getting this headache to get the latest WSL kernel on your system.

Another way is to wait for someone that could help to notice this issue, but it will be slow as you may guess.

yilmazdurmaz commented 1 month ago

Windows Version

Microsoft Windows [Version 10.0.21996.1]

This release version number seems to belong to the very first Windows 11 releases.

The first update to Windows, coded to be 21H2, is dated October 2021 and has "22000" version build number. Later, we got 22H2 in 2022 (22621) and 23H2 in 2023 (22631).

My current guess is that your system did not update at least required parts of the system, thus it fails to install the required WSL kernel.

If you are still struggling about this WSL installation, please try again after updating your system to at least 21H2.

Let us know if you find a fix for your system, especially if updating the system helps, so we can add your experience to our list of solutions.