Today I just flashed and updated the latest image of Dietpi on a Raspberry Pi 3B+. Everything went fine but cannot install Octoprint from the software optimized. I get an error like dietpi cannot reach the octoprint gihub repository url but network is correctly working.
The raspberry pi is connected through ethernet to the router and I can check/download updates without any issues.
This is the screen I always get when attempting to install Octoprint:
Giving G_CHECK_URL https://github.com/foosel/OctoPrint.git returns the same window I showed you in my first post. For some strange reasons it seems it cannot reach the url.
While giving the cat command I get the dns server of my router which I then set with the google ones (8.8.8.
root@livingroom:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
root@livingroom:~#
I tried to reach the repository with the curl command and this was the result:
root@livingroom:~# 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@livingroom:~#
I don’t understand. I tried to install other programs via the software optimized and they installed without any problem.
Garret
The curl output is expected, host resolution worked fine with the Google DNS.
You can verify again with G_CHECK_URL, I am pretty sure it works as well.
So in this case I would check your routers DNS settings, if it actually serves as DNS server and which uplink DNS server it uses itself. You could then also try to use the configured uplink DNS server from your router directly, perhaps this is/was temporarily or permanently down or faulty.
Hmm I tried again this morning but I get always the same window with the same error.
If I connect from my phone to the router via wifi, I can access that url. I have DHCP set up in the router and the google dns as primary and secondary dns. I tried to switch the google dns on my router with the cloudfare (1.1.1.1), rebooted the router and raspberry pi and still get the same error.
Did you verify that the Pi adapts the cloudflare DNS from the router after connecting (via DHCP)?
Note that any DHCP lease in most cases overwrites /etc/resolv.conf. It is a dynamically created file, controlled by resolvconf package which can be triggered by different sources, e.g. DHCP clients.
What you could try as well is use a static IP instead of DHCP and hard code the DNS server there. If the static IP is within the DHCP IP range and as well configured as reserved for the Pi in the router network settings, this should work well in most cases. This is how I do it here .
Just to be sure, you don’t have Pi-hole installed, do you?
I (partially ) solved the problem by installing octoprint manually. It is so weird that when using the dietpi-software it cannot clone the git repository but if I give the command manually it works without any issues. There must be something wrong with the dietpi-software, like it connects using some other network configuration for some reason.
This was the procedure I used on a clean dietpi installation:
su dietpi #octoprint needs to be later started by non-root user
cd
sudo apt-get install git python-pip virtualenv
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint/
virtualenv venv
./venv/bin/python setup.py install
./venv/bin/octoprint #starting of octoprint
Can you suggest an easier way to install it and have it always running when I restart dietpi? And still it would be really nice to have it installed through the software optimized…
Hi MichaIng, thank you a lot for your message. As I said in my previous post, I had already tried that command and gives me back exactly the same error window
But I tried it again this morning and I got the same result. I really don’t understand…
However aside from that to allow you installing OctoPrint via DietPi-Software, please open /DietPi/dietpi/dietpi-software, find the line with https://github.com/foosel/OctoPrint.git and remove the G_CHECK_URL “$INSTALL_URL_ADDRESS” below.
This skips the online check which is not required if you already know that git clone works.
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:
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
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?
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
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.
Did the curl command finish quickly?
Ah and to better compare, curl should follow redirects.
So overall testing would be:
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
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:
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?