WSL系统systemctl不能使用解决方法

用window10下WSL使用Ubuntu20.04,当我使用命令sudo systemctl status mariadb的时候报错:

glc@LAPTOP-LEMON:~$ sudo systemctl status mariadb
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

问题原因:
如果是一般的Linux操作系统,可能是因为Linux中没有使用systemd,想用systemd命令来管理Linux上的服务,因此会报错,很可能是使用的是经典的SysV init(sysvinit)系统。
但我这个是window10下WSL的Ubuntu,就会使SysV init而不是systemd。

解决方法:
更换命令,用SysV init的命令代替systemd的
WSL系统systemctl不能使用解决方法_第1张图片

你可能感兴趣的:(wsl2)