Nixos-rebuild switch fails every time with "HTTP error 200 (curl error: Timeout was reached)" and a few other errors

And I see a bunch of other people have suffered through this in the past

The last thing I ran was

nixos-rebuild switch --option http2 false --keep-going -j1 --fallback --option substitute 0

which I guess pulls directly from https://ftpmirror.gnu.org/ as opposed to the Fastly cache, so it’s not necessarily a Fastly issue.

I’ve tried a BUNCH of different workarounds and flags recommended on various posts here and reddit and absolutely nothing seems to work. I get the same errors and the rebuild fails. Do we have a definitive solution for the issue(s)?

I’m on nix --version = 2.3.12

Screenshots:
Imgur
Imgur
Imgur

Very frustrating experience. I would love to get this resolved because this is a blocker for me using nixos at all. Help please

it seems like you don’t have connectivity. if you do ping google.com do you get any responses?

1 Like

+1 to @jonringer’s comment regarding some other quick spot-checks. Does curl work? Does firefox work? Does Windows on this same computer/network work?

Also, just a shot here…

This command should attempt to build your top-level configuration with nixUnstable from the nixos-unstable channel.

np="/home/cole/code/nixpkgs/cmpkgs"
nc="/home/cole/code/nixcfg/hosts/raisin/configuration.nix" # path to your config
nix-shell \
  -I "nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz" \
  -p nixUnstable \
  --command "\
    NIX_PATH=nixpkgs=${np}:nixos-config=${nc} \
      nix-build '<nixpkgs/nixos>' \
        -A config.system.build.toplevel"

Though you’re probably using nix-channel to manage your nixpkgs… so maybe this will just work for you:

nix-shell \
  -I "nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz" \
  -p nixUnstable \
  --command "\
    nix-build '<nixpkgs/nixos>' \
      -A config.system.build.toplevel"

This suggestion is just based on some other hints I’d seen that maybe some network fixes would be in nixUnstable that aren’t in nix stable yet. But this is just a guess, it’s entirely possible it will fail in the same way.

@colemickens Thank you for the responses!!

ping works with zero packet loss and firefox works. Not blazingly fast, but I get there, however it is true, if you look at the RX errors section for my ifconfig interface there, I do get some errors. Is this an absolute blocker for the download? When I navigate to a failing url in my browser I’m able to eventually download the package. It does fail for me a few times but after manually resuming the download via firefox downloads manager I do eventually get there.

Imgur

How do I recreate that via nix tooling please?

and yes, @colemickens curl works, returns 200s. FF works, see previous screenshot. I have not used windows at all on this comp. Thank you so much for your suggested scripts. I will try those.

some wireless chipsets also have issues with powersave modes. Try disabling powersave and see if your connection is more stable.

1 Like

Ok great advice, yes. It’s a brand new Lenovo Thinkpad with

  • Intel® Wi-Fi 6E AX210 802.11AX (2 x 2) & Bluetooth® 5.2

and for some stupid reason the internet is quite slow even directly connected via high throughput cat5e ethernet, even directly from the modem! Is powersave mode a potential reason? I’ll research how to disable that. Thank you

edit: Oh no, sorry. Had a brainfart. Yeah, having a problem with wireless right now where linux isn’t recognizing my wireless interface so I’m forced to use ethernet until I update my kernel, which is what I’m looking to accomplish with the rebuild.

Probably my last idea without new info:

If you’re using an Ethernet cable when you don’t normally otherwise, you could consider trying another cable, or directly connecting with a known-good cable to the router?

Good luck!

EDIT: Sorry, had my own brainfart and forgot the part where you said firefox and curl work.

EDIT2: Nah, I’m back to thinking this is a good idea to maybe try… this actually sort of looks like when my brother had a similar issue.

@colemickens and @jonringer Very sorry for raising a red alert for this. I think I realized the issue and it’s not nix’s fault. Think this is a hardware issue discussed here https://forums.lenovo.com/t5/Fedora/I219-V-Ethernet-on-Thinkpad-T14-Intel-Gen2-very-slow /m-p/5077855?page=1

