Network related issues during snap building in wsl

I am consistently having intermittend network issues during the snapcraft building process. Simply said, I am often facing errors with curl or git pull, terminating with an error related to network related errors like peer reset. It presently makes snapcraft completely unusable.

I don’t nessecarilly believe snapcraft is to blame here, but I have previously reported errors to what I believe are the relevant software packages and they have been completely unaddressed, but is very dispruptive bug.

The problem:

  • Description: I believe the problem is network instabillity due to multiple layers of virtual machines i.e. wsl and lxc
  • Environment: using a windows machine with ubuntu in wsl to be able to compile snap with snapcraft
  • Symptons: network based commands (curl, git etc) terminate for network reasons (peer resets, invalid ssl handshakes) under lxc but not under windows nor ubuntu environment

I have previously reported this error directly on lxc/lxd forums, irc, launchpad and microsoft wsl repository, but the problem keeps occuring and I would love an solution. The only workaround I have been able to find is to use a socks proxy, like the code below.

links:

Workaround:

export lxdbr0=$(ip addr show lxdbr0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
ssh -fN -D ${lxdbr0}:9998 ${USER}@localhost
snapcraft try --http-proxy socks5h://${lxdbr0}:9998

Hi @phr34k! WSL exposes us to unique issues, not seen anywhere else :wink:

Are you still running the same versions you reported on MS GitHub’s issue? (Windows build 10.0.19044.2364, kernel 5.15.79.1)?

Also, I’m assuming you’re not running inbox WSL (the one that used to be serviced through Windows Updates) but rather using WSL from MS Store (more frequently updated).

Can you confirm your WSL version?

I’m asking that because there were a number of initiatives taken by Microsoft’s WSL team to improve networking . I suspect you’d specially benefit from the mirrored mode available in latest Windows 11 builds, but it sounds likely unfeasible for you, so I’d rather gather more information from your setup so we can investigate further.

I kinda agree with your reasoning of that issue being related to virtualization layers, and it seems quite hard to figure out where to start the investigation from.

I’m member of Ubuntu WSL team. I believe we can gather enough context to dig deeper into this issue.

@CNihelton I am using the same device as reported on the associated github issue. The versions have changed slightly due to software updates Windows 10 Version 22H2 build 19045.3570 and ubuntu 22.04.1 LTS with kernel 5.15.90.1-microsoft-standard-WSL2

I have wsl installed from through the store, and have the following packages installed. I can’t comment on windows 11 situation because I haven’t been in a position to migrate yet.

The thing is when I reported the issue I happened to be abroad and the network conditions were not optimal, so I had to factor this posibility that network errors accumulate and propogate faster because of a combination of factors, but presently I expierence the same issues being on fast, reliable internet with good networking equipment.

What might be important to know that keep in mind during reproduction cases that I am using wireless internet (laptop), which may be more sensitive to errors.

Can you clarify whether, with wireless internet, you mean cellular (phone) internet through an inbuilt cellular modem, Wi-Fi to a cellular internet connection via a cellular router, or Wi-Fi to a router connected to a fixed-line Internet connection?

It’s WiFi to a router connected to a fixed-line internet connection.