Skip to content

Instantly share code, notes, and snippets.

@alyleite
Last active July 7, 2026 13:15
Show Gist options
  • Select an option

  • Save alyleite/ca8b10581dbecd722d9dcc35b50d9b2b to your computer and use it in GitHub Desktop.

Select an option

Save alyleite/ca8b10581dbecd722d9dcc35b50d9b2b to your computer and use it in GitHub Desktop.
Failed to connect to bus: Host is down - WSL 2

» sudo systemctl daemon-reload

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

==============================================

Edit*

  1. Open /etc/wsl.conf with any editor:

sudo nano /etc/wsl.conf

  1. Add the following contents and save them

[boot] systemd=true

  1. Close the Linux window
  2. Execute the following command in PowerShell

wsl --shutdown

wsl

  1. Problem Solving

==============================================

just try:

sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig

sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target

exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME

snap version

@Jiwangreal

Jiwangreal commented Apr 3, 2024

Copy link
Copy Markdown

The $LOGNAME meaning is the same as whoami command, assigning a value to $LOGNAME if its not existing

@Faaiq-84

Copy link
Copy Markdown

it didn't work even with wsl 2

@andynl

andynl commented May 30, 2024

Copy link
Copy Markdown

It worked, thanks!

@jonathanSimonney

jonathanSimonney commented Jan 6, 2025

Copy link
Copy Markdown

please note that on step 2, you need to write on a DIFFERENT line the systemd=true (and not on the same line than the [boot] part)

@babitagangurde

Copy link
Copy Markdown

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment