Set static IP without breaking the Plugin Manager?

Hello guys, I'm new here.
I need to set a static wifi IP to my octopi instance so I can access it without going in the router settings to see it and in order to use also Printoid on my smartphone, but everytime I set it, the plugin manager stops working.
I show you everything so you can understand and, maybe, help me.
I installed again Octopi today on a Pi3B, because I had problems with the previous installation. The instance is working, so I edited th file /etc/dhcpcd.conf in order to set a static IP. After the reboot I was able to access the Pi with that IP, but I discovered that the Plugin Manager wasn't working anymore, giving me the "No internet connection error" like before the reinstallation from the previous instance of Octopi. I tried setting the dns in dhcpcd.conf as 8.8.8.8 like in Octopi's settings, but the PM wasn't working yet. I tried removing the static IP and now it works again, so I think that the problem is that config.
Is there a way to configure the IP without breaking the PM? Unfortunately my router don't allow me to set a static IP, so the only way I can is through Octopi itself.
Thanks!

Instead of doing that, why don't you give the Pi a static lease in your router? That way, it will still be using DHCP to get its IP address from the router, but the router will always give it the same address (instead of expiring it after a set time and possibly giving it a different IP address next time).

2 Likes

And for the record, the problem description sounds like the Pi actually does lack a route to the public internet, therefore in fact is offline, which is why the connectivity check fails and the plugin manager "breaks".

Just assigning it a static IP isn't enough, you also need to specify the default gateway and it needs to be reachable.

edit And assuming that a static DHCP lease as suggested by @fieldOfView isn't possible with your router (in which case it doesn't deserve to be called a router) it would make sense to share what you changed in /etc/dhcpcd.conf so people can check if your changes look right. It would also be a good idea to see if you can ping both your router's IP and an external IP (e.g. 8.8.8.8) from your Pi when you have your static IP configured, because if either of those fail you need to get that working first before you can start worrying about OctoPrint running on top of things.

As I said at the end of the question, unfortunately I can't.

Here is what I've added in the file:

#static IP configuration

interface wlan0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8

Yeah, I know... But for the moment I only can use this given me by my ISP.

What I also can't understand is: if with the static IP the connection "breaks" and I can't download plugins from the PM, then why I can reach it through Telegram and the Telegram Bot plugin? If the PM see the Pi as offline, than also the plugins shouldn't be able to comunicate through the connection, right?

That's indeed odd. How do the dynamically assigned IPs look like?

How it works is this: the connectivity manager inside OctoPrint regularly tries to open a connection to the configured host and port (usually 8.8.8.8 and port 53). If it succeeds it considers a functioning internet connection, otherwise it assumes to be offline. It sends events about this and other system components (like the plugin manager) react to these events and change behaviour if needed.

Long story short, the question is why OctoPrint can't reach 8.8.8.8:53 when the system is configured with a static IP. And the answer to that probably lies in the differences between dynamic and static configuration on the system.

You can try to figure that out and solve it. Or - if internet connection indeed is verified - you can simply disable the connectivity check via the settings (I think I put it into the server section).

I already tried this in the previous installation, but it didn't work as well for me.

They are always 192.168.1.xxx.

And I know that it's odd, and I don't know why it's like this. I installed my fisrt instance of Octopi almost 1 year ago, and I set up the static IP in this same way immediately. Never had any problem, the plugin manager worked and also everything. Only 1-2 months ago I discovered that it wasn't working anymore, and I tought it was some corrupted file so yesterday I reflashed the sd card with a new instance, that has the same problem. I think it's some update I made in the last months (I don't know when the problem showed up, because I use the plugin manager very rarely).

Also, when I set the static IP, from the Pi's terminal I tried running a ping towards 8.8.8.8 and also towards the IP of my PC, but for both it says "destination host unreachable", while if I run a ping from my PC towards the Pi, it sends everything without lost packages.

And last thing, I just tried this and, when I set the static IP, now in the PM it don't give me the error "No internet connection like yesterday", but instead an error about PIP, that went away when I removed the static IP strings from the dhcpcd.conf file.

I don't know, maybe I just have to use the dynamic IP...

1 Like