localias icon indicating copy to clipboard operation
localias copied to clipboard

WSL2 networkingMode=mirrored localias fails to start

Open brandon-gibbs opened this issue 1 year ago • 8 comments

I was using mirrored mode to get some auth callback urls to work inside my windows browser, but I can no longer start localias when it is enabled.

The error I get when running localias start is error: panic: program bash failed with error(exit status 1)

I'm unsure how to get anymore debug logs at this time, but happy to help.

brandon-gibbs avatar Nov 22 '24 20:11 brandon-gibbs

Hey, thanks for writing in and letting me know. Localias runs a few different bash scripts — unfortunately I guess I'm not including stack traces in these errors 🤦 If you wouldn't mind, could you answer the following questions in as much detail as possible? It will help me debug even in the absence of a stacktrace. I appreciate your help!

  • What logs, if any, do you see when you run localias run, up to and including the failure message that causes the crash?
  • What version of Windows, and WSL2, are you using?
  • What linux installation are you using with WSL2?
  • Do you have any links or details or screenshots of how you've configured "mirrored mode"?

Separately, can you try running each of these commands in a bash shell, and let me know if each one succeeds or fails? I'm hoping that exactly one of them fails, which would give us a clear culprit.

ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
uname -a | grep -i 'microsoft' || echo ""
winetchosts=$(powershell.exe -c 'Write-Host (Resolve-Path $env:windir\System32\drivers\etc\hosts)' </dev/null)
cat "$(wslpath -u "$winetchosts")"

peterldowns avatar Dec 10 '24 17:12 peterldowns

I'm not OP, but I'm also trying to use localias with WSL mirrored network mode. Here's what I'm seeing:

What logs, if any, do you see when you run localias run, up to and including the failure message that causes the crash?

This is everything that localias run prints: error: panic: program bash failed with error(exit status 1)

What version of Windows, and WSL2, are you using?

wsl --version
WSL version: 2.4.11.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5716
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.3194

Not sure why the Windows version says 10, I'm on Windows 11 24H2.

What linux installation are you using with WSL2?

Ubuntu 24.04 installed from the MS Store.

wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-24.04    Running         2

Do you have any links or details or screenshots of how you've configured "mirrored mode"?

I configured mirrored mode in my .wslconfig file:

# Settings apply across all Linux distros running on WSL 2
[wsl2]
networkingMode=mirrored

# Enable experimental features
[experimental]
sparseVhd=true
autoMemoryReclaim=dropcache

I got that from this page: https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking.

jerivas avatar Feb 24 '25 19:02 jerivas

And the output of the requested commands:

$ ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'

$ uname -a | grep -i 'microsoft' || echo ""
Linux Legion-5 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ winetchosts=$(powershell.exe -c 'Write-Host (Resolve-Path $env:windir\System32\drivers\etc\hosts)' </dev/null)
cat "$(wslpath -u "$winetchosts")"
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost

jerivas avatar Feb 24 '25 19:02 jerivas

@jerivas very interesting, thank you — can you show me what happens when you run these commands in a bash shell, in exactly this order, one line at a time? I think this command is the one that's failing, so i want to understand which part is failing and what the exit codes are.

ip addr show eth0
echo $?
ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
echo $?

peterldowns avatar Feb 24 '25 19:02 peterldowns

@jerivas bump, would be great to have your help to repro the issue!

peterldowns avatar Jul 14 '25 20:07 peterldowns

Hi, I have issue where I also have mirrored mode but I cannot connect to any urls I set in localias. Here is my output for running those commands:


~
> ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
100.98.19.20

~
> uname -a | grep -i 'microsoft' || echo ""
Linux butt 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

~
> winetchosts=$(powershell.exe -c 'Write-Host (Resolve-Path $env:windir\System32\drivers\etc\hosts)' </dev/null)
cat "$(wslpath -u "$winetchosts")"
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
# Added by Docker Desktop
192.168.0.102 host.docker.internal
192.168.0.102 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
100.98.19.20    mehadrin.charidy.local  #{"controller":"localias"}
# TailscaleHostsSectionStart
# This section contains MagicDNS entries for Tailscale.
# Do not edit this section manually.

100.64.180.30 butt-1.llama-alsephina.ts.net. butt-1
100.98.19.20 butt.llama-alsephina.ts.net. butt
100.95.70.7 donate2charidycom.llama-alsephina.ts.net. donate2charidycom
100.105.132.26 iphone-15-pro-max.llama-alsephina.ts.net. iphone-15-pro-max
100.113.122.85 macbook-pro---andrii.llama-alsephina.ts.net. macbook-pro---andrii
100.82.15.29 steamdeck.llama-alsephina.ts.net. steamdeck

# TailscaleHostsSectionEnd
100.98.19.20    charidy.local   #{"controller":"localias"}

~
> ip addr show eth0
echo $?
ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
echo $?
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:b8:1a:d2 brd ff:ff:ff:ff:ff:ff
    inet 100.98.19.20/32 brd 100.98.19.20 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fd7a:115c:a1e0::c632:1314/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::274e:7ce0:a8f3:825d/64 scope link nodad noprefixroute
       valid_lft forever preferred_lft forever
0
100.98.19.20
0

Reidond avatar Oct 14 '25 13:10 Reidond

@Reidond interesting, thanks for sharing. Can you please answer the other questions I asked above as well?

  • What logs, if any, do you see when you run localias run, up to and including the failure message that causes the crash?
  • What version of Windows, and WSL2, are you using? (wsl --version)
  • What linux installation are you using with WSL2? (wsl -l -v)
    • I see your uname output is Linux butt 6.6.87.2-microsoft-standard-WSL2, uhh what is that?
  • Do you have any links or details or screenshots of how you've configured "mirrored mode"?

peterldowns avatar Nov 03 '25 16:11 peterldowns

I almost certainly will never solve this problem myself (don't use windows anymore) but would happily accept fixes from anyone who does.

peterldowns avatar Nov 03 '25 16:11 peterldowns