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

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

Open
1 of 2 tasks
TylerJaacks opened this issue Sep 24, 2022 · 123 comments

Comments

@TylerJaacks
Copy link

Version

Microsoft Windows [Version 10.0.22621.521]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.57.1

Distro Version

Ubuntu 22.04.1 LTS

Other Software

N/A

Repro Steps

Enable systemd via /etc/wsl.conf

Run sudo systemctl list-units --type=service

Expected Behavior

List of services show.

Actual Behavior

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

No response

@TylerJaacks
Copy link
Author

└─(18:13:37)──> cat /etc/wsl.conf                                                                       ──(Sat,Sep24)─┘
[boot]
systemd=true```

@elsaco
Copy link

elsaco commented Sep 24, 2022

@TylerJaacks based on the kernel version you posted, you're using WSL 0.65.1. In order to use systemd you'll have to upgrade to latest release, WSL 0.67.6. What is the output of wsl --version or wsl --status?

@TylerJaacks
Copy link
Author

Yeah so I just figured it out now whenever I run the command and it just takes a while and gives me Failed to list units: Transport endpoint is not connected

@tusharsnx
Copy link

@TylerJaacks based on the kernel version you posted, you're using WSL 0.65.1. In order to use systemd you'll have to upgrade to latest release, WSL 0.67.6. What is the output of wsl --version or wsl --status?

If I am not wrong then it's only available to insiders for now, or is it available for all?

@echoechoin
Copy link

download 0.67.6 in https://github.com/microsoft/WSL/releases page

@TylerJaacks
Copy link
Author

So I just gave up on this Preview and will wait for Stable cause it works fine on Stable Windows 11 Branch and then Systemd just breaks and If I try to run wsl.exe --shutdown I get the hanging computer issue.

@ejazahm3d
Copy link

So I have the same issue. It was working previously so I have no idea why it stopped working. I am using version from github releases. Here is the output for --version.

Kernel version: 5.15.62.1
WSLg version: 1.0.44
MSRDC version: 1.2.3401
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.1042```

@scruel
Copy link

scruel commented Nov 21, 2022

Problem solved:
Goto https://github.com/microsoft/WSL/releases, download new version of WSL (0.67.6 and higher), install and reboot your system.
Enable systemd via /etc/wsl.conf
Then retry.

Thanks to @echoechoin.

@yilmazdurmaz
Copy link

Although the question was asked for Windows 11, the same error also comes up in Windows 10 installations if some updates are missing. These steps are for W10 users.

  • Install WSL from within Windows Store
  • Install update KB5020030. (I had to download it manually from the Update Catalog)

This "install from Store" might also solve W11 problems. Check that first if this error happens.

@luc-vocab
Copy link

I'm having the same issue on windows 10 pro

C:\WINDOWS\system32>wsl --version
WSL version: 1.0.0.0
Kernel version: 5.15.74.2
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2311
luc@wsl2-ubuntu$ systemctl status cron
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

@yilmazdurmaz
Copy link

@luc-languagetools your system seems ready to use it. I am guessing you have forgotten to activate it in /etc/wsl.conf. please read answers in this thread to see how you do it.

@luc-vocab
Copy link

luc-vocab commented Nov 30, 2022

I already have

[boot]
systemd=true

in .wslconfig. And I did run wsl --shutdown to restart.

@yilmazdurmaz
Copy link

yilmazdurmaz commented Nov 30, 2022

it is not %userprofile%\.wslconfig you would be editing. it is /etc/wsl.conf inside. you will need to have root access

wsl  # in cmd or powershell
sudo nano /etc/wsl.conf # or use your fav editor
  #insert those 2 lines you have, then save the file and exit the editor
  # Ctrl+X for nano, confirm write, confirm the name
exit
wsl --shutdown #  first shutdown
wsl # then restart

PS: this .wslconfig thing might be something that wsl team have in mind. at least for now, that is the other file you need to edit.

PS: please refer to this post down below for a short intro/warning about terminal editors: #8883 (comment)

@luc-vocab
Copy link

@yilmazdurmaz you are correct, I had been mistakenly editing %USERPROFILE%.wslconfig

[boot]
systemd=true

should go into /etc/wsl.conf on the filesystem inside WSL. And now it works ! I really appreciate your help !

@Oluadepe
Copy link

@yilmazdurmaz @luc-languagetools I cant find the /etc/wsl.conf on the filesystem, do I need to create it myself

