0

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

4
  • Interactive authentication required – I haven't tested, but what if you use ssh -t … to give the remote systemctl a tty so it's able to interactively ask you the root's password and fulfill the requirement? Commented Jul 8, 2023 at 8:28
  • does sudo reboot work? Commented Jul 8, 2023 at 11:51
  • 1
    Give init 6 a shot aswell Commented Jul 8, 2023 at 13:46
  • @Panki, excellent, switching to runlevel 6 solved my problem! Thanks! You can add it as an answer to this question and i'll gladly accept, instead of init 6, I did: ssh -o StrictHostKeyChecking=no root@${HOST} /sbin/telinit 6 Commented Jul 8, 2023 at 18:34

1 Answer 1

0

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!

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.