2

I have a Raspberry Pi B+ connected to the network and reachable over the internet, with Raspbian Wheezy as OS on the SD card.

It is often the case that I am long away from home and would like to make my 'remote' RPi as reliable as possible. Besides any other welcome suggestion, my question is:

Is there a way to open a shell or control remotely in any other way the Raspberry Pi when it is connected, powered up, but in some faulty state? In particular, I think the most representative scenario is when the RPi is stuck at boot for some reason.

I would like to be able to gain remote control (even in a very limited way) to:

  • modify the OS to make it work again or
  • download and restore a remotely stored backup or
  • download and restore a locally stored backup (triggering a recovery).
  • 2
    You could use another Pi to control it ;-) Probably what you want is a watchdog. This is usually implemented in hardware (usually a simple timer to reset the device) but there is a software module (called watchdog) for Raspbian. – Milliways Sep 12 '14 at 0:35
0

My old first gen, 256MB version B, RasPi is never powered off. I put it to dynamic clocking with min.freq of 100Mhz and a max. freq. of 850Mhz, it doesn't need much power and doesn't generate too much heat when idle.

To answer your question, when the raspi is always on you can control it, like rebooting it etc, with a Secure Shell SSH.

1) Simply install openssh-server on raspian and set it up (search the web, I recommend using a 2048bit private key auth and pw auth turned off).

2) Add a route to your router for port 22 from your router to you raspi IP.

2a) if you've a dynamic IP you might need to setup a dyndns service for you router that your router registers it's new Ip to the dns service maybe dns-o-matic can help with that, too.

finally you can connect to your router's IP or yourdomain.dyndns with a PC

windows with putty

linux with ssh (cmdline), or remmina (gui)

android with juiceSSH, or other app

the only scenario imho how a boot can possibly fail are unstable overclocking settings and (failed) updates such as a new kernel I don't think you can SSH on a failed boot, since the LAN kernel module is not beeing loaded and/or the sshd daemon is not running. however when it boots, it boots. there are linux servers in the internet that didn't boot for 10 or more years... so why reboot?

(windows reboot / linux be root)

  • Your settings for dynamic clocking are an interesting suggestion for minimising some failure causes, although forced reboots (like for kernel updates) are my main concern. I was thinking about a modified boot code with a watchdog: if regular boot fails at some point a recovery mechanism is triggered. Just wondering if anybody else has already done that... – Alessandro Sep 19 '14 at 23:31
  • - what could be the reason for a failed boot? – Michael D. Sep 20 '14 at 11:18
  • For example, a fstab error: After kernel update my RAID card driver should have been updated and recompiled. Not doing so made the fstab entry of the RAID disk unmountable, hence preventing from booting. ...I know, the answer to that is "check the driver before rebooting", or "check fstab", or "set it to boot also on mount failure" but they all seem like a "per case" workaround, not a substantial solution. If I'm far from home and a new case comes up I'm lost. Far from implying that those cases are not due to my negligence, I was just wondering of an error-tolerant solution. – Alessandro Oct 6 '14 at 13:13
  • I'd suggest to aim for stability and not for the bleeding edge stuff. Mount the sdcard as readonly to make sure no updating is done at all .. "never change a running system". – Michael D. Oct 6 '14 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.