@Oluadepe
Copy link

Problem solved: Goto https://github.com/microsoft/WSL/releases, download new version of WSL (0.67.6 and higher), install and reboot your system. Enable systemd via /etc/wsl.conf Then retry.

Thanks to @echoechoin.

I have the latest release of WSL, but /etc/wsl.conf is not present in the filesystem, do i have to manually create it?

@elsaco
Copy link

elsaco commented Dec 10, 2022

@Oluadepe yes, if /etc/wsl.conf is not present already create a new file and add systemd setting to it.

@Oluadepe
Copy link

@Oluadepe yes, if /etc/wsl.conf is not present already create a new file and add systemd setting to it.

I just did and it worked. 🎉🎉🎉

@yilmazdurmaz
Copy link

yilmazdurmaz commented Dec 11, 2022

Let me unify the answers

  • open a terminal and run this command: wsl --version. If you see "WSL version: 1.0.0.0" (or higher in 1.x.x.x) then you are ready to go. Else, follow the installation instructions until you see it. (Installing KB5020030 might be needed as discussed in WSL v1.0.0 cannot be installed on Windows 10 Version 19045, whereas supported on the System Requirements on Microsoft Store #9157)
  • now log into WSL by wsl command in the same or new windows console (or ubuntu for example, if you have many distributions)
  • inside the wsl shell, edit /etc/wsl.conf file as root or with sudo: sudo nano /etc/wsl.conf (use your favorite linux editor)
  • insert these 2 lines
[boot]
systemd=true
  • exit the shell
  • shutdown wsl: wsl --shutdown
  • then restart it again: wsl.

EDIT: 2023-03-07
There were new cases and new defining moments to solve the problem. In addition to above lines, as a summary of things below, here are a few new requirements to be aware of:

in addition to /etc/wsl.conf with correct content:

  • we need the new WSL 1.x.x series, or Store version (latest 1.1.3.0, as of now),
  • and version 2 (WSL2 not WSL),
  • and LF/0A line endings (not CRLF/0D0A)
  • also dbus inside the distro might be needed, install related packages so that users can use it too. (at least, Debian comes without dbus)
  • also acpi inside the distro causes problems, uninstall related packages.

@ghost
Copy link

ghost commented Dec 12, 2022

Распределение по умолчанию: Ubuntu-20.04
Версия по умолчанию: 2 (WSL-2)
Версия ядра: 5.10.102.1

I got an error:

sudo systemctl status postgresql

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

I did all the things above:

cat /etc/wsl.conf
[boot]
systemd=true

I did run wsl --shutdown to restart

@elsaco
Copy link

elsaco commented Dec 12, 2022

@Luxpy what version of WSL are you running? systemd support was added in https://github.com/microsoft/WSL/releases/tag/0.67.6, the same release that introduced Microsoft.WSL.Kernel version 5.15.62.1. Looks like you're running an older kernel implying an older WSL.

I can confirm that systemd works okay in Ubuntu 20.04 and WSL 1.0.0:

elsaco@RIPPER:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
elsaco@RIPPER:~$ systemctl status --no-pager
● RIPPER
    State: degraded
     Jobs: 0 queued
   Failed: 6 units
    Since: Mon 2022-12-12 08:22:02 PST; 19s ago
   CGroup: /
           ├─user.slice
           │ └─user-1000.slice
           │   ├─[email protected]
           │   │ ├─session.slice
           │   │ │ ├─pipewire-media-session.service
           │   │ │ └─pipewire.service
           │   │ ├─app.slice
           │   │ │ ├─at-spi-dbus-bus.service
           │   │ │ └─dbus.service
           │   │ └─init.scope
           │   └─session-c1.scope
           ├─init.scope
           └─system.slice
---cut---

@yilmazdurmaz
Copy link

yilmazdurmaz commented Dec 12, 2022

check this link if you haven't yet. https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/

Ensuring you are on the right WSL version
This change is only available in the "Microsoft Store version of WSL" version 0.67.6 and higher. You can check your version number by running wsl --version. If that command fails then you are running the in-Windows version of WSL and need to upgrade to the Store version

You need to have the "Store version" from now on. Open "Microsoft Store" app and search "Windows Subsystem for Linux". I forgot where I read but there was a statement like "WSL will continue with the store version and receive all new 'feature' updates from there". and its latest version has the following signature (at least mine shows no update available). Also use wsl --update to make sure of getting fixes. my current version shows these lines.

WSL version: 1.0.3.0
Kernel version: 5.15.79.1

for a few other important details, check my above post: #8883 (comment)

@Tamoghna-Saha
Copy link

Let me unify the answers

* open a terminal and run this command: `wsl --version`. If you see "WSL version: 1.0.0.0" (or higher in 1.x.x.x) then you are ready to go. Else, follow the installation instructions until you see it. (Installing KB5020030 might be needed as discussed in [WSL v1.0.0 cannot be installed on Windows 10 Version 19045, whereas supported on the System Requirements on Microsoft Store #9157](https://github.com/microsoft/WSL/issues/9157))

* now log into WSL by `wsl` command in the same or new windows console (or `ubuntu` for example, if you have many distributions)

* inside the wsl shell, edit `/etc/wsl.conf` file as root or with sudo: `sudo nano /etc/wsl.conf` (use your favorite linux editor)

* insert these 2 lines
[boot]
systemd=true
* `exit` the shell

* shutdown wsl: `wsl --shutdown`

* then restart it again: `wsl`.

Yup. This worked like a charm! Thanks

@mert-kurttutan
Copy link

mert-kurttutan commented Dec 16, 2022

wsl --version

Hi @yilmazdurmaz ,
What if we don't have access to store version (as it is blocked by company's IT policy in my case).
Do you have any suggestion for this problem?

Thanks in advance.

@yilmazdurmaz
Copy link

What if we don't have access to store version (as it is blocked by company's IT policy in my case).

In case you use your own laptop, just find a permissive internet (a friend's maybe). If it is a company PC/laptop and you are in constant use of WSL, especially for docker containers, you need to contact your administrators to have it installed. otherwise, any other way you install it may seem offensive to them.
However, if you are new to WSL and you don't care about initd, which is the main problem we were discussing, you can still try installing the internal one, enabling it from windows features. from "app & features" settings, find "related settings" down the list, go to "programs and features" and use "turn windows features on or off" link on the left. it is still a full-featured WSL except for some new features added in recent months. only when you need these new things, then you need the new store version.

@TechNov
Copy link

TechNov commented Jan 16, 2023

if you use WSL.
run service service_name start insted of ystemctl start service_name

Systemd command => Sysvinit command
-- | --
systemctl start service_name=>service service_name start
systemctl stop service_name=> service service_name stop
systemctl restart service_name=> service service_name restart
systemctl status service_name=>service service_name status
systemctl enable service_name => chkconfig service_name on
systemctl disable service_name=> chkconfig service_na

@dieguiariel
Copy link

Hi! im trying to make systemD work on WSL, followed all the instructions from above (i couldn't install KB5020030 as it keeps failing telling me This Update Is Not Applicable To Your Computer, tried from 21H1 version and upgraded to 22H2 version with no sucess).
Currently:
C:\Users\diegu>wsl --version
Versión de WSL: 1.1.3.0
Versión de kernel: 5.15.90.1
Versión de WSLg: 1.0.49
Versión de MSRDC: 1.2.3770
Versión de Direct3D: 1.608.2-61064218
Versión DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Versión de Windows: 10.0.19045.2673

Tried with ubuntu 20.04 and upgraded to 22.04 but still didn't work:
cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

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

sudo cat /etc/wsl.conf
[boot]
systemd=true

any ideas?

@yilmazdurmaz
Copy link

yilmazdurmaz commented Mar 5, 2023

your wsl version is 1.1.3.0 which means you already have a compatible version. that KB update possibly fails since you try to use arm64 on x64, or vice versa (you downloaded a wrong version).

Tried with ubuntu 20.04 and upgraded to 22.04 but still didn't work

each distro is a new virtual machine, and each machine must be configured separately to start with systemd, then must be restarted.

wsl --list -v # need version 2
wsl --set-version distronameyouset 2
wsl -d distronameyouset
sudo nano /etc/wsl.conf # or any editor that uses LF, or 0A, as new line
exit
wsl --terminate distronameyouset # shutdown single
# wsl --shutdown # shutdown all
wsl -d distronameyouset

there is one thing I am not sure about: this might require an x64 machine but you use x86 (32bit). and one more possible thing is, I don't know if has any relation, is WSL versus WSL2; can't say if 1.1.3.0 is possible with WSL but worth checking. try the above way first, then check these possibilities.

EDIT: After receiving the next answer, I put the "set-version" step in case someone in the future reads these steps. we need WSL2.

@dieguiariel
Copy link

Hi, thanks for your resnpose:
About the KB version:
Device name pc-PC
Processor Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz 2.50 GHz
Installed RAM 8.00 GB
Device ID 6BA11125-2FCF-4573-8DA3-266A8ED87C58
Product ID 00330-80000-00000-AA476
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display

tried the x64 version but when it fails, just in case ive tried all versions, and tried with the 21H1 and 22H2 (i was on 21H1 before thinking having systemD was a good idea xD..)

C:\Users\diegu>wsl --list
Distribuciones de subsistema de Windows para Linux:
Ubuntu-20.04 (predeterminado)

C:\Users\diegu>wsl -d Ubuntu-20.04
diego@pc-PC:/mnt/c/Users/diegu$ sudo nano /etc/wsl.conf
[sudo] password for diego:
sudo: a password is required
diego@pc-PC:/mnt/c/Users/diegu$ sudo cat /etc/wsl.conf
[sudo] password for diego:
[boot]
systemd=true
diego@pc-PC:/mnt/c/Users/diegu$

About the wsl or wsl2 version you pointed me in the right direction:

C:\Users\diegu>wsl -l -v
NAME STATE VERSION

  • Ubuntu-20.04 Running 1

C:\Users\diegu>wsl --set-version Ubuntu-20.04 2
Para obtener información sobre las diferencias clave con WSL 2, visita https://aka.ms/wsl2

Conversión en curso. Esta operación puede tardar unos minutos.
The operation completed successfully.

C:\Users\diegu>wsl -l -v
NAME STATE VERSION

  • Ubuntu-20.04 Stopped 2

C:\Users\diegu>

and 👍 tadaaa!
diego@pc-PC:/mnt/c/WINDOWS/system32$ systemctl status --no-pager
● pc-PC
State: starting
Jobs: 5 queued
Failed: 1 units
Since: Sun 2023-03-05 10:17:53 -03; 26s ago
CGroup: /
├─init.scope
│ └─1 /sbin/init

thank you very much!!!

@yilmazdurmaz
Copy link

yilmazdurmaz commented Mar 5, 2023

About the wsl or wsl2 version you pointed me in the right direction:
wsl -l -v
Ubuntu-20.04 Running 1
wsl --set-version Ubuntu-20.04 2

nice! I wasn't sure about that. It is good to know WSL2 is required to get a working SystemD.

@MJQWIND
Copy link

MJQWIND commented Apr 20, 2024

I'm running a fully updated 21H2 version, was unable to start WSL with systemd enabled. My wsl.conf came with

[boot]
systemd=true

by default, nevertheless, systemd was not available.

I installed "Windows Subsystem for Linux" from the MS Store, like I always did, which is apparently where the issue comes from. Store version of WSL is broken, and it does not even come up in the Store search (it was hidden and I had to google for the URL).

wsl --status reported that I indeed use WSL2, but my WSL kernel version was 5.10.102.1. Apparently, this version does not support systemd and WSLg. wsl --update also reported that my WSL is updated to the last available version, which is not true. Latest WSL kernel at this moment is 5.15, but this kernel is not listed on MS's own update catalog.

I tried to download latest WSL from the Github releases page, but the installer just crashed.

My solution was to install WSL from dism: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart After that, reboot and run wsl --update. Now my kernel version is 5.15 and systemd works properly.

Thank you very much! I met the same problem and with your help I solved it.

@jwhipp
Copy link

jwhipp commented May 5, 2024

+1 here... seeing this now on a fresh Windows 11 install (22631.3527) using "Turn Windows features on or off" and selecting "Windows subsystem for Linux". I used the dism.exe trick above with apparently updates it again with a newer version and sovles the issue. My understanding has always been that dism and "Turn Windows features ..." were basically the same thing.

@ndamulelonemakh
Copy link

ndamulelonemakh commented May 8, 2024

I can confirm, adding:

[boot]
systemd=true

inside /etc/wsl.conf worked for me on Windows version: 10.0.19045.4291 running WSL version: 2.0.14.0

  • After adding the file, I restarted wsl by running wsl --shutdown from powershell, then opened the WSL terminal

@owlcode3
Copy link

owlcode3 commented Jun 11, 2024

I'm facing similar issue and I've tried everything suggested here, still can't get it to work.

@suyash2819
Copy link

suyash2819 commented Jun 17, 2024

I am still not able to resolve:

WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.19045.4529

added

[boot] systemd=true

in /etc/wsl.conf

Please help

@yilmazdurmaz
Copy link

@owlcode3 "tried everything" is a very misleading statement. you possibly missed one of the working solutions we discussed above. this is a long thread so please make sure you followed messages correctly, and if it still fails prepare a more detailed "help me" post, that includes WSL version, config file path and content etc.

@suyash2819 did you copy-pasted as-is? you got a single line here, but it sould be at 2 lines (I am sure you have already seen how).

for both of you, please make sure you restarted WSL at leat, or you PC to make sure, after you installed it clean.

@owlcode3
Copy link

@owlcode3 "tried everything" is a very misleading statement. you possibly missed one of the working solutions we discussed above. this is a long thread so please make sure you followed messages correctly, and if it still fails prepare a more detailed "help me" post, that includes WSL version, config file path and content etc.

@suyash2819 did you copy-pasted as-is? you got a single line here, but it sould be at 2 lines (I am sure you have already seen how).

for both of you, please make sure you restarted WSL at leat, or you PC to make sure, after you installed it clean.

How'd you tagged my comment as misleading when you don't know all I've done to troubleshoot the issue?
Well I opened an issue here with logs also. You can check it out if you don't mind.

@yilmazdurmaz
Copy link

How'd you tagged my comment as misleading when you don't know all I've done to troubleshoot the issue?

because everyone tell "I have tried everything", yet they do not tell us what they have really tried, and eventually we do find out that they haven't really tried everything because they have really missed something. And here you are telling us the same thing without giving us any details on what you have tried.

Please, stop arguing and enlighten us in that issue you have created. I am in the hospital for a family member and don't have much time, so I may not be the one to give you a solution. yet, i will try to check your logs later. so please keep your cool and patience.

@suyash2819
Copy link

suyash2819 commented Jun 18, 2024

@yilmazdurmaz I have written it in 2 lines, have shutdown the WSL and restarted - it didn't work, and I restarted my PC but still it's the same.

image

do you think the config which I shared from WSL --version are correct?
Would you recommend uninstalling the WSL and installing it again from the store?

@yilmazdurmaz
Copy link

yilmazdurmaz commented Jun 18, 2024

Would you recommend uninstalling the WSL and installing it again from the store?

numbers seem to be alright, but reinstalling is worthy to try. check this link and try the dism command given there: #8883 (comment)

it is another useful answer in this discussion, yet it is easy to miss among all the posts in the discussion.

@suyash2819 other than that, file content and distro packages are important. hard to pinpoint, so please try to check my answers in the discussions. Over the years, I tried to compile in a few posts the problems we have seen and possible solutions we applied. I just could not work on them in last 7-8 months, but in that time other users have added new solutions mostly on installing the right version of WSL.

@dieguiariel
Copy link

dieguiariel commented Jun 18, 2024 via email

@suyash2819
Copy link

I uninstalled, reinstalled, it gave another error which I had to correct from my BIOS and then it all worked.
Thank you

@owlcode3
Copy link

I uninstalled, reinstalled, it gave another error which I had to correct from my BIOS and then it all worked. Thank you

How were you able to do it?

@owlcode3
Copy link

wsl --update

I'm running a fully updated 21H2 version, was unable to start WSL with systemd enabled. My wsl.conf came with

[boot]
systemd=true

by default, nevertheless, systemd was not available.

I installed "Windows Subsystem for Linux" from the MS Store, like I always did, which is apparently where the issue comes from. Store version of WSL is broken, and it does not even come up in the Store search (it was hidden and I had to google for the URL).

wsl --status reported that I indeed use WSL2, but my WSL kernel version was 5.10.102.1. Apparently, this version does not support systemd and WSLg. wsl --update also reported that my WSL is updated to the last available version, which is not true. Latest WSL kernel at this moment is 5.15, but this kernel is not listed on MS's own update catalog.

I tried to download latest WSL from the Github releases page, but the installer just crashed.

My solution was to install WSL from dism: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart After that, reboot and run wsl --update. Now my kernel version is 5.15 and systemd works properly.

I did exactly what you stated here. for some reasons my kernel version still remains at 5.10.102.1

@yilmazdurmaz
Copy link

yilmazdurmaz commented Jun 19, 2024

@owlcode3, I could not follow changes to WSL in recent months. It is possible 21H2 got old and current releases might not work/install on it. Small possibility, nonetheless a possibility

Other than that, you might have enabled Hyper-V on your first install and it might be the reason yours don't update to newer versions. Check if this is the case and disable its traces.

Also try to completely remove all WSL features along with Hyper-V. Then try again this "dism" command.

I don't think it would be a thing for you, but also check your BIOS if the virtualization is enabled.

@owlcode3
Copy link

@owlcode3, I could not follow changes to WSL in recent months. It is possible 21H2 got old and current releases might not work/install on it. Small possibility, nonetheless a possibility

Other than that, you might have enabled Hyper-V on your first install and it might be the reason yours don't update to newer versions. Check if this is the case and disable its traces.

Also try to completely remove all WSL features along with Hyper-V. Then try again this "dism" command.

I don't think it would be a thing for you, but also check your BIOS if the virtualization is enabled.

I think It's called HypervisorPlatform on my system, and I've enabled and disabled It, It doesn't make any difference.
And yes, virtualization is enabled.

@MeechaPooch
Copy link

MeechaPooch commented Jul 5, 2024

Its still not working
Ive added the /etc/wsl.conf, ive rebooted wsl and my dell computer, my WSL is at the latest version. I am on windows 10 home edition.

Error print:

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

/etc/wsl.conf:

$ cat /etc/wsl.conf
[boot]
systemd=true

[user]
default=powchm

latest version 2.2.4.0 and windows version info

$ wsl.exe --version
Default Distribution: Ubuntu
Default Version: 2
PS C:\Users\Irene> wsl --version
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.19045.4529

on Ubuntu

$ wsl --status
Default Distribution: Ubuntu
Default Version: 2

@yilmazdurmaz
Copy link

@MeechaPooch you seem you have edited the config file to add default user. My guess is that you used an editor that changed the line endings from linux format (LF-0A) to dos format (CRLF-0D0A). system fails to load the config file in this case.

try hexdump /etc/wsl.conf and see if this is the case (does Ubuntu have hexdump by default? you may need to install it)

Fixing it depends on the editors to use and their settings for this format, and it will be long to give instructions here. Please search the internet about fixing this line ending problem.

@MeechaPooch
Copy link

I've verified that it is properly loading the conf file and still not booting with systemd

@yilmazdurmaz
Copy link

I've verified that it is properly loading the conf file and still not booting with systemd

I am clueless now. Your system seems ready and you say the config file is fine.

I wonder if something has changed (or a bug) about the "Home" editions. Do you guys have a chance to install from scratch including Windows? (chance to use another version?)

@yilmazdurmaz
Copy link

I had a recent installation experience, and honestly it should be this easy now. My old pc/laptop all broke and I was on a borrowed Mac for a while until I found out to side install windows on it. Then had to try my old WSL disks since the disk they are on was giving errors. so I had to install WSL again.

https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

The link has a recent (from last december) steps to install WSL 2. First 3 steps are there to make sure WSL is installed. Then, on step 4, after running that kernel update package, I used the 'wsl --update' command and then 'wsl --version' command worked giving the current 2.2 number. (don't forget to step 5 after this)

after importing one of my old images, it was running fine with systemd as the PID 1, showing these 4-5 steps are nowadays pretty enough to run systemd, unless your linux distro or config file has the problems I listed in my early answers.

@yilmazdurmaz
Copy link

yilmazdurmaz commented Aug 24, 2024

I want to share my experience about why it might be stuck at 5.10.xx version line. It will be bit long story and I hope its steps may help newcomers to identify their problems. (jump to last "here are the steps" part if you dont like reading stories)

I had a few days to work on the install/update steps. (I messed up my registry keys, so had to reinstall). I have found out that I was just lucky not get any problem because of one of my usual system installation step: install system updates then do whatever else needed.

This time around, I tried to install WSL/2 before any update: Yep, it totally got me unprepared, and messed with my sanity. As I had never have a problem getting the latest version before, it was though for me to identify the problem. That small update file from step 4 on the above link was installed, yet the version was still the old one.

On Win 10 22H2, the default version that comes is 5.10.16. And if I use wsl --update, it gets 5.10.102.1. I used --rollback option along with trying to uninstall/reinstall from windows features, and messed up more: it crippled so much that it wouldn't even uninstall (then I reinstall windows again, as it was not clean enough for me anymore).

In the next clean attempt, I have found the store link to the WSL/2 update (is missing from store nowadays) and installed it. Surprise!! It did not work as expected. Even after installing store version, it kept the 5.10.xx line. The wsl link/program on the start menu was just not running at all.

Finally I went a little deeper. I have fount out that the new wsl version is installed under c:\Program Files\WSL\ and the wsl.exe in there had the 2.2.xx version. It is just that it wouldn't work if I click on it. Then I decided to run it in the console to see if it was giving any error, and Voila!!, it did:

Windows version 10.0.19045.2006 does not support the packaged version of Windows Subsystem for Linux.
Install the required update via Windows update or via: https://aka.ms/store-wsl-kb-win10
For information please visit https://aka.ms/wslinstall
Error code: Wsl/WSL_E_OS_NOT_SUPPORTED

I followed the link and found out that I had already posted about it, alas without knowing why exactly: At least update your system using KB5020030 if you clean install your system.

As soon as I installed this update, my wsl was running the latest 2.2.xx version, along with the systemd being PID 1 in my ubuntu 22.04. (previously it was starting with initd being PID 1).

I reinstalled windows one more time and tried a slightly different approach: installed all windows updates that the Windows Update in the settings finds, and use only a single command that comes with default wsl, wsl --update. It worked like a charm and without downloading anything else, it updated itself to the latest store version (previously this command was updating within 5.10.xx line)

HERE ARE THE STEPS:

Long story short, here are the 4 steps to install WSL 2 in 2024 (first one is very important):

  • Step 1: Update your Windows.

    • the WSL that comes with installation media cannot update itself beyond 5.10.xx version line.
    • You need to have at least one of 1904x.2311 version of Windows 10 (20H2, 21H1, 21H2, 22H2) that was updated on December 2022 with KB5020030, to run WSL 2. Follow https://aka.ms/store-wsl-kb-win10.
    • Or, just open the Windows Updates tab in the Updates& Security of Settings application, and fully update your system.
    • This is again given in step 3 in the link I gave in my previous post, but I think it fails to deliver the importance of the step.
  • Step 2: Just activate WSL in the Windows Features (faster via the following commands)

    • dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    • dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    • these are from the link from previous post.
  • Step 3: Do not download anything fancy and just use this command and it should update to the latest WSL 2

    • wsl --update
    • if system updates are not installed properly, this will get you 5.10.xx line, otherwise will properly get the latest version available (today it was 2.2.xx line).
    • read the warning below for possibility of updating through Windows Update not being enough.

PS: In the future, this discussion may go longer and this post might not be easy to find. Please warn user with the issue having stuck at 5.10.xx line to first update their system to latest or to the ones mentioned above. Only then discuss other issues, possibly tied to wsl.conf file, which probably we have solution in previous posts. This was long to read but I hope I was helpful.

EDIT: "2.2.xx" is actually the WSL version, but "5.10.xx" is the kernel version. I didn't want to edit the text above, so a correction comes here: kernel versions for "2.2.xx" line is "5.15.xxx"; currently WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2

WARNING: when using dism /Apply-Image method to install Windows, probably on a USB drive, the system may not update itself to support newer version of WSL 2 for systemd support. If the wsl --update command fails to get the latest, then you probably fall into this situation. In that case, please download and install KB5020030, then try again.

@nicomollet
Copy link

nicomollet commented Sep 9, 2024

I still had issues with systemctl probably because of the line breaks.
I removed the /etc/wsl.conf file and recreated it again with nano inside WSL and it worked.

@IsraelBoka
Copy link

It worked after an update wsl --update, i tried all the above without success

@Rollingbutter
Copy link

@MeechaPooch you seem you have edited the config file to add default user. My guess is that you used an editor that changed the line endings from linux format (LF-0A) to dos format (CRLF-0D0A). system fails to load the config file in this case.

try hexdump /etc/wsl.conf and see if this is the case (does Ubuntu have hexdump by default? you may need to install it)

Fixing it depends on the editors to use and their settings for this format, and it will be long to give instructions here. Please search the internet about fixing this line ending problem.
It really works when I change CRLF-0D0A into LF-0A. Thank you so much, I will go crazy without your help.

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

No branches or pull requests