On some Linux distros (including WSL), when you run the shutdown command, you may get an error: “Failed to connect to bus: No such file or directory
“. As a result, you cannot properly shutdown your Linux host.
sysops@host1:~$ sudo shutdown
[sudo] password for user:
Failed to connect to bus: No such file or directory
To fix the problem, you need to start the dbus daemon through systemctl using the command:
sudo systemctl start dbus
On older versions of Linux with init-based service management, use the command:
sudo /etc/init.d/dbus start
After starting dbus, the shutdown command will execute without error.
Check that dbus is installed on your Linux host:
sysops@host1:~$ sudo apt-get install dbus
If dbus is missing, install it:
sudo apt install dbus
If dbus is installed (dbus is already the newest version), try reinstalling it:
sudo apt-get install --reinstall dbus