[Solved] Cannot install Octoprint due to network issues but network is working

Having issues with your DietPi installation, or, found a bug? Post it here.
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by Garret »

Giving the wget command I get this:

Code: Select all

root@transmission:~# wget --spider https://github.com/foosel/OctoPrint.git
Spider mode enabled. Check if remote file exists.
--2019-03-10 19:19:08--  https://github.com/foosel/OctoPrint.git
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/foosel/OctoPrint [following]
Spider mode enabled. Check if remote file exists.
--2019-03-10 19:19:31--  https://github.com/foosel/OctoPrint
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.

root@transmission:~#
In any case, thank you for the other solution of skipping if the git repository can be reached :)
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by MichaIng »

@Garret
Very strange, resolving the github.com hostname times out with G_CHECK_URL but works with plain wget --spider.

The only thing I can imaging that the timeout value we use (5 seconds) is too short.
Please try:

Code: Select all

timeout=10 G_CHECK_URL https://github.com/foosel/OctoPrint.git
Or even with higher value.

Ah I see 19:19:08 and 19:19:31 as timestamps (so 23 seconds) in your error output, which is indeed veeery long.
See my output which didn't even take 1 second:
root@VM-Stretch:/mnt# wget --spider https://github.com/foosel/OctoPrint.git
Spider mode enabled. Check if remote file exists.
--2019-03-10 19:42:15-- https://github.com/foosel/OctoPrint.git
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/foosel/OctoPrint [following]
Spider mode enabled. Check if remote file exists.
--2019-03-10 19:42:15-- https://github.com/foosel/OctoPrint
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
Which DNS server do you use? I guess this step took so long?: Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
If you have a router that can serve as DNS server for your local network (most do), please try to use it. You could do a quick test by adding the routers IP to /etc/resolv.conf, e.g. (in my case): echo 'nameserver 192.168.178.1' > /etc/resolv.conf
If you use DHCP from the router, it should apply itself automatically as DNS server, otherwise you could try to use the DHCP service IP etc as static IP and then add the router IP as static DNS entry as well.
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by Garret »

With timeout=10 I still get the error but when increasing to 60 seconds it passes the test.

I am using DHCP on my router and I have given a static ip to the raspberry pi. The router has google dns as primary dns and cloudfare as second dns.
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by MichaIng »

@Garret
Hmm do other devices in your local network as well need that long to connect to www resources? It depends on your location as well of course, but also Google DNS should be way faster since it is a mirror director that redirects to the closest actual server location near you.
I am using DHCP on my router and I have given a static ip to the raspberry pi.
Do you mean you enabled static IP use on the Pi or you made your router assigning a "reserved" IP to the Pi, still via DHCP?
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by Garret »

I have a 70mbit connection both download/upload and I think every webpage and download is quite fast.

Before I meant that the router assigns a static ip to my raspberry pi.
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by MichaIng »

And connecting e.g. via browser to https://github.com/foosel/OctoPrint.git works quickly?
Does curl https://github.com/foosel/OctoPrint.git work faster than the wget?

Ahhhh wait do you have IPv6 enabled or disable? If enabled did you choose to prefer IPv4?
Could you try:
G_CONFIG_INJECT 'prefer-family[[:blank:]]=' 'prefer-family = IPv4' /etc/wgetrc
And check if the wget --spider command is faster now?
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by Garret »

Code: Select all

root@transmission:~# G_CONFIG_INJECT 'prefer-family[[:blank:]]=' 'prefer-family = IPv4' /etc/wgetrc
[  OK  ] G_CONFIG_INJECT | Desired setting in /etc/wgetrc was already set: prefer-family = IPv4

root@transmission:~# wget --spider https://github.com/foosel/OctoPrint.git
Spider mode enabled. Check if remote file exists.
--2019-03-11 08:53:57--  https://github.com/foosel/OctoPrint.git
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/foosel/OctoPrint [following]
Spider mode enabled. Check if remote file exists.
--2019-03-11 08:54:17--  https://github.com/foosel/OctoPrint
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.

root@transmission:~# curl https://github.com/foosel/OctoPrint.git
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

root@transmission:~# 
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by MichaIng »

@Garret
Ah okay IPv4 was already preferred. I just remembered that on my VMs connecting to IPv6 addresses took a very long time before wget (and APT as well) gave up and switched to IPv4.

I mean theoretically you could try to use the IPv6 address instead and compare:
wget --spider -6 https://github.com/foosel/OctoPrint.git

Did the curl command finish quickly?
Ah and to better compare, curl should follow redirects.

So overall testing would be:

Code: Select all

time curl -L https://github.com/foosel/OctoPrint.git
time wget --spider https://github.com/foosel/OctoPrint.git
time wget --spider -6 https://github.com/foosel/OctoPrint.git
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by Garret »

@MichaIng here are the results: :)

Code: Select all

root@transmission:~# time curl -L https://github.com/foosel/OctoPrint.git
[...]
real    0m16,955s
user    0m0,119s
sys     0m0,011s

root@transmission:~# time wget --spider https://github.com/foosel/OctoPrint.git
Spider mode enabled. Check if remote file exists.
--2019-03-11 16:00:37--  https://github.com/foosel/OctoPrint.git
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/foosel/OctoPrint [following]
Spider mode enabled. Check if remote file exists.
--2019-03-11 16:01:08--  https://github.com/foosel/OctoPrint
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.


real    0m39,830s
user    0m0,127s
sys     0m0,010s

root@transmission:~# time wget --spider -6 https://github.com/foosel/OctoPrint.git
Spider mode enabled. Check if remote file exists.
--2019-03-11 16:06:52--  https://github.com/foosel/OctoPrint.git
Resolving github.com (github.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘github.com’

real    0m20,096s
user    0m0,065s
sys     0m0,009s

root@transmission:~#
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Cannot install Octoprint due to network issues but network is working

Post by MichaIng »

Okay there is not IPv6 address for this github.com.

I am still totally wondering. All of those commands take a veeery long time. In my case all of them finish in a fraction of a second.

Something with your network setup must be wrong. Lets check if other GitHub resources and other hosts take as well that long:

Code: Select all

time wget --spider https://github.com/MichaIng/DietPi.git
time wget --spider https://dietpi.com
Did you try to open https://github.com/foosel/OctoPrint.git in a browser from a desktop within the same local network? Does it open immediately or take as well so long?
Post Reply