WSL
WSL copied to clipboard
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
Version
Microsoft Windows [Version 10.0.22621.521]
WSL Version
- [X] 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
└─(18:13:37)──> cat /etc/wsl.conf ──(Sat,Sep24)─┘
[boot]
systemd=true```
@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?
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
@TylerJaacks based on the kernel version you posted, you're using
WSL 0.65.1. In order to usesystemdyou'll have to upgrade to latest release,WSL 0.67.6. What is the output ofwsl --versionorwsl --status?
If I am not wrong then it's only available to insiders for now, or is it available for all?
download 0.67.6 in https://github.com/microsoft/WSL/releases page
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.
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```
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.
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.
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
@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.
I already have
[boot]
systemd=true
in .wslconfig. And I did run wsl --shutdown to restart.
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: https://github.com/microsoft/WSL/issues/8883#issuecomment-1465758773
@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 !
@yilmazdurmaz @luc-languagetools I cant find the /etc/wsl.conf on the filesystem, do I need to create it myself
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.confThen 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?
@Oluadepe yes, if /etc/wsl.conf is not present already create a new file and add systemd setting to it.
@Oluadepe yes, if
/etc/wsl.confis not present already create a new file and addsystemdsetting to it.
I just did and it worked. 🎉🎉🎉
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 https://github.com/microsoft/WSL/issues/9157) - now log into WSL by
wslcommand in the same or new windows console (orubuntufor example, if you have many distributions) - inside the wsl shell, edit
/etc/wsl.conffile as root or with sudo:sudo nano /etc/wsl.conf(use your favorite linux editor) - insert these 2 lines
[boot]
systemd=true
exitthe 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.
Распределение по умолчанию: 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
@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---
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: https://github.com/microsoft/WSL/issues/8883#issuecomment-1345472665
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
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.
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.
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
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?
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.
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!!!
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.