pi power-cycle recovery

I'm planning a system where a number of r-pis run headless, and totally
unattended for extended periods (several months). I shall be controlling
them via the internet over a wireless link.
So far, so good. I am noticing that if I power cycle such a pi while
running, on occasions, it doesn't correctly reboot (at least the
wireless network isn't established correctly), and I have to perform a
hard reset by shorting the reset pins on the pi.
Obviously this is unacceptable for my system (the power is prone to
interruption). Does anyone here know how to circumvent the problem,
short of running it off a UPS?
Failing that, there was a guy on this group not so long ago previewing a
ups he was developing for the market; did that ever happen?
cheers, Tony
Reply to
Tony van der Hoff
Loading thread data ...
Really? It also doesn't correctly reboot when you use the "reboot" command?
It is possible to use the built-in watchdog. There is a timer that you have to trigger every 10 seconds or so and when you don't, the Pi gets a hard reset. There are one or two programs that you can install and configure to send the trigger and stop sending it on configurable conditions, and of course when the whole system crashes it will trigger as well.
When it turns out you do not really require a hard reset but "reboot" works as well, you could also write some simple check as part of your application that e.g. does a ping to the home system every minute and when it fails does a "reboot".
(I once experimented with one of the watchdog handling programs and several times I had it configured incorrectly, had the condition trigger all the time and the system in a reboot loop. The manual is very unclear. So be careful and try it at home, not with the Pi located remotely)
Reply to
Rob
You can buy such "ups" technology off the shelf. Just google for "usb power backup", and you'll get a ton of entries for battery backups to power usb-powered stuff.
Including a lovely pink 20Ah unit from Amazon for $13.85. Hard to beat that price-performance level. This should power a pi for close to 24 hours.
-- mrr
Reply to
Morten Reistad
totally
while
perform a
How do you issue the "reboot" command when the only means of communication is the wireless that isn't working?
to
problem,
I think I've seen a AA battery "UPS" module for the Pi on sale. That should avoid problems associated with the power just being yanked, the batteries will keep the Pi up long enough to be told to do a clean shutdown, which hopefully will mean that when it comes back up the wireless will reliably come back as well. I don't know if this UPS module fully powers down after an interval long enough for the Pi to shutdown or if it will sit using battery until they go flat, not wanted in this application...
Is that *totaly* independent of the Pi processor(*)s, oscillators etc? Ie it runs from the moment of power being available and has to be reset by the Pi system to prevent the hard reset? Not sure a hard reset (equivalent of a power yank) is a good idea, see above ...
That assumes that the Pi is running and only the wireless part isn't...
--
Cheers 
Dave.
Reply to
Dave Liquorice
You must make a test and during that test connect a USB keyboard or a wired network cable. Alternatively you install a cron job that runs every 5 minutes and does something like ping -c 3 myhomerouter || reboot
It has to be enabled, I am not sure if it can be configured so that it is always enabled from power-on. The program I tried has the option of issuing a reboot to see if that works, and when it doesnt' a hard reset is done. The basic operation was fine but the configuration of trigger conditions is extremely tricky.
The name of the package is "watchdog". You can install it and read the manual page, it won't change anything by itself just by installing the package.
I once had a problem with my Raspbmc pi where it would not come up after an update, but in that case no way of resetting recovered it, it needed fixes to the SD card first.
Reply to
Rob
~ sudo shutdown -r now
But if it reboots, and not correctly ifconfigging, it looks like a software issue.
Are you using the WPAsupplicant on the client ? Can the Pi get its IP from the (remote) DHCP-server (just) in time ? Do you run with the latest kernel ?
Reply to
hda
My suspicion is that it might fail to re-establish the wireless connection if the power was either interrupted for such a short time that the wireless interface didn't reset, or maybe power was interrupted a second time briefly during the restart.
Do you get reboot failures if you switch off, wait at least ten seconds, then power on?
--
Alan Adams, from Northamptonshire 
alan@adamshome.org.uk 
 Click to see the full signature
