29
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL(CentOS7)でsystemctlを実行するとFailed to get D-Bus connection: Operation not permittedになる

Posted at

はじめに

WSLにCentOS7を入れてsystemctlを実行したところ、「Failed to get D-Bus connection: Operation not permitted」が発生して実行できず、調べてもDocker関係の記事しか出てこなかったため、悪戦苦闘してしまいました。
※WSLにCentOS7を入れる方法は https://github.com/yuk7/CentWSL/releases/tag/7.0.1907.1 を参考にしてもらえればと思います。

手順

今のsystemctlを『.old』などを付けてリネームし、Dockerで回避したときと同じように「 https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/ 」にあるsystemctl.pyを利用させてもらって回避しました。

$ sudo su -
$ 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
29
22
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?