I have a headless Pi running Raspbian with no other peripherals than an ethernet cable attached. It hosts a simple webpage using Apache with some simple PHP that interfaces with MariaDB. I connect over SSH and don't have a monitor at hand. I have port forwarding set up so that I can visit the page or SSH remotely too.

Now, here is the problem: Sometimes the RPi becomes unavailable. When this happens, SSH throws a "connection reset" error and Apache returns the 403: Forbidden page. The only option to make it accessible again is by power cycling the device. This unavailability usually occurs after a few days or a week of normal operation, making it hard to debug. When I unplug the ethernet cable, I get a timeout instead of the connection reset / 403 page, which means the Pi is still doing something, and the problem is not with the network probably. I don't see any records in Apache's access.log or error.log of those connection attempts unfortunately.

I don't know how to explain to my behaviour or how to debug it, nor could I find someone with a similar problem. One possible explanation that comes to my mind is a memory leak, but I'm not sure how to verify that.

Does anyone know what might cause this behaviour and how I could fix or debug it? I have tried reading the logs but know to little to start what is relevant or not. If there's any logs you think would be useful to post, please leave a comment so I can add them.

Update: Apache's error.log and access.log. Site stopped working somewhere between 09-10 February l. I tried to connect and got the 403 at 16:27, power cycle / reset occured at 16:29 09/02/19 UTC. After that it started working again and at 16:35 I could see the page.

Update 2: From what I see in /var/log/syslog, it seems like the Pi rebooted itself around 20:46 09/02/19. Could it be possible the supply glitched and the Pi somehow booted wrongly?

  • How can Apache return an error when the connection is broken? – Ingo Feb 10 at 17:55
  • I don't think the connection itself is broken; the Pi just seems to hang or something. I updated the question to make that more clear. – RvdV Feb 10 at 18:18
  • What does the Apache log say when you try to connect but get the 403 error??? – rohtua Feb 10 at 18:53
  • Can't seem to find them :( I updated the question – RvdV Feb 10 at 19:07
  • Hm.. SSH claims "connection reset". This could occur when the connection is only interrupted for a short time like a glitch. The TCP connection with authentication then is broken and SSH wants a new authentication. Do you use https to get pages from apache? Maybe it is the same issue? Connection OK but broken authentication? – Ingo Feb 10 at 20:04

This could be a power supply problem.

Check by swapping with a high quality charger providing enough power.

  • Thanks for your suggestion, that seems plausible. Would you happen to know if there is any logs or info I could check to verify the power was bad? I know some MCU's show a 'reset source'. – RvdV Feb 11 at 6:45
  • No idea, but this is the typical problem with the pi. – Thorbjørn Ravn Andersen Feb 11 at 8:49
  • Good. Than I will just try that, hope for it not to crash again and accept the answer until the contrary is proven :) Thanks! – RvdV Feb 12 at 18:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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