Reply to
Alan Adams
Yes could be. For me at least with an Edimax-150, I cannot replicate such failure with a 1s interrupt or 10s.
Anyway, I prefer a LAN wired Pi over a wireless connect on a remote site. I found wpa-supplicant not always cooperative, with a cmd-line setup, and suspect inconsistency in behaviour.
Another successfull Pi remote setup is with an Huawei-E173 (umts/hspa) plugged in AND such Pi as a DHCP-server for the remote site. You need some 10W power though.
Reply to
hda
time
1s is a very long time as far as reset circuitry is concerned. A power glitch long enough to upset electronics but not trigger a reset is measured in mS ...
--
Cheers 
Dave.
Reply to
Dave Liquorice
a fat kerpuffitor will deal with milliseconds.
--
Ineptocracy 

(in-ep-toc?-ra-cy) ? a system of government where the least capable to  
 Click to see the full signature
Reply to
The Natural Philosopher
:)
Thanks, everyone for much useful (and, sadly, some useless) advice.
I'm quite taken with the idea of a watchdog, and may implement that in any case. Has anyone got any URLs for the software?
The UPS idea is also quite tempting, but the one offered by Amazon is ridiculously expensive, at 50 quid! I quite like the ones offered by RS at
formatting link
|alt at a more reasonable price.
However, I think the best suggestion for my case is to abandon the wireless interface. Running the cat5 from the router to the pi is going to be tricky, but the prospect of removing multiple possible points of faiure wins the day. So, hda wins the (virtual) cigar! Thanks!
cheers, Tony
Reply to
Tony van der Hoff
Ouch.
|alt
RS site offline for "improvements" so can't see that or it's price.
VAT.
formatting link
pberry/dp/SC13288
g
Hadn't picked up on cable being any sort of option otherwise I'd have suggested it. Anything wireless is likely to be unreliable for many reasons.
--
Cheers 
Dave.
Reply to
Dave Liquorice
Well, it wasn't originally an option, since it involves digging a 20m trench, laying a duct, and shoving the cat5 through it. I guess it needs to be at least 30cm deep. I hate digging :(
Reply to
Tony van der Hoff
In message , Tony van der Hoff writes
Is it worth investigating getting it "moled" in ?
Adrian
--
To Reply : 
replace "bulleid" with "adrian" - all mail to bulleid is rejected 
 Click to see the full signature
Reply to
Adrian
The software I referred to is in the repository. Just use: apt-get install watchdog
There is also a program "raspdog" but I do not know the package name.
Reply to
Rob
guys it takes less time yo get a spade and dig than it does to hire a mechanical tool.
--
Ineptocracy 

(in-ep-toc?-ra-cy) ? a system of government where the least capable to  
 Click to see the full signature
Reply to
The Natural Philosopher
Hehe. :-)
Reply to
Rob Morley
Might not need the duct as direct burial Cat5 is available. This stuff is armoured as well but has a hefty price tag:
formatting link
24awg-100m-drum
Or cut to length, unarmoured, PE sleeve:
formatting link
cable
IIRC Dropwire No.10 as used by BT for aerial runs is a PE sleeve and it's very tough... If your trench isn't likely to be disturbed or have vehicles driving over it I'd expect this PE stuff to be fine.
Trench spade depth plus a a couple of inches unless under an area where vehicles pass. Maybe bed the cable in sand and possibly warning tape a couple of inches above the cable.
--
Cheers 
Dave.
Reply to
Dave Liquorice
Couldn't you have all the Pis both wireless and connected to a switch in the remote location, so if one went iffy on the wireless connection, you could connect wirelessly to another one and via that one and the wired connections to the iffy one?
eg. pi A is 192.168.0.3 wired and 192.168.0.4 wireless pi B is 192.168.0.5 wired and 192.168.0.6 wireless
pi B fails to connect wirelessly
Connect to pi A wirelessly on 192.168.0.4 then rsh to pi B via the wired interface 192.168.0.5
--
Mike Fleming
Reply to
Mike Fleming
Looks like a nice device. Might order one, how is rs-online with shipping to the rest of europe?
Indeed. But a hundred meters of cat5 cabling is easily $70, and more if you need connectors and pass-through for walls etc.
-- mrr
Reply to
Morten Reistad

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.