Raspberry Pi Randomly Disconnecting

I have an old Raspberry Pi that I recently setup as a seedbox. The Raspberry Pi had a weird problem in that it would disconnect me from SSH seemingly at random. I would begin to run a command, watch the command progress and then get disconnected. It took me a couple hours of checking everything, but eventually I figured out what was causing the disconnections.

A seed box is an 'always on' device which allows you to share files, often through a bit torrent program. Things like Linux ISO images and other files can be shared though a seedbox, allowing others to easily download things.

A Raspberry Pi is great for a seed box because it is small and uses almost no power. A year's worth of power usage will cost you around three dollars. And the Pi itself is much cheaper than any other computer.

So I installed raspbian, connected the Pi to my home router, and SSHed in. So far so good, but as soon as I ran 'sudo apt-get update', which is the first thing I do on a new installation (after changing the default password) I ran into trouble. Part way through the command, the Pi would disconnect. I would get 'broken pipe' errors.

Initially I thought the OS install may have been corrupted somehow and that the Pi was restarting itself. I looked at /etc/syslog and did not see anything too obvious. It did not look like the Pi was rebooting.

Next I checked the ethernet cable that was connecting the Raspberry Pi to the router. I had a spare ethernet cable, so I tried the spare, and it did not change anything. The Pi would be working fine, and then seemingly randomly the link light on the ethernet cable would turn off and the Pi would disconnect from my SSH session and from the router.

I thought maybe the router needed a reboot or there was an issue with the ethernet port, but I tested this by connecting my laptop directly to the ethernet port rather than using wifi. That worked well, so it wasn't a problem with the router. I was running out of ideas.

One thing that I tried was to just run the ping command from my laptop to the PI while I was SSHed in, just to see exactly when the disconnection would happen. What I saw was that ping would work for a while, but whenever I ran a command the ping would begin to timeout. Usually it would time out for a while, and then I would start getting replies again. It seemed like the Pi was being overpowered by the commands I was running and could not both run the command and connect to the network at the same time.

It took me a bit, but eventually I realized that it might be a power source issues, and that's exactly what this was. Raspberry Pis do not come with a power source, you have to get a charger separate. The charger I was using produces 0.5 amps of power. The older Raspberry Pi model needed around 0.7 amps. This was the issue. The Pi was getting enough power to boot and to stay on, but not enough for the processor and ethernet and everything else to actually function as intended.

When I switched out the power charger for one that provides 1.0 amps, the Pi began working without interruptions. If your Raspberry Pi seems to be having issues continually running commands and randomly disconnecting from your network, follow my footsteps above and see if it was any of the previous solutions I tried. If not, then it might be a power issue.

The recommended PSU current capacity for a Raspberry Pi depends on the model.

You can run less amps, especially on the newer models if you do not use all the USB drives.