containers / krunvm

Create microVMs from OCI images
Apache License 2.0
1.41k stars 42 forks source link

nix thinks the vm is offline #51

Open dsilvasc opened 11 months ago

dsilvasc commented 11 months ago

Repro:

krunvm create --name nix nixos/nix
krunvm start nix nix -- --extra-experimental-features 'nix-command flakes' profile install 'nixpkgs#google-cloud-sdk'

This fails with:

warning: you don't have Internet access; disabling some network-dependent features
error: builder for '/nix/store/5jrd75v747s76s16zxk59384xfcjqn58-bash-5.2.tar.gz.drv' failed with exit code 1;
       last 4 log lines:
       > error:
       >        … writing file '/nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz'
       >
       >        error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Timeout was reached (28)

Looks like it's because of this check:

https://github.com/NixOS/nix/blob/2.18.1/src/nix/main.cc#L456-L459

https://github.com/NixOS/nix/blob/2.18.1/src/nix/main.cc#L30-L54

I wonder if it's common for programs to inspect getifaddrs like that, and if so, what other problems would come up if it returned a fake non-loopback/link-local network interface.

Rucadi commented 10 months ago

virito-net got merged into libkrun, I assume that using the virtio-net backend will make it work.