Octoprint has intermittent connection issue


What is the problem? Octopi doesn't connect reliable to the internet. Sometimes is does sometime it doesn't

What did you already try to solve it? reboot, restart , shut of plugins, change network settings with routers. Problem comes and goes. Printing is fine, time-lapse is fine as well.octoprint.log (497.7 KB)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)


In what ways do you see it "not connected"? Are you connected via wifi or ethernet? Static IP?

What is listed in the log is a DNS issue. But you haven't given us much to go on. For starters, explain what errors you are seeing and how you've diagnosed it. Then paste the contents of /etc/resolv.conf and the results of nslookup octoprint.org.


All connection errors I see are referring to Astroprint


Forgive me I'm new to all of this . The behavior of the octopi seems normal at least to me. I'm connected via Wi-Fi and I can see the octopi on my local network. And most of the time the octopi can connect to the DNS server and I can update plug-ins etc. However, seemingly at random it loses the ability to connect to the Internet. Astro print is one of my main connections to the outside world so that would make sense that there're a lot of errors there. Generated by resolvconf


I cannot do nslookup because I can't install it as the raspberry pi won't connect to the archive


It sounds like you're using as your nameserver so that would be something internal on your own network. The nameserver is either sponsored by CloudFlare or similar. I couldn't tell you if it is reliable or not.

It's entirely possible that both nameservers failed in resolving the Astroprint server to an IP address. It's entirely possible that your internal network isn't configured correctly for DNS lookups. It's possible that your home router doesn't have an upstream nameserver which it can rely upon for lookups.

If it were me, I would create an entry for their server in the Raspberry's configuration so that it doesn't try to do processing-intensive lookups while your printer is supposed to be trying to print:

sudo nano /etc/hosts     api.astroprint.com


cloudflare, yeah, but there may be some issues with using it from a Raspberry Pi. If you have two nameservers perhaps one is working and not the other.

Or perhaps you actually have connectivity issues.


The DNS works flawless on the other 20 odd devices on the network. I have replaced the DNS with both and
in both octopi and the routers with no change in result. As I have said before it works then it doesn't. I haven't found a common thread other than it is only the PI 3 as the previous PI 1 worked without issue same version of the software, default connections etc. I will however put a direct entry for astroprint but that still doesn't explain why it is intermittent and not hitting the plugin repository. Added the entry api.astroprint.com. Unfortunately, no love.


It's either a problem with Astroprint or (more likely) with your Pi3 connection. Not Octoprint.


HMMM. I will keep looking thanks for your help.


As a long-time I.T. guy, I can tell you that DNS is a pain. It has to support a three-way type of tcp/ip conversation:

  1. client makes a DNS request to lookup api.astroprint.com
  2. your router doesn't have that cached and isn't authoritative so it sends the request on to on your behalf
  3. responds back to you (initiating a new tcp/ip session) which then for all practical purposes makes your router think that this is your average hacking attempt

If educating your Pi's /etc/hosts file didn't fix this then troubleshoot this like a routing problem. Check to make sure that all netmask values are accurate and that the Raspi only has a single default gateway set (if you use both eth0 and wlan0).


I figured it out, The pi doesn't like to have a reserved ip set for it. As soon as I deleted the entry and rebooted the dns came up. I did an ifconfig prior and the ip was reported correctly. Yet it acted at least partially like it wasn't on the same net weird.


Try this instead:

  • Your Raspi asked for a lookup for api.astroprint.com from your local DNS server
  • Your local DNS server didn't have that cached and forwarded the request to some DNS server upstream on the Internet
  • That server tried to send the response back to your Raspi
    • On the inbound trip, it landed at your router
    • Your router than tried to route it to the DHCP-issued IP address (which was wrong)

Result: no lookup response to your Raspi.

Sounds like you got it sorted out, though.


My friend, you should take a better look in your network. I disagree with your "solution", because I use IP reservation in my network to most of my devices, and has absolutely no problem with Pi. It may solved your problem, but it's not the root cause of it.

What router do you use? I use an Asus, and ip reservation works fine.

What I have with my Pi is that it loses a lot of packages, because it's onboard wi-fi is not that good in terms of range, but once it works, is not critical, and I can still use it, with a litle bit of delay from the camera, it doesn't bother me.