Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Installing MariaDB on CentOS7 WSL: Failed to get D-Bus connection: Operation not permitted #17

Closed
afpgit opened this issue Oct 23, 2022 · 4 comments

Comments

@afpgit
Copy link

afpgit commented Oct 23, 2022

First of all, awesome work on creating this for WSL. Really really useful, thank you.

I am following instructions given in here to install MariaDB on CentOS7 for WSL in Windows 11.

PS C:\Users\joe> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu-22.04           Stopped         2
  docker-desktop         Running         2
  docker-desktop-data    Stopped         2
  CentOS7                Stopped         2

sudo yum install mariadb-server works with no problems as expected. However, sudo systemctl start mariadb will run into the following issue:

[root@mycomputer etc]# systemctl start mariadb
Failed to get D-Bus connection: Operation not permitted

So I enabled systemd by adding the following to /etc/wsl.conf

[boot]
systemd=true

I shutdown wsl and restarted it. systemctl list-units --type=service will produce the proper results indicating systemd is working. However, I am still getting Failed to get D-Bus connection.

Is there any way to get MariaDB server to work in CentOS 7 for WSL?

@FlowerBirds
Copy link

PS C:\Users\merit> wsl --version
WSL 版本: 1.1.3.0
内核版本: 5.15.90.1
WSLg 版本: 1.0.49
MSRDC 版本: 1.2.3770
Direct3D 版本: 1.608.2-61064218
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows版本: 10.0.22000.1574

then systemd is true:

top - 17:55:52 up 9 min,  1 user,  load average: 0.05, 0.08, 0.03
Tasks:  28 total,   1 running,  27 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8137912 total,  6713224 free,   340476 used,  1084212 buff/cache
KiB Swap:  8388608 total,  8388608 free,        0 used.  7543432 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0   43628   5372   3976 S   0.0  0.1   0:00.14 systemd
    2 root      20   0    2296   1240   1136 S   0.0  0.0   0:00.00 init-systemd(Ce
    5 root      20   0    2328     72     68 S   0.0  0.0   0:00.00 init
   59 root      20   0   39076   5064   4752 S   0.0  0.1   0:00.06 systemd-journal
   68 root      20   0   43748   3336   2796 S   0.0  0.0   0:00.09 systemd-udevd
  126 root      20   0   21688   2784   2428 S   0.0  0.0   0:00.02 irqbalance
  128 polkitd   20   0  612256  16464   9028 S   0.0  0.2   0:00.01 polkitd
  130 dbus      20   0   58132   4164   3636 S   0.0  0.1   0:00.02 dbus-daemon
  135 chrony    20   0  100512   2584   2264 S   0.0  0.0   0:00.01 chronyd
  143 root      20   0  260760   3200   2736 S   0.0  0.0   0:00.00 gssproxy
  146 root      20   0   26400   2812   2536 S   0.0  0.0   0:00.00 systemd-logind
  170 root      20   0  126404   3056   2452 S   0.0  0.0   0:00.00 crond
  171 root      20   0  110224   1784   1656 S   0.0  0.0   0:00.00 agetty
  173 root      20   0  110224   2016   1884 S   0.0  0.0   0:00.00 agetty
  183 rpc       20   0   69272   3264   2724 S   0.0  0.0   0:00.01 rpcbind
  336 root      20   0    2300    104      0 S   0.0  0.0   0:00.00 SessionLeader
  338 root      20   0    2316    108      0 S   0.0  0.0   0:00.01 Relay(340)
  340 root      20   0  115564   3540   3100 S   0.0  0.0   0:00.21 bash
  341 root      20   0   96584   4088   3476 S   0.0  0.1   0:00.00 login
  355 root      20   0  115560   3240   2972 S   0.0  0.0   0:00.00 bash
  477 root      20   0  574304  23976  10692 S   0.0  0.3   0:00.10 tuned
  478 root      20   0  113016   7704   6668 S   0.0  0.1   0:00.00 sshd
  482 root      20   0  218544   8380   4752 S   0.0  0.1   0:00.03 rsyslogd

@fzxfzx12345
Copy link

在wsl中执行systemctl相关命令报错 Failed to get D-Bus connection: Operation not permitted

备份systemctl

mv /usr/bin/systemctl /usr/bin/systemctl.bak

写入systemctl脚本

curl https://gitee.com/umico/docker-systemctl-replacement/raw/master/files/docker/systemctl.py > /usr/bin/systemctl

授予执行权限

chmod +x /usr/bin/systemctl

@FlowerBirds
Copy link

@fzxfzx12345 升级wsl软件本身即可支持识别/etc/wsl.conf文件

@mishamosher
Copy link
Owner

For additional info on using systemd under WSL, please see #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants