开发学院

您的位置:首页>教程>正文

教程正文

linux(centos8)更新后执行systemctl提示Access denied的解决方案

 最近购买服务器帮客户部署项目,发现一个奇葩的问题,执行完yum update之后,执行systemctl管理服务提示Access denied,同时shutdown/reboot之类的重启命令也失效,根据以往的经验先百度一下,结果百度到的内容全部是所谓的SELinux造成的,尝试使用文章中介绍的方式依旧无法解决.

 最后在国外某网站搜到了解决方案,

 原文链接:https://superuser.com/questions/1125250/systemctl-access-denied-when-root/1130976

 原文内容及回复如下:

In my case, I had just upgraded systemd and any systemctl command was failing:

# systemctl daemon-reexec

Failed to reload daemon: Access denied

# systemctl status

Failed to read server status: Access denied

However according to the init manpage, you can do the same thing by sending SIGTERM to the daemon running as PID 1, which worked:

kill -TERM 1

This reloaded the daemon, after which all the systemctl commands started working again.

--Thanks. Solved my problem I had after upgrading an archlinux distro after a long time. – buergi May 31 '19 at 20:19

--worked on Ubuntu 18.10 - Thanks! – Roy Shilkrot Jan 3 '20 at 18:01

--Same issue while force dist-upgrading ubuntu cosmic. Worked, thx. – gwik Mar 13 '20 at 21:45

--It worked on Ubuntu 20.04 (upgraded from 18.10) and saved me a ton of headaches. Bundle of thanks – Muhammad Mehran Khan Attari Jun 27 '20 at 14:10 

  抱着司马当活马医生的想法,尝试了一下kill -TERM 1 ,再次执行systemctl相关命令,成功执行.重启命令也可以执行了,问题解决!