From my mac I SSH into my raspberry pi to run a python script to take videos of 30min. I have eight raspberry pi's that are formatted in exactly the same way. All works fine only that every 1 in 2 videos taken 2 of the 8 raspberry pi's give the following error message:

Write failed: Broken pipe

after which I have to close the terminal window and start a new instance. The video is still written but is less than the 30min instructed in the python script.

I already read about ServerAliveInterval and ClientAliveInterval and set those values on the RPIs and the mac but with no change. Also, if I open a new terminal window and start a new ssh session everything works fine.

Can somebody help explain what is going on and how I can solve it? I don't understand it is consistently happening with only 2 specific RPI's out of the 8 that are all formatted in exactly the same way.

Fr your information: all RPI's are powered by 7-port USB hubs and only have power and ethernet in (i.e. no other connected devices); I use csshx to be able to run commands to all 8 RPI's simultaneously by having an extra terminal window that 'speaks' to all other terminal windows, therefore it also throws the following error with the one described above:

CHILD at /Users/Stickleback/csshX line 1256

The problem was a power issue. Since I work with multiple RPi's and some where plugged into a usb hub shared with some usb lights probably the current dropped (for very short durations ) where the current to the network could not be maintained anymore. By connecting the 8 RPi's to four dual USb wall plugs with 2.4A I have had not had any issues anymore.


Try starting the script this way:

setsid whatever.py &> /dev/null < /dev/zero &

This presumes it doesn't require interaction, and that you don't care about watching the output. If you do, replace /dev/null w/ /tmp/whatever.log; you can then check that.

This orphans the process so it is re-parented by init (PID 1), such that if your current ssh session terminates for whatever reason, it will keep running and you can just log back in and the process will still be doing whatever it is supposed to do.

  • 1
    Thanks for your answer. Can you explain it in a bit more detail? I would normally just ssh pi@pi-address and then run a python script located on the RPI to start video recording. – crazjo Jan 19 '15 at 9:13

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.