12

I tried rebooting my CentOS 7 server but it gives ridiculous error messages.

As root (of course):

# 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

Does polkit need to check whether root has the right to reboot the machine??? If so, why?

# 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

Do I need to enable the reboot target? Why would this be disabled by default?

Perhaps this will work?

# 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

OK, force it, then:

# 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

And the server is still up.

3 Answers 3

16

If Zach Sanchez' answer doesn't work (I got Failed to start reboot.target: Connection timed out for my systemctl --force reboot in a strange situation under CentOS 7) making the kernel basically crash reboot can be done over SSH as root like this:

# echo s > /proc/sysrq-trigger
# echo u > /proc/sysrq-trigger
# echo b > /proc/sysrq-trigger

These three commands respectively sync all mounted filesystems, remount all mounted filesystems in read-only mode, and then immediately reboot the machine.

After the last command, no response is expected as the kernel immediately reboots the machine. More details here and on Wikipedia.

As @LunarShaddow and others pointed out, a second s before b is not needed.

4
  • Thanks for that, good idea! Zach's answer does do the job for me, though.
    – Ned64
    Commented Apr 7, 2020 at 16:18
  • As @LunarShaddow points out, the second s is not necessary. Of course, it cannot hurt either, especially since it costs only 3 key presses. They give this as a reference: [kernel.org/doc/html/v4.10/admin-guide/sysrq.html].
    – Ned64
    Commented May 9, 2020 at 12:01
  • reboot -f will also do the job.
    – schemacs
    Commented Sep 24, 2021 at 7:45
  • The docs for reboot -f say that "When specified twice, this results in an immediate shutdown without contacting the system manager. See the description of --force in systemctl(1) for more details.". So in dire situations, you might want to try reboot -f -f.
    – Paul
    Commented Sep 26, 2021 at 9:56
11

As weird as it may seem, trying running

systemctl --force --force reboot

It has popped up in a couple of searches I made. It may be related to issues with a DBus service restarting.

Can't reboot. Slow and timing out. Failed to start reboot.target: Connection timed out

3
  • Thanks, I will try this but meanwhile started a long task and need to wait for it to complete before testing your solution - will get back to you.
    – Ned64
    Commented Aug 7, 2019 at 9:49
  • 1
    I'm curious - can you explain how/why sudo systemctl --force reboot should work when running systemctl --force reboot as root does not? Fascinating! Commented May 7, 2020 at 17:25
  • Today one thing that worked is in fact systemctl --force --force reboot when systemctl --force reboot did not.
    – Ned64
    Commented Sep 28, 2021 at 19:43
1

Since I cannot make comments in Paul's answer, I write my comments here.

From the kernel document:

reboot(b) is good when you’re unable to shut down. But you should also sync(s) and umount(u) first. reboot(b) is good when you’re unable to shut down. But you should also sync(s) and umount(u) first.

sync(s) is great when your system is locked up, it allows you to sync your disks and will certainly lessen the chance of data loss and fscking. Note that the sync hasn’t taken place until you see the “OK” and “Done” appear on the screen. (If the kernel is really in strife, you may not ever get the OK or Done message...)

umount(u) is basically useful in the same ways as sync(s). I generally sync(s), umount(u), then reboot(b) when my system locks. It’s saved me many a fsck. Again, the unmount (remount read-only) hasn’t taken place until you see the “OK” and “Done” message appear on the screen.

So FMHO, Paul's answer can be simplified to 's' 'u' 'b', and you might want to wait for a while after each input.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .