Unable to access OctoPrint from Computer but can from phone


#1

What is the problem?
I have OctoPrint 1.3.10 on a Raspberrry Pi 3 B+ and once OctoPrint has been running for a while (seems to be random) whether I am printing or not then I am unable to connect to OctoPrint from Mac or PC but I can a mobile device. I can access it from either octoprint.local or 192.168.0.28 on my phone I can also access from the octopod octoclient or AstroPrint apps. I can also access from safari or chrome. So it seems every connection possible is available through my phone. I have also installed terminus to try to ping and that also works. Now when I switch to either a PC or Mac and try Chrome, Firefox, Edge, Internet explorer and ping from either terminal or CMD I am not able to access OctoPrint.
What did you already try to solve it?
I have tried an OctoPrint update, Pi update. I setup WiFi to always stay on and not go to sleep as well as the Pi. Tried numerous forum and google searches over the past week, I can’t find any answers. Nothing even close to the issue I am having so decided to turn here I don’t know if it is a bug I plan on installing a new image to another card to find out if this is replicated on a new image.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...) OctoPi 0.15.1 OctoPrint==1.3.10 currently though I just updated from 1.3.09 on the Pi 3B+. The printer is Creality Ender 3 with TH3D firmware(although I have had this issue with either plugged in and connected or not plugged in to the printer. If any more information is needed let me know and I will be sure to add. Thanks in advance.


#2

Look in your router. Find Octopi IP address...
Copy that IP address to http://

It will work.


#3

Thank you for the fast reply!
I meant to edit this to reflect the actual IP which is 192.168.0.28 so I know the IP and like I said I can access it from either a phone or computer at first but after OctoPrint has been running for a while I am no longer able to access from a computer only a phone.

When I am not able to access OctoPrint I am still able to see it connected to my router. It always shows in the routers page and is also always .28 so I know the Pi is always getting an internet connection.


#4

This is the important bit, and it seems very strange. Is your computer connected via wifi? To the same network? I assume you are trying to connect via IP rather than octopi.local, so we can rule that part out.


#5

If can’t connect to rasp-pi, try reboot.

Most of time just switch it off, disconnect to the source and switch it back on do work. It did itself.

Try that.

If not working.. must be your computer? Or need on very same router network as this Rasp-pi.


#6

I agree it is very strange!
Yes the computer, Pi, and phone are all connected to the same network.

Yes, but note that octopi.local does still work as well as the IP on the phone. I even have the plugin getanywhere.io on my phone and even when I am disconnected from my WiFi it still works.


#7

Turn that off to doublecheck. I bet, for whatever reason, that is why it works on your phone and not elsewhere.

So it isn't talking on your LAN, basically.


#8

The reboot does work for a while but eventually I am unable to connect.

I don’t think it is the computer as I have tried multiple computer. Windows desktop, MacBook, windows laptop. All of them are able to connect to the Pi after a reboot. After a couple hours is once I am not able to connect.

When I found this issue/bug I was in the middle of a 16 hour print. I uploaded the gcode from the Mac just fine, I even logged in an hour after the print started from the Mac and was successfully able to connect. I needed to pause the print when I was 7 hours into the print and was not able to connect anymore.

I only have 1 router in the house and like I said I can see the connection is alive in the routers homepage and can even ping from the phone. I have replicated this multiple times so I don’t believe this was a mishap. Is anyone else able to replicate this?


#9

I have tried this. I even uninstalled the plugin to check if this was the problem and it did not make a difference.


#10

Once the plugin is removed, does your phone still have access to the Pi?


#11

Yes although at that point I have to be signed into the same WiFi network. Can also use either octopi.local or 192.168.0.28


#12

What are the IP addresses your computers and phone get? You can also run netstat -nr on your mac and post it here- at least the ipv4 parts.


#13

The Mac is 192.168.0.32 phone is 192.168.0.20 and PC is 192.168.0.19 At the office right now and haven’t setup PiVPN so I will post the results from netstat In a couple hours.


#14
  • Look at the DHCP lease length on your wifi router's settings. This is part of the "ghost in the machine" that you're chasing. If you imagine yourself printing a multi-day job then it's in your interest to push the lease length to something larger than this duration.
  • Locally on the PC and the Mac, there's such a thing as an arp cache. On either Mac/Windows, run an arp -a before and then after ping'ing that IP address in question for the Raspi.
$ arp -a
? (10.20.30.1) at a4:2b:8c:d2:ab:22 on en0 ifscope [ethernet]
? (10.20.30.150) at 8c:3b:ad:b3:d8:46 on en0 ifscope [ethernet]
? (10.20.30.151) at 8c:3b:ad:b1:e8:ad on en0 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en0 ifscope permanent [ethernet]
$ ping octopi.local.
PING octopi.local (10.20.30.250): 56 data bytes
64 bytes from 10.20.30.250: icmp_seq=0 ttl=64 time=22.621 ms
...
^C
$ arp -a
...
? (10.20.30.250) at b8:27:eb:de:a7:c7 on en0 ifscope [ethernet]
...

So, ping'ing a workstation puts it into your arp cache and makes things later easier (it doesn't have to broadcast to find out who-is-who).

