执行:systemctl restart rsyslog
报错:Failed to get D-Bus connection: Operation not permitted
参考下列文章解决centos7中rsyslog无法启动的问题:
https://www.jianshu.com/p/e670ae82e97a
具体内容如下:
WSL的CentOS7使用systemctl和service命令时报错Failed to get D-Bus connection: Operation not permitted,
解决办法是更换systemctl文件
首先备份systemctl文件
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
或者直接打开这个网站https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py,将页面的所有内容复制,再使用vim打开systemctl文件并粘贴进去保存
vim /usr/bin/systemctl
可能会出现卡顿
最后执行
chmod +x /usr/bin/systemctl