Ways to remotely reboot a Linux system

5

1

I had a remote server running Debian Sarge that experienced some HDD failure and I meant to reboot it hoping that fsck could repair the errors automatically. I eventually drove out there and replaced the faulty disks...

But I was wondering: What other ways are there to force a Linux system to reboot that do not require hard drive access?

What I had tried:

  • shutdown -r now Did not work, as shutdown is a program that would have to be loaded from disk, the error shown in the terminal was bash: /sbin/shutdown: Input/output error
  • init 6 same as above
  • telinit q same as above
  • kill -2 1 This did not print an error, but did not work either. (However, it is possible that the Sarge init did not implement SIGINT, the sarge manpages did not mention it. So it could work in a more recent version of Debian)
  • This guide on PCFreak.net. However, this failed at sysctl, which was not in memory either.

dualed

Posted 2012-10-17T14:29:38.577

Reputation: 309

Alt + SysRq + B -- This is basically the last ditch effort to force a reboot of a hung system. – jmreicha – 2012-10-17T14:39:09.250

'Rebooting without accessing the HDD' - wow, weird one. Every time I think of a solution I end up hitting the HDD. The only real 'give' you've got is if there are any ramdisks to play with. – PhonicUK – 2012-10-17T14:40:24.960

@jmreicha - that won't work over SSH, that'd reboot your local machine! – PhonicUK – 2012-10-17T14:40:46.223

Yes you're right, heh, I should have mentioned you have to have local access to do this. – jmreicha – 2012-10-17T14:42:41.460

3@PhonicUK If you're working with a remote system, I hope you've got a KVM available, and from there you could remotely press those keys :) Which, that's how you remotely reboot a system that has a misconfigured network stack. Let's not go into details why I know this. >.> – Darth Android – 2012-10-17T14:43:05.113

1

Found this, it is basically the keyboard combo through command prompt. http://rackerhacker.com/2009/01/29/linux-emergency-reboot-or-shutdown-with-magic-commands/.

– jmreicha – 2012-10-17T14:47:42.360

@jmreicha This seems to be the same as the guide on PCFreak.net, for which I had to enable the kernel sysrq capabilities with sysctl ... which sadly is a program and not a builtin. Though I have to admit now, that I did not really check whether sysrq was already enabled – dualed – 2012-10-17T15:49:12.313

possible duplicate of Remotely turning on or rebooting a frozen computer

– Ƭᴇcʜιᴇ007 – 2013-12-18T17:20:32.227

@techie007 I totally forgot about this question, sorry; No I don't think that is a duplicate, though it is similar. The question was about what you can do after things messed up, not before. However I found that in current Debian versions init is always in memory and thus init 6 would work. Not sure if it's possible for init to be paged now – dualed – 2013-12-19T16:03:30.043

Answers

3

You mention it is a remote server...Which means it is a prime candidate for a ILO, DRAC etc.

Check the documentation to see if such a card is installed.

If it is you can connect to the OS on that card and remotely take over the keyboard, screen and powerswitch etc without even touching the main OS. Thus you can do a hard reboot, and keep (remotely) watching the screen as your server runs though BIOS, boot and fsck.

If it is not installed and it is a significant distant to drive to it I really recommend adding such a card or installing some other remote KVM connection.

Hennes

Posted 2012-10-17T14:29:38.577

Reputation: 60 739

1

I guess there is no solutions for rebooting without having a harddisc connected or the necessary software loaded on ramdisk. If it's a virtual machine, reboot it on the hypervisor. Otherwise I hope you have a PDU / IPMI or similar.

Jeroen

Posted 2012-10-17T14:29:38.577

Reputation: 186

1The question is about ways to remotely reboot a Linux system, not to resolve a (already resolved) situation. – dualed – 2012-10-17T15:58:09.697