首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如果systemctl重新引导失败,如何用systemctl重新启动服务器?

如果systemctl重新引导失败,如何用systemctl重新启动服务器?
EN

Unix & Linux用户
提问于 2019-08-06 19:29:30
回答 3查看 30.3K关注 0票数 8

我尝试重新启动我的CentOS 7服务器,但是它提供了荒谬的错误消息。

作为根(当然):

代码语言:javascript
运行
复制
# systemctl reboot
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to start reboot.target: Connection timed out
See system logs and 'systemctl status reboot.target' for details.
Exit 1

polkit是否需要检查root是否有权重新启动机器?如果是,为什么?

代码语言:javascript
运行
复制
# systemctl status reboot.target
● reboot.target - Reboot
   Loaded: loaded (/usr/lib/systemd/system/reboot.target; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:systemd.special(7)
Exit 3

我需要启用reboot目标吗?为什么默认情况下会禁用此功能?

也许这个能行?

代码语言:javascript
运行
复制
# systemctl start reboot.target
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to start reboot.target: Connection timed out
See system logs and 'systemctl status reboot.target' for details.
Exit 1

好的,强迫它,然后:

代码语言:javascript
运行
复制
# systemctl --force reboot
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to execute operation: Connection timed out
Exit 1

服务器还在运行。

EN

回答 3

Unix & Linux用户

回答已采纳

发布于 2019-08-06 20:09:38

尽管看起来很奇怪,试着跑

代码语言:javascript
运行
复制
sudo systemctl --force reboot

在我做过的几次搜索中都出现了。这可能与DBus服务重新启动的问题有关。

不能重新启动。慢慢来,超时。 启动reboot.target失败:连接超时

票数 8
EN

Unix & Linux用户

发布于 2020-04-07 11:24:59

如果Zach Sanchez的答案不起作用(我在Failed to start reboot.target: Connection timed out 7下得到了systemctl --force reboot的一个奇怪的情况),使内核基本上崩溃重新引导可以在SSH上作为root完成,如下所示:

代码语言:javascript
运行
复制
# echo s > /proc/sysrq-trigger
# echo u > /proc/sysrq-trigger
# echo b > /proc/sysrq-trigger

在最后一个命令之后,当内核立即重新启动机器时,没有异常的响应。更多细节这里

正如@LunarShaddow等人指出的那样,不需要在"b“之前再加上一个"s”。

票数 12
EN

Unix & Linux用户

发布于 2020-05-07 16:30:39

由于我不能在保罗的回答中发表评论,所以我在这里写我的评论。

来自核心文件

当你无法关闭时,重新启动(B)是件好事。但你也应该先同步(S)和乌蒙特(U)。当你无法关闭时,重新启动(B)是件好事。但你也应该先同步(S)和乌蒙特(U)。同步(S)是伟大的,当你的系统被锁定,它允许你同步你的磁盘,肯定会减少数据丢失和屏蔽的机会。请注意,在屏幕上显示“确定”和“已完成”之前,同步还没有发生。(如果内核真的处于冲突中,您可能永远得不到OK或is消息.)和同步(S)一样,umount(u)基本上是有用的。我通常同步(S),umount(u),然后重新启动(B),当我的系统锁定。它给我省了很多钱。同样,在屏幕上显示“确定”和“完成”消息之前,卸载(仅重装入只读)还没有发生。

所以FMHO,保罗的答案可以简化为's‘'u’b',你可能想在每次输入之后等一段时间。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/534220

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档