Out-of-the-box, either your Mac or an iPhone (you never indicate what kind of phone you have) would have the Bonjour name lookup service. Windows would not. Adding iTunes to your Windows PC would add that as a side effect.


It's possible that the netmask is set incorrectly for the PC/Mac.

You haven't indicated if both PC/Mac are connected via Ethernet cable or by wifi to the router.


#15

I tried to include as much information as possible. It’s easy to miss a few things. I am using an iPhone X and I have iTunes installed on the PC along with bonjour.

All of the devices I have mentioned are connected via WiFi all on the same network. (Pi, PC, Mac, iPhone.

If I push the lease length won’t I still eventually be disconnected?
Leaving the office now so I will post the results of the commands mentioned above.


#16

I mean, traditionally your router will give the same IP on a lease, so the length doesn't matter. Mine happens to be 10 hours. I've only really saw pain in a coffeeshop where there's enough turnover that you can run out of lease space.

Basically, you'll know if the lease length is to blame if the Pi's IP address changes.

And based on the low IP numbers, are you using static IPs for any of these devices?


#17

I set the lease time to 1 month, I very rarely add a new device so I don't think this will affect me negatively. I did not have any set to a static and the IP never changes but I went ahead and gave the Pi a static IP.

This is the results for the arp -a command from my Mac.

(base) Deriks-Mac-8:~ derik$ arp -a
? (192.168.0.1) at 50:9:59:80:d6:81 on en0 ifscope [ethernet]
? (192.168.0.3) at 50:9:59:80:d6:82 on en0 ifscope [ethernet]
? (192.168.0.9) at 9c:e3:3f:63:af:b0 on en0 ifscope [ethernet]
? (192.168.0.20) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.24) at b8:e8:56:14:5b:6e on en0 ifscope permanent [ethernet]
? (192.168.0.28) at b8:27:eb:71:aa:57 on en0 ifscope [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en0 ifscope permanent [ethernet]
? (239.255.255.250) at 1:0:5e:7f:ff:fa on en0 ifscope permanent [ethernet]
broadcasthost (255.255.255.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
(base) Deriks-Mac-8:~ derik$ ping octopi.local 
PING octopi.local (192.168.0.28): 56 data bytes
64 bytes from 192.168.0.28: icmp_seq=39 ttl=64 time=100.219 ms
64 bytes from 192.168.0.28: icmp_seq=40 ttl=64 time=30.829 ms
(base) Deriks-Mac-8:~ derik$ arp -a
? (192.168.0.1) at 50:9:59:80:d6:81 on en0 ifscope [ethernet]
? (192.168.0.3) at 50:9:59:80:d6:82 on en0 ifscope [ethernet]
? (192.168.0.9) at 9c:e3:3f:63:af:b0 on en0 ifscope [ethernet]
? (192.168.0.20) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.24) at b8:e8:56:14:5b:6e on en0 ifscope permanent [ethernet]
? (192.168.0.28) at b8:27:eb:71:aa:57 on en0 ifscope [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en0 ifscope permanent [ethernet]
? (239.255.255.250) at 1:0:5e:7f:ff:fa on en0 ifscope permanent [ethernet]
broadcasthost (255.255.255.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]

This the the results of the netstat -nr command from my Mac.

pi@octopi:~ $ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

#18

That shows it working from Mac to Pi. I'm curious how it looks when that connection isn't working.

BTW the netstat at the bottom must be from your Pi, not your Mac :slight_smile:


#19

The next time i am unable to access I will post the results from that command. Unfortunately the only thing that I have noticed that affects access is time.

Your right I ssh into the pi to see the output on it and pasted from the wrong terminal.


#20

copypaste errors are easy. no big deal.

It looks okay, so I'm hoping running those command (ping, netstat, arp) when you can't connect will point us in the right direction. And yeah, it's annoying when there's no other way to trigger it! Oh well. I'll hop in the time machine and check here later.