在WSL的CentOS系统中使用systemctl会报错“Failed to get D-Bus connection”。

解决方案:

1
2
3
$ mv /usr/bin/systemctl /usr/bin/systemctl.old
$ curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py > /usr/bin/systemctl
$ chmod +x /usr/bin/systemctl

你也可以在这里获取systemctl.py