Octopi shows up on router, but unable to connect (intermittent problem)

This is a similar problem to this thread, but I never properly resolved that one, and it's significantly worse this time.
For reasons that are not relevant here, this is a fresh installation.

What is the problem?

Intermittent connection problem.
The Pi shows up on the list of devices connected to the router, but I cannot connect to it through either the web interface or ssh. It does not respond to a ping.

Other times, everything works fine.

What did you already try to solve it?

Switched it off and on again...
Sometimes that works. Apparently nor today...

Have you tried running in safe mode?

No.

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog... no bundle, no support, unless the reason you couldn't retrieve the bundle is your network issues
I'll get back to you with that, if you think I need it...

Additional information about your setup

Hardware you are trying to connect to, hardware you are trying to connect from, router, access point, used operating systems, ... as much data as possible

Raspberry Pi4, running OctoKlipper. Have tried connecting from varies machines.

What did you switch off and on? Just cut the power?

It is needed every time. Please attach it to your next post.

Ever restarted the router?

What else do you suggest? I know it is bad practice, but it's headless, so what else can you do?
OK, I should probably install a reset button...

That's usually the first thing I try... not least because I can do it without moving.

If you have the chance to connect a HDMI TV/monitor to the Pi, you can see if it is starting correctly.

At the end the should be a valid IP address.

I think it is starting correctly, but then going petunia later. Usually I can connect to it after a power cycle, but I may not be able to connect to it later on... then later still, I may be able to connect.

Is it on WiFi or Ethernet? If on wifi, add a line to the /etc/rc.local file right before the line that says exit
iwconfig wlan0 power off
Then save the file and reboot
That turns off the power save function on the WiFi. Otherwise the WiFi randomly goes to sleep

"Randomly"? Surely it does it according to some rule?
I'll give that a try, but if the WiFi has gone to sleep, then why does it still show up on the router?

The router is usually also the DHCP server and the router's list is most likely the list of devices that have been leased IP addresses. Until the lease expires the router will continue to list the device.

The power save on the WiFi device is NOT based on the lease time, but is usually based on (a lack of) activity.

OctoPrint can be configured to do a "Connectivity check" (under Server settings) and there is also a plugin, OctoPrint-NetworkHealth. One of both of these options should keep your WiFi alive if turning off the power save doesn't work.

Ah good. That makes some kind of sense.
I've tried the earlier suggestion, and not had a problem since, but in the nature of intermittent problems, that may not mean a lot...

Does the problem happen if you connect to the Pi via ethernet cable, rather than WiFi?

If connecting via ethernet eliminates the problem, you have some WiFi troubleshooting to do. It's possible you have a weak/intermittent WiFi signal. An inadequate power supply is known to cause WiFi problems. The WiFi on a Pi is not particularly strong to begin with, so it's also possible you just don't have a strong enough signal for a reliable connection, or electrical/RF "noise" is causing a problem (such as from florescent or some LED lights or from some light dimmers or electric motors).

If you think this may be part of your problem, check out WiFi setup and troubleshooting. Since you can connect some of the time, you can probably safely skip over the sections dealing with logging in or which text editor you used to set up the connection. I suggest looking at the following sections at that link:

  • Weak/Inadequate Power Supply
  • WiFi Signal Strength
  • Electrical Interference
  • Damaged or Defective SD Card (since you mentioned "shutting it off")
  • Other Diagnostic Commands

That "Other Diagnostic Commands" section can be very important in diagnosing WiFi issues. If you are not able to resolve the issue, reporting the results you get from those diagnostic commands here may help us narrow down the problem.

It would take a lot of trouble to get an ethernet cable to it, but I have had no trouble since I tried the solution above.
That might be just luck, but for now, I am accepting it as a problem solved.

Thank you for the suggestions nonetheless.

I was suggesting the ethernet as a temporary diagnostic effort, not a long-term solution.

If your issue has been resolved, you can mark your original post as solved. This accomplishes two things: (1) people know to stop trying to come up with solutions and (2) others with the problem can quickly find what fixed your problem.

1 Like

Either way, it would be a significant problem to set up. Though I suppose it's not that much effort to unplug everything...

Yes, but the thing about intermittent faults is that you don't know that they're solved, just because they have gone away... and guess what...

Now I have managed to connect again, I find that the "Connectivity check" was already enabled.
So I'm installing the "Network Health" plugin...

I have had the same problem in the past.

I found that although the power to the printer and the pi are off the same connector block, the Pi would be intermittent on connection. Sometimes it would work, other times it would refuse, despite me seeing a wifi connection was established.
Sometimes the Pi would start up with no IP, other times it would start normally and reading somewhere that if Octoprint was not shut down properly when power is removed, corruption of the Pi could be a cause, so I reprogrammed the Pi.

Since this is a bind when you want to get something done, I just start and stop things in a sequence. The printer is powered on and a time delay kicks in to start the Pi once the printer is alive.
On shut down I close Octoprint down properly, before removing power first to the Pi then the printer.

Another problem, which I am sure you must be aware of, is that a data only cable is used between Pi and printer, or put a bit of tape over the power pin of the USB connecting the printer and Pi.
The problem of course is that if the printer starts ahead of the Pi then it will try powering the Pi over the USB. Inversely if the Pi starts first, it will try powering the Printer control circuit from the Pi.

Both ways are bad and can lead to data corruption, despite the wifi dongle establishing connection.