Octopi refuses connection

When I try to connect to octopi by the IP address it responds "octopi refused the connection"

I can reach the Pi by Putty

The Pi has a wired connection to my network. My computer is a win 7
In my ASUS router the Pi is shown as connected.

Hello @larslju!

You may have a look at this: https://github.com/OutsourcedGuru/octoprint-name-resolution-hacks

Thanks Ewald, I followed the instructions, but still no success. I don't think it is a DNS issue.

PuTTY to it and run ifconfig. Verify that the wlan0 isn't also connected. It could be that it's connected by both network adapters and you're confused about which IP address to use.


This is the result of the ifconfig command on the pi. I neither understand what it is telling me nor what to do. Looking into the routers list over connected devices I can see octopi and its IPaddress. As you see there is no problem to Putty into the pi with that IPaddress. I have also done raspi-config and enabled ssh. The pi is connected to the router with a LAN cable. No edits of the "octopi-wpa-supplicant" file have been done. This is the image I have downloaded and flashed to the SD card "2019-09-26-octopi-buster-lite-0.17.0" . I have tried both Win32 DiskImager and Etcher.

So I take it you are trying to connect to 192.168.1.165 and that doesn't work? Can you ping that IP from the machine from which the connection via the browser ain't working?

What does

ip route show 

say on the Pi?

What happens if you try to

ping 8.8.8.8

on the Pi?


The result of "ip route show" commandon on the pi is as follows:
pi@octopi:~ $ ip route show
default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.165 metric 202
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.165 metric 202

Can you please post a screenshot of how you are trying to connect to OctoPrint in your browser?

Chrome browser. I have also tried to disable the firewall on my computer.

Back to the Pi please and run

netstat -tulpen
ps -ef | grep haproxy
ps -ef | grep octoprint

pi@octopi:~ $ ps -ef | grep haproxy
pi 1188 1150 0 15:48 pts/0 00:00:00 grep --color=auto haproxy

pi@octopi:~ $ ps -ef | grep octoprint
pi 399 1 0 12:59 ? 00:00:52 /home/pi/oprint/bin/python2 /home/pi/oprint/bin/octoprin serve --host=127.0.0.1 --port=5000
pi 1190 1150 0 15:50 pts/0 00:00:00 grep --color=auto octoprint

hmmm...looks like you start Optoprint on port 5000, but you didn't use that port in your browser url.

<yourip>:5000

Thank you OllisGit for your observation. However I don't have the slightest idea what I can do about it.

I checked my other octopi-installation and compared it with your result. I think the haproxy is not running, so the incomming call from the browser on port 80 is not delegated to port 5000.
My result looks like this:

pi@octopi3:~ $ ps -ef | grep haproxy
root       801     1  0 18:00 ?        00:00:00 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
haproxy    802   801  0 18:00 ?        00:00:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
haproxy    804   802  0 18:00 ?        00:00:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
pi        1099  1060  0 18:02 pts/0    00:00:00 grep --color=auto haproxy

try to restart the haproxy manuelly:

sudo /etc/init.d/haproxy restart

now execute the processview again: ps -ef | grep haproxy it should looks like mine.

or try curl 127.0.0.1 the result should look like a html-page.

1 Like

Hi OllisGit. The result.

pi@octopi:~ $ sudo /etc/init.d/haproxy restart
[sudo] password for pi:
[....] Restarting haproxy (via systemctl): haproxy.serviceJob for haproxy.service failed because the control process exited with error code.
See "systemctl status haproxy.service" and "journalctl -xe" for details.
failed!

1 Like

Result of curl command:

pi@octopi:~ $ curl 127.0.0.1
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

When programs give you hints, then take those hints.

pi@octopi:~ $ service haproxy status
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Thu 2020-03-05 17:56:45 GMT; 12h ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 1421 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code

Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Service RestartSec=100ms exp
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Scheduled restart job, resta
Mar 05 17:56:45 octopi systemd[1]: Stopped HAProxy Load Balancer.
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Start request repeated too q
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Failed with result 'exit-cod
Mar 05 17:56:45 octopi systemd[1]: Failed to start HAProxy Load Balancer.
lines 1-13/13 (END)...skipping...
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-03-05 17:56:45 GMT; 12h ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 1421 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, st

Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Service RestartSec=100ms expired, sched
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Scheduled restart job, restart counter
Mar 05 17:56:45 octopi systemd[1]: Stopped HAProxy Load Balancer.
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Start request repeated too quickly.
Mar 05 17:56:45 octopi systemd[1]: haproxy.service: Failed with result 'exit-code'.
Mar 05 17:56:45 octopi systemd[1]: Failed to start HAProxy Load Balancer.

Whatever technique that you're using to copy/paste that is resulting in truncated lines. And it feels like the "good stuff" is at the end of at least one of those.

At least we known that it's your haproxy that is causing this.

Try: http://octopi.local:5000/

The http://octopi.local:5000/ command replies that the IP address to the server on octopi.local
couldn't be found.
Typing in 192.168.1.165:5000/ gives connection refused. 192.168.1.165 is the IP address to the pi.