> ## Content Index
> Fetch the complete content index at: https://sgpublic.xyz/llms.txt
> Use this file to discover other available public pages before exploring further.

# WSL Ubuntu 22.04 systemctl 命令报错
- URL: https://sgpublic.xyz/p/2023/02/6aac9cb1810a4800015335f4/
- Published: 2023-02-21T08:53:39.000Z
- Updated: 2026-09-18T04:05:00.000Z
- Author: Haven Madray
- Tags: 桌面与终端, Windows/WSL, #wp-post

> 参考文献：[Advanced settings configuration in WSL | Microsoft Learn](https://learn.microsoft.com/en-us/windows/wsl/wsl-config?ref=sgpublic.xyz)

在 WSL Ubuntu 22.04 下，`systemctl` 命令报错以下内容：

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

## 解决方案

#### 安装 `wsl-setup`

```
sudo apt install wsl-setup
```

#### 配置 WSL

创建 `/etc/wsl.conf` ，并写入内容。

##### WSL for Windows 10/11

```
[boot]
command="/usr/libexec/wsl-systemd"
```

##### WSL Preview for Windows 11

```
[boot]
systemd=true
```

杀掉 WSL（cmd 中运行）：

```
wsl -t Ubuntu
```

向 Terminal 中的 Ubuntu 配置文件添加参数，如图所示：

```
-e /usr/libexec/nslogin /bin/bash
```

![](https://sgpublic.xyz/content/images/2026/09/image.png)

再次启动 WSL 使用 systemctl 命令恢复正常。