[SOLVED-ish] Ghcup is giving "curl: (56) Recv failure: Connection was reset"

I am trying to manually install ghcup in a Windows 11 virtual machine using these instructions.

I am at the step ghcup install ghc --set recommended in step 4. It keeps repeatedly failing with:

curl: (56) Recv failure: Connection was reset

Sometimes it gets farther than others. It never gets more than halfway. And sometimes it fails immediately.

I have no problem downloading this file on my Linux host machine:

$ curl -O https://downloads.haskell.org/~ghc/9.2.8/ghc-9.2.8-x86_64-unknown-mingw32.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  482M  100  482M    0     0  10.1M      0  0:00:47  0:00:47 --:--:-- 8634k

Although before now, I’ve never had trouble downloading files from inside the Windows VM, either.

Is there some way to either:

  1. Pre-download the file (i. e. using my host machine) and then tell ghcup where to find it?
  2. Pass some of these curl options through ghcup to make it “retry harder”?

You can disable curl in the bootstrap script:

You can also install manually instead and do everything the bootstrap script does: https://www.haskell.org/ghcup/install/#windows_1

After GHCup is installed, you can switch downloader via ghcup config set downloader Curl and ghcup config set downloader Wget.

Pass some of these curl options through ghcup to make it “retry harder”?

For the bootstrap script, we don’t really support options, since it’s some windows emulation of curl that’s hard to support. Once ghcup itself is installed though, you can tell it to use env variables to add options to curl and wget: https://www.haskell.org/ghcup/guide/#env-variables

Yes, as mentioned, those are the instructions that I’m using. I didn’t use the automated setup because I already had MSYS2 installed, and I didn’t want to end up with a second MSYS2 installation.

Anyway, the problem just sort of solved itself. I came back a few hours later and tried it again, and the download completed successfully on the first try without any trouble. I don’t know why it was repeatedly failing before, but now it works, and I finished installing ghcup successfully.

1 Like