Why does the HACS download keep failing?

I am setting up a second instance of HA at our Scout Hut, using HA Green. I am trying install HACS, and have followed the instructions at Downloading HACS - HACS
When I run the Get HACS add on, the download starts happening in the log, but around about the 80-85% mark it fails, with the error:
wget: connection closed prematurely

What am I doing wrong? I’ve tried restarting, the internet connection is fine, there isn’t much else installed on the instance yet.

Hi, you are saying 'the internet connection is fine" is DNS correctly configured on the Green?

oh - I have no idea. But the download gets about 80% of the way through. Surely if DNS was at fault, the download wouldn’t even start?

Still, this seems to be related to connectivity and you don’t know what the 80-85% means.

I would try another DNS server, check IPv4/IPv6 settings and you could try another download to see if that works.

You could also try to download the latest release: https://github.com/hacs/integration/releases/download/2.0.5/hacs.zip

Unzip the contents to config\custom_components\hacs (create the folders).

Restart Home Assistant.

Refresh your web browser cache.

Install the HACS integration from Settings → Devices & Services → Add Integration

1 Like

Thanks - I’ll give it a try.

WiFi or Ethernet or hotspot?

Ethernet into a 4g router. But the connection seems fine. The couple of other integrations I’ve installed all downloaded fine, as did the various updates needed.
I tried HACS a couple of times this afternoon, and the download was slow but steady, until 87%, when it cancelled both times. Then I tried again this evening, and it downloaded much faster, but stopped at 83%. However, this time the percentages were going up at 3 or 4 per time, so in fact it probably failed at 87% again. Which makes me wonder whether there is a problem with the download package, or something to do with its size.

Have you tried this from the Green console using wget?

I’m not sure how I would use wget! Do I need to install a command line integration?
In any case, the script seems to be running wget, and it is that which is failing?

You don’t have to install anything, wget is part of the HAOS command set.

If you have a pihole or adguard, try turning that off.

2 Likes

Just a note.
A DNS query is only done in the beginning of a connection to get the IP of the server.
Once that IP is acquired then it will be used instead of the host name.

“Connection closed prematurely” means computer/server do not know why it closed, so it is either the connection or the opposite computer server that does it.
GitHub, where HACS is stored, can have issues, but only solution to that is waiting for them to fix it.
Your connection is the other possible cause and a 4G mobile connection can be disconnected and reconnected quickly, but this might cause the router/modem to get a new IP and then the connection is disconnected to the server, because the old connection was between the server and the old IP of your modem/router.

1 Like

I have a green too and just installed HACS yesterday with no problems.

You have the green configured with a static up address? I am using 8.8.8.8 and 8.8.4.4 for DNS.

Yes, but as mentioned above, DNS can’t be the issue, because the download starts. It just always terminates prematurely.

Downloading to my laptop, then connecting via samba and copying across the files worked. So thanks very much. Still not sure why the download is failing.

put a sniffer on the port

Take it to a friends house and see if it works there.