概述

在wsl2中,使用 systemctl 的时候会提示:Failed to get D-Bus connection,如何解决呢?

解决办法

在wsl2中执行以下命令即可:

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
最后修改:2023 年 12 月 30 日
如果觉得我的文章对你有用,请随意赞赏