Working on Windows 10 with WSL2

I know I’m not the only developer working on windows 10, so I thought I’d start a thread to discuss WSL specific issues.

My current state:
I’ve got holoscape running from the build, it greatly helped to follow @Wladoo’s post on the holoscape testing thread , as well as this post on reddit.

That worked for running holoscape, installing PeerChat, setting up identity and all that.

When attempting to build my project, however, I’m running into an issue with cargo talking to github. It appears as though this isn’t a new/unknown issue with cargo, and @wollum has fought it in the past. That said, I haven’t found a way to get the workaround presented in that issue to work, as it involves intentionally setting your username/password for a proxy in an environment variable and I’m not sure what to use for that in the WSL specific setup.

[nix-shell:/mnt/c/holochain/memory-vault]$ hc package

cargo build --release --target=wasm32-unknown-unknown
Updating git repository https://github.com/holochain/holochain-rust
warning: spurious network error (2 tries remaining): failed to mmap. Could not write data: Permission denied; class=Os (2)

In troubleshooting I have confirmed that git cli is working from within my ubuntu setup, I have not yet apparently found the right spot for the cargo config update to tell it to use git cli instead, but hope that will fix it once I get the right config updated.

No luck on getting the config to pull from git cli (or if any change has happened I still see the spurious permission denial).

I have found, however, that if I stay in ubuntu yet outside of nix-shell and run ~/.hc-linux package, it will build just fine, so it’s not specifically about WSL2/ubuntu, but is specific to something in the nix-shell setup.

I’ve recently got access to a windows machine and will be looking into vagrant first as that’s what we support but would be very interested in looking at this after that.

@thedavidmeister have you seen any issues running hc package from nix-shell in ubuntu on WSL2?

@petersgrandadventure WSL2 worked OK for me on my spectre/windows but it was noticeably slugglish compared to linux/mac/nixos running the same commands

even using virtualbox ubuntu or something and running nix-shell inside there was faster for me than WSL2 - take this all with a grain of salt though because i was using an early developer preview of WSL2 and didn’t spend any time looking into performance optimisations

I am running in WSL2 and I encountered the same problem.
A fix for me was to add a ~/.cargo/config file with the following content:

[net]
retry = 2                   # network retries
git-fetch-with-cli = true   # use the `git` executable for git

Possibly cargo git libraries don’t play nice with WSL2 (or the other way around)

1 Like

I have tried this without success. It does appear that there may be a fix on the rust side in v 1.42, but nix-shell seems to be on rust 1.41.

What would it take to get rust updated to a newer version within nix-shell?

same issue here, any help?

It works for me when not using nix-shell. I have installed Rust and the toolchains on my own in WSL2.

Ok so I was using my notebook casually instead my PC, so I followed the guide

And, casually, this time I payed attention to the WSL v2 and to using ubuntu shell instead unix shell

I installed it successful

after not using it in a while my spectre no longer boots to windows

i hope that wasn’t the result of something to do with using developer mode :frowning:

either way, the RSM version of holochain has waaaay fewer dependencies and uses stable rust rather than nightly, so it’s much easier to do what @ddd-mtl is doing and avoid nix-shell than it used to be