sudoedit.com!

Linux Server won't restart

Not too long ago I ran into a problem where a server with systemdwould not shutdownor rebootthrough normal means.

When executing sudo shutdown -r nowI would get a weird message back as output:

    Failed to start reboot.target: Connection timed out
    See system logs and 'systemctl status reboot.target' for details.
    Failed to open /dev/initctl: No such device or address
    Failed to talk to init daemon.

I'm still not entirely certain what caused the problem and the suggestion of running systemctl status reboot.targetto troubleshoot simply resulted in the same message being displayed.

However, if you run into this problem and you just need to get your services back up and running you can force a reboot like this:

Try this first:

systemctl --force reboot

If that doesn't work, which it didn't for me, add another --forcebut know that this will unceremoniously kill all running process.

systemctl --force --force reboot

This of course assumes that you can still gain access to the terminal via ssh. This operation is essentially the same as holding down the power button on a physical machine or hitting the reset button on a VM.

According to the man page this can dangerous if you have a process running that is trying to save data so be certain that you want to forcibly kill off every process on your server before running this command. Try it with only a single --forcefirst.

#Linux