Octopi refuses connection

Bummer. It sounds like the octoprint service isn't running (now?)

And yet, that netstat shows that it's listening on localhost rather than 0.0.0.0 (all network adapters). But you proved that it is running earlier and it's listening to port 5000. :confused:

This is mine:

sudo netstat -tulpen|grep LISTEN

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      0          14458      483/./mjpg_streamer 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          16703      879/sshd            
tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      1000       16435      449/python          
tcp6       0      0 :::8080                 :::*                    LISTEN      0          14459      483/./mjpg_streamer 
tcp6       0      0 :::80                   :::*                    LISTEN      0          16048      883/haproxy         
tcp6       0      0 :::22                   :::*                    LISTEN      0          16705      879/sshd            
tcp6       0      0 :::443                  :::*                    LISTEN      0          16049      883/haproxy       

I guess what you have then is to be expected for the octoprint service. Interestingly, I myself can't reach my own instance from http://octopi.local:5000/ . Perhaps something was changed in one of the releases but I seem to remember this working in the past.

Let's focus on haproxy then. Let us know if yours differs from this.

cat /etc/haproxy/haproxy.cfg

global
        maxconn 4096
        user haproxy
        group haproxy
        log 127.0.0.1 local1 debug

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        default_backend octoprint

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

I'm going to say that it's identical.

So I then run this:

cat /var/log/syslog | grep haproxy

Mar  6 09:42:33 octopi systemd[1]: haproxy.service: Succeeded.
Mar  6 09:43:16 octopi systemd[1]: Starting Ensure that haproxy certs are generated...
Mar  6 09:43:16 octopi systemd[1]: Started Ensure that haproxy certs are generated.

...to see what the syslog says about all this.

In case we did want to check on the health of your haproxy.cfg file though:

/usr/sbin/haproxy -c -f "/etc/haproxy/haproxy.cfg"

[WARNING] 065/120714 (6501) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.
Configuration file is valid

So we like that last line; that's a good sign.

Not really sure here but we might be able to start haproxy from the command line in a session and see if it gives us any more detail. So I first check man haproxy...

/usr/sbin/haproxy -V -f "/etc/haproxy/haproxy.cfg"

If that seems to still be running then go visit your browser and try again. If it throws errors then we'd be interested to read them.

haproxy-2
As you see nothing happend after: cat /var/log/syslog | grep haproxy

If it can't run the haproxy executable then it's probably a good idea to flash a new OctoPi image to your microSD card (or a new microSD card).

I have flashed several timed before with both Win32 DiskImager and Etcher.
But on the same microSD card. Maybe something is wrong with it so I have to get a new one.
Thank you OutsourcedGuru you have been very knowledgeable and committed.

Latest try. I flashed octopi-buster-lite-0.17.0 to a new microSD card. The problem was still there.
Then I downloaded the older octopi-stretch-lite-0.15.1 and flashed it to my first microSD card.
Voila, it works like a charm!

1 Like

Nice. Hopefully you're learning some things so that you can troubleshoot in the future.

People ask me, "how do you know all this?" and I have to answer, "usually I just do an Internet search and learn as much as I can about something new".

Thank you OutsourcedGuru. Yes I have learned a lot.

I know this is an old thread, but I wanted to mention this in case anyone has the same issue.

One thing I discovered today is that you get all the same symptoms described in this thread if you do a fresh install of Octopi via the Raspberry Pi Imager tool, then disable IPv6 via the kernel command line. If you re-enable IPv6, everything starts working as it should.

I hope that helps someone!

~ Terrin2k