Dfx on Windows WSL connection problems

Has anyone experienced problems with connecting to the running dfx instance on Windows/WSL?
The error message is this:

admin1@DESKTOP-9370AFP:~/.local/hpl$ dfx start --background --clean
Running dfx start for version 0.12.2-beta.0
Using the default definition for the 'local' shared network because /home/admin1/.config/dfx/networks.json does not exist.
Dashboard: http://localhost:55953/_/dashboard
admin1@DESKTOP-9370AFP:~/.local/hpl$ dfx canister create --all
Creating a wallet canister on the local network.
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `819200`,
 right: `0`: The page allocator was initialized with non-empty file', replicated_state/src/page_map/page_allocator/mmap.rs:399:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Sandbox pid 20822 for canister Some(CanisterId(rwlgt-iiaaa-aaaaa-aaaaa-cai)) exited unexpectedly with status Signaled(Pid(20822), SIGABRT, true)
Dec 20 13:14:07.945 ERRO s:c7yvh-xwfus-uqwzx-vicbi-vh42n-ny7dg-35huy-uso7d-gty74-2zz6p-kqe/n:g4epc-or6wh-bcqaj-44fzz-qztox-wblkc-aku4r-s4wio-rhppj-wbiq6-iae/ic_canister_sandbox_replica_controller/sandboxed_execution_controller History for canister rwlgt-iiaaa-aaaaa-aaaaa-cai with pid 20822: CreateExecutionState(wasm_id=wasm-id-0, next_wasm_memory_id=memory-id-0)
Dec 20 13:14:07.946 ERRO s:c7yvh-xwfus-uqwzx-vicbi-vh42n-ny7dg-35huy-uso7d-gty74-2zz6p-kqe/n:g4epc-or6wh-bcqaj-44fzz-qztox-wblkc-aku4r-s4wio-rhppj-wbiq6-iae/ic_canister_sandbox_replica_controller/sandboxed_execution_controller History for canister rwlgt-iiaaa-aaaaa-aaaaa-cai with pid 20822: OpenMemory(memory_id=memory-id-2)
Dec 20 13:14:07.946 ERRO s:c7yvh-xwfus-uqwzx-vicbi-vh42n-ny7dg-35huy-uso7d-gty74-2zz6p-kqe/n:g4epc-or6wh-bcqaj-44fzz-qztox-wblkc-aku4r-s4wio-rhppj-wbiq6-iae/ic_canister_sandbox_replica_controller/sandboxed_execution_controller History for canister rwlgt-iiaaa-aaaaa-aaaaa-cai with pid 20822: StartExecution(exec_id=exec-id-0 wasm_id=wasm-id-0 wasm_memory_id=memory-id-0 stable_member_id=memory-id-2 api_type=init, next_wasm_memory_id=memory-id-1 next_stable_memory_id=memory-id-3
thread '<unnamed>' panicked at 'Launcher detected sandbox exit', canister_sandbox/sandbox_launcher/src/lib.rs:121:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'Error from launcher process, pid 20749 exited due to signal!', canister_sandbox/replica_controller/src/sandboxed_execution_controller.rs:1430:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
version: 0.8.1
Error: Failed to get wallet canister caller for identity 'default' on network 'local'.
Caused by: Failed to get wallet canister caller for identity 'default' on network 'local'.
  Failed to get wallet for identity 'default' on network 'local'.
    Failed to create wallet for identity 'default' on network 'local'.
      Failed while installing wasm.
        The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "", content: Internal Server Error
admin1@DESKTOP-9370AFP:~/.local/hpl$  Dec 20 13:14:08.125 WARN Internal Error during request:
hyper::Error(
    Connect,
    ConnectError(
        "tcp connect error",
        Os {
            code: 111,
            kind: ConnectionRefused,
            message: "Connection refused",
        },
    ),
)
Stopping icx-proxy...
Stopped.

I wonder if the ports are accessible. Is telnet 127.0.0.1 4943 supposed to allow a connection when run in the VM? On this machine it isn’t and I am wondering if that can be related to the problem.

1 Like

I use WSL daily but havent run into this error

1 Like

I too run WSL and haven’t seen this error, but some thoughts…

  1. Could it be a new problem in dfx beta 0.12.2? I’m still on 0.12.1.
  2. You could try changing the default port by creating a dfx network configuration file at /home/<user>/.config/dfx/:
{
  "local": {
    "bind": "127.0.0.1:8080",
    "type": "ephemeral",
    "replica": {
      "subnet_type": "system"
    }
  }
}

I’ll ask the relevant folks to take a look at this post. Can you also let us know what version of WSL you’re running? Officially we only support WSL2, but I know that there’s a lot of problems even with that.

I’m on wsl2 (ubuntu 22) as well and I just upgraded to 0.12.2-beta-0 and if I run

gabriel@DESKTOP-8G906R5:~/projects/dragginz$ dfx start --clean 
Running dfx start for version 0.12.2-beta.0
Using the default definition for the 'local' shared network because /home/gabriel/.config/dfx/networks.json does not exist.
  Version v0.12.2-beta.0 installed successfully.
Dashboard: http://localhost:38033/_/dashboard

gabriel@DESKTOP-8G906R5:~/projects/dragginz$ dfx canister create --all
Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "default" is "rwlgt-iiaaa-aaaaa-aaaaa-cai"
Creating canister cdn...
cdn canister created with canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Creating canister content...
content canister created with canister id: ryjl3-tyaaa-aaaaa-aaaba-cai
Creating canister frontend...
frontend canister created with canister id: r7inp-6aaaa-aaaaa-aaabq-cai

Seems to be fine and I’m on port 4943.

The only issue I had was when I actually had a network key in dfx.json pointing to 4943 and yet I was still getting that tcp connect error Once I removed it, it worked.

Not a direct answer to the OP but my first venture into dfx under WSL2 came unstuck at some point. But this would have been a year ago. About 2 or 3 months ago I went through all the starter tutorials but this time in an Ubuntu VM on Windows 10 and it was fine.

Of course, it may have been had I retried WSL2 with the latest version of dfx at the time I’d have been fine too.

But I notice WSLg (the GUI support version) is now available on Win 10 22H2 (I’ve not tried it).