Like I said, I’m forced to use ethernet right now until I upgrade the kernel and my wireless card is recognized and apparently there’s this issue with lenovo thinkpad’s ethernet out of the box. Everything else in my network works. Thank you both for jumping in with suggestions. I’ll try some of the solutions in the lenovo thread and take it up with them.

edit: One wonders though, what was going on with all the other cases I found with the same exact timeouts and errors? They were all using thinkpads with this ethernet issue?

1 Like

You’ve already done enough and I appreciate your time, but if this question is quick and easy enough for you to respond to, could I ask you to take a look at this one? https://www.reddit.com/r/NixOS/comments/oa9svq/fwupdmgr_not_enabled_by_default_can_it_be_enabled/

no worries if not

Oh no, I knew I’d heard about this issue. Someone else hit this exact same issue on reddit or matrix or somewhere. I know I read about it, definitely in the last 5 days too…

Anyway,

I’d go grab an old NixOS installer with a 5.10 or lower kernel that might avoid that firmware/kernel mismatch? (Note, I skimmed the linked article, not sure if that’s a valid workaround)


EDIT:
Enabling fwupdmgr won’t get you anything without Internet, btw, the very first thing it does on startup is ask if it can self-update its database.

@colemickens @jonringer Thrilled to let you know that after going to hell and back I finally have everything working. Bios updated, latest kernel, wifi working, packages downloading consistently. Just wanted to thank you both once again for your time. On to nixos lock stock and barrel :metal:

3 Likes

I’M in the same situation as you are - Lenovo Thinkpad P15s. Freshly downloaded installation IOS from NixOS. My wirless card is not recognized by the Linux kernel (5.10.57) provided with the installation disk, the ethernet cable connection is slow/breaks which leads to the HTTP error 200 (curl error: Timeout was reached) error when I execute nixos-install.

Next steps I’m going to try: update BIOS.

How were you able to use the latest kernel without completing the installation?

My problem I get the timeout error on nixos-install - I can’t install NixOS (which probably would provide a newer kernel) and thus I’m stuck with the kernel provided by installation ISO (using the newest 21.05)

OK, here a reply on myself.

What worked for me upgrading the BIOS by using the ISO image provided on the Lenovo page. After the BIOS upgrade to 1.41 the install completed successfully.

Correct. The only thing that finally worked was upgrading my BIOS from here. I always thought that Lenovo ThinkPad was the premier laptop for linux but their support for it is actually pretty lacking smh. Anyway, good luck.

Back again - I had to put the installation on hold for a couple months. Now I have time again.

Since there was a new image for NixOS-21.05 (nixos-plasma5-21.05.3532.aff647e2704-x86_64-linux.iso) out I downloaded it and retried a clean installation again. And I hit the same error again.

Disabling ipv6 as suggested in https://github.com/NixOS/nix/issues/3025 made the download less flaky, but then I got a different error HTTP error 206 (curl error: Stream error in the HTTP/2 framing layer).

The only way I could go through an install was by creating a minimal configuration with no xserver.

At the end of the day I was not able to install NixOS 2021.05, nor 2021.11 (experimental) since the provided Linux kernel (5.10.*) did not support the hardware for my network cards (neither Ethernet nor wireless were not working properly).
I had to create an ISO installation with the newest kernel which fixed by connectivity problems. I followed the instructions Building a bootable ISO image — nix.dev documentation to create the ISO.
Afterwards nixos-install worked like a charm.

Thanks, that was the issue for me

I was trying to run nixos-rebuild switch --flake ... and cache.nixos.org kept timing out. Things were working fine for nixos-rebuild switch so I figured it wasn’t a connectivity issue, but then I tried ping google.com and wasn’t getting a response. I’m using UTM to run a NixOS VM on my Mac, I had to switch my VM network mode from “Shared Network” to “Emulated VLAN” and then my flake rebuild worked