Sivo 悉见

问题解决:WSL的CentOS7报错Failed to get D-Bus connection: Operation not permitted解决办法

匿名 · 更新于 2022/11/23

一、问题场景

本地Windows10启动WSL的centos7,然后在安装docker-ce之后,启动报错,错误提示如下:

Redirecting to /bin/systemctl start docker.service
Failed to get D-Bus connection: Operation not permitted
  • 1
  • 2

本篇博客主要讲诉解决方案。

二、解决方案

主要是更换systemctl文件。

1、备份systemctl文件

mv /usr/bin/systemctl /usr/bin/systemctl.old
  • 1

2、获取新文件

curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py > /usr/bin/systemctl
  • 1

3、设置可执行

chmod +x /usr/bin/systemctl
  • 1

三、结果

顺利解决,截图如下:

[root@xxx xxx]# service docker start
Redirecting to /bin/systemctl start docker.service
/usr/sbin/service: line 87: /bin/systemctl: Success
  • 1
  • 2
  • 3