5

I have my raspberry Pi set up as a headless server running samba and deluge, where the OS's file system is mounted as read-only. It is connected by ethernet cable to the router, and has a USB hard drive (with independent power) attached. Previously it had been working fine and had an uptime of weeks, but recently the network connectivity on it has been crashing just about every day.

When the network connectivity crashes the Pi stays on and all LEDs are on, I can ping the pi, but I can no longer SSH or access other services on the device. Restarting the pi fixes the problem, so it's clearly not a router/port forwarding issue.

What could be causing this, and what steps can I take to fix it? I'd normally think it's a burned out SD card, but since it's mounted as read-only that seems unlikely.

  • 1
    Have you tried configuring for and connecting a display to look for errors on the console? I know you normally run headless but debugging this may be easier with local access and/or visibility of the console – deaks Jun 19 '15 at 8:28
  • 1
    @NiveusLuxLucis Did you resolve this issue? I'm facing the exact same issue with my Pi 3B running Raspbian (jessie) on Linux Pi 4.4.13-v7+. Also, there's no HDMI output and the keyboard isn't powered. – Hummeling Engineering BV Aug 30 '16 at 7:40
  • 1
    Have you found a solution in the meantime? If not, direct syslogd's output to a remote computer in order to find the reason of the crash. – ott-- Aug 31 '16 at 20:49
1

For starters, try installing watchdog (sudo apt-get install watchdog). In /etc/watchdog.conf uncomment the ping and set it up to ping your gateway. That should at least help you not have to go and unplug the machine manually although it does not help with the root cause.

Note on watchdog - I would start watchdog manually using a cron script that sleeps for 30-45 seconds before launching watchdog. This will prevent you from getting into an endless reboot loop.

Here's my watchdog.conf:


interface       = wlan0
ping            = 192.168.0.1
#ping           = 172.26.1.255
#file           = /var/log/messages
#change         = 1407
watchdog-timeout = 15

# Uncomment to enable test. Setting one of these values to '0' disables it.
# These values will hopefully never reboot your machine during normal use
# (if your machine is really hung, the loadavg will go much higher than 25)
max-load-1      = 24
#max-load-5     = 18
#max-load-15        = 12

# Note that this is the number of pages!
# To get the real size, check how large the pagesize is on your machine.
#min-memory     = 1

repair-binary       = /home/weather/weather/util/network_repair.sh
repair-timeout      = 60
#test-binary        = 
#test-timeout       = 

watchdog-device = /dev/watchdog

# Defaults compiled into the binary
#temperature-device =
#max-temperature    = 120

# Defaults compiled into the binary
#admin          = root
admin           = 
interval        = 10
logtick                = 500
log-dir     = /var/log/watchdog

# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime        = yes
priority        = 1

# Check if syslogd is still running by enabling the following line
#pidfile        = /var/run/syslogd.pid   

Here's the script that starts it:


#Launching watchdog
sleep 30
date
echo "Launching watchdog"
sudo modprobe bcm2708_wdog
sudo watchdog -v

The script is called by cron. Use crontab -e to set it up. Add your version of the line below to your crontab file.


@reboot /home/username/yourscript.sh >> /log_file_path/log_file_name.log 2>&1
  • I've set this up on my pi, and tested it by unplugging the network cable which causes it to reboot after 30 seconds. I'll keep track of the uptime over the next week or so and see what happens, but hopefully this 'fixes' the issue. The only worry I have is that if I can still ping the pi after the network connectivity crashes then the watchdog may not actually trigger a reboot. – NiveusLuxLucis Jun 25 '15 at 16:04
  • You can add a check script that can test ssh by trying to ssh to itself via IP address. Check out this post on how to script it. You add it to watchdog by setting up the test-binary configuration. Good luck! – ifermon Jun 25 '15 at 17:17

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.