Unable to reboot remote machine over ssh

I am working with an embedded system and would like to initiate a reboot from a remote machine.

I have tried various methods, including

ssh -o StrictHostKeyChecking=no root@${HOST} /bin/systemctl reboot -i

but nothing has really worked, the above gives me the following feedback:

Failed to set wall message, ignoring: Interactive authentication required.
Failed to reboot system via logind: Interactive authentication required.
Failed to start reboot.target: Interactive authentication required.
ee system logs and 'systemctl status reboot.target' for details.

and systemctl status reboot.target gives me:

‚óŹ reboot.target - Reboot
     Loaded: loaded (/lib/systemd/system/reboot.target; enabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

I found that many people have been able to resolve similarreboot issues by prepending sudo to the reboot command but since I’m logging in as root already, that should not be needed. I am aware about the security implications that logging in with root has but please inore that for now. I would like to focus at the task at hand: How can I trigger a reboot by logging in with root over ssh?

What I’ve already tried includes:

  • ssh -o StrictHostKeyChecking=no root@${HOST} reboot
  • ssh -o StrictHostKeyChecking=no root@${HOST} /sbin/reboot
  • ssh -o StrictHostKeyChecking=no root@${HOST} /bin/systemctl reboot -i

The remote box runs a custom embedded Linux distribution built with Yocto

Asked By: mistyron


Thankls to @Panki’s comment above, I figured out that switching to runlevel 6 solved the problem! However, instead of init 6 (as suggested), I did: ssh -o StrictHostKeyChecking=no root@${HOST} /sbin/telinit 6 which did the trick!

Answered By: mistyron
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.