wsl 解决 Failed to get D-Bus connection: Operation not permitted

问题描述

wsl Centos 子系统中运行systemctl status sshd时出现报错

 Failed to get D-Bus connection: Operation not permitted

解决

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的代码到 /usr/bin/systemctl 文件中即可, 例如:

mv /usr/bin/systemctl /usr/bin/systemctl.old
mv systemctl.py /usr/bin/systemctl
chmod +x /usr/bin/systemctl

参考

https://github.com/DDoSolitary/LxRunOffline/issues/88

猜你喜欢

转载自blog.csdn.net/qq_26545503/article/details/128886421