Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open Windows app from WSL 2 anymore #4567

Closed
chickyd3v opened this issue Oct 4, 2019 · 31 comments
Closed

Can't open Windows app from WSL 2 anymore #4567

chickyd3v opened this issue Oct 4, 2019 · 31 comments

Comments

@chickyd3v
Copy link

  • Your Windows build number: [Version 10.0.18990.1]

  • What you're doing and what's happening:
    Not sure when but I think after I moved WSL 2 to another drive using LxRunOffline, I couldn't open any Windows app from WSL bash anymore. This error would appears everytime I tried to open .exe app:

explorer.exe .
command not found: explorer.exe
/mnt/c/Windows/explorer.exe .
run-detectors: unable to find an interpreter for /mnt/c/Windows/explorer.exe
  • What's wrong / what should be happening instead:
    EXE apps should runs flawlessly.
@alexkubica
Copy link

I've noticed that dir does work (should be a windows software too) and it's located in /bin which I'm not sure where it's mounted from.

@chickyd3v
Copy link
Author

I've noticed that dir does work (should be a windows software too) and it's located in /bin which I'm not sure where it's mounted from.

dir works for me too.

@penavincent
Copy link

penavincent commented Oct 4, 2019

I encountered this error previously, although I didn't move my WSL2 to another drive.

Have you tried runing wsl --shutdown on powershell then starting WSL2 again? This was the workaround when I had the issue about a month ago.

@chickyd3v
Copy link
Author

I encountered this error previously, although I didn't move my WSL2 to another drive.

Have you tried runing wsl --shutdown on powershell then starting WSL2 again? This was the workaround when I had the issue about a month ago.

Yes, without any lucks :(

@benhillis
Copy link
Member

benhillis commented Oct 7, 2019

What is the contents of your $PATH environment variable? Can you share the output of

cat /proc/self/mountinfo

@chickyd3v
Copy link
Author

chickyd3v commented Oct 8, 2019

What is the contents of your $PATH environment variable? Can you share the output of

cat /proc/self/mountinfo
Yes

~ cat /proc/self/mountinfo


103 96 8:0 / / rw,relatime shared:3 - ext4 /dev/sda rw,discard,errors=remount-ro,data=ordered
104 103 0:18 /init /init ro,relatime shared:4 - 9p tools ro,dirsync,aname=tools;fmask=022,loose,access=client,trans=fd,rfd=6,wfd=6
105 103 0:6 / /dev rw,nosuid,relatime shared:5 - devtmpfs none rw,size=3042976k,nr_inodes=760744,mode=755
106 105 0:22 / /dev/pts rw,nosuid,noexec,noatime shared:6 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
107 103 0:16 / /sys rw,nosuid,nodev,noexec,noatime shared:7 - sysfs sysfs rw
108 107 0:27 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:8 - tmpfs tmpfs ro,mode=755
109 108 0:28 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:9 - cgroup2 cgroup2 rw,nsdelegate
110 108 0:29 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,cpuset
111 108 0:30 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,cpu
112 108 0:31 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,cpuacct
113 108 0:32 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,blkio
114 108 0:33 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,memory
115 108 0:34 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,devices
116 108 0:35 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,freezer
117 108 0:36 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,net_cls
118 108 0:37 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,perf_event
119 108 0:38 / /sys/fs/cgroup/net_prio rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,net_prio
120 108 0:39 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:20 - cgroup cgroup rw,hugetlb
121 108 0:40 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:21 - cgroup cgroup rw,pids
122 108 0:41 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime shared:22 - cgroup cgroup rw,rdma
123 103 0:21 / /proc rw,nosuid,nodev,noexec,noatime shared:25 - proc proc rw
124 123 0:19 / /proc/sys/fs/binfmt_misc rw,relatime shared:26 - binfmt_misc binfmt_misc rw
125 103 0:23 / /run rw,nosuid,noexec,noatime shared:28 - tmpfs none rw,mode=755
126 125 0:24 / /run/lock rw,nosuid,nodev,noexec,noatime shared:29 - tmpfs none rw
127 125 0:25 / /run/shm rw,nosuid,nodev,noatime shared:30 - tmpfs none rw
128 125 0:26 / /run/user rw,nosuid,nodev,noexec,noatime shared:31 - tmpfs none rw,mode=755
129 103 0:42 / /mnt/c rw,noatime shared:32 - 9p C:\134 rw,sync,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;symlinkroot=/mnt/,access=client,msize=65536,trans=fd,rfd=8,wfd=8
130 103 0:43 / /mnt/d rw,noatime shared:33 - 9p D:\134 rw,sync,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;symlinkroot=/mnt/,access=client,msize=65536,trans=fd,rfd=8,wfd=8
131 103 0:44 / /mnt/e rw,noatime shared:34 - 9p E:\134 rw,sync,dirsync,aname=drvfs;path=E:\;uid=1000;gid=1000;symlinkroot=/mnt/,access=client,msize=65536,trans=fd,rfd=8,wfd=8
132 103 0:23 /hostname-wsl /etc/hostname rw,nosuid,noexec,noatime shared:35 - tmpfs none rw,mode=755
134 123 0:45 / /proc rw,nosuid,nodev,noexec,relatime shared:27 - proc proc rw
135 108 0:46 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:23 - cgroup cgroup rw,xattr,name=systemd
136 107 0:47 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:24 - bpf bpf rw,mode=700
137 134 0:48 / /proc/sys/fs/binfmt_misc rw,relatime shared:36 - autofs systemd-1 rw,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14173
138 105 0:20 / /dev/mqueue rw,relatime shared:37 - mqueue mqueue rw
139 105 0:49 / /dev/hugepages rw,relatime shared:38 - hugetlbfs hugetlbfs rw,pagesize=2M
140 107 0:7 / /sys/kernel/debug rw,relatime shared:39 - debugfs debugfs rw
141 107 0:50 / /sys/fs/fuse/connections rw,relatime shared:40 - fusectl fusectl rw
225 137 0:19 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime shared:79 - binfmt_misc binfmt_misc rw
709 128 0:55 / /run/user/1000 rw,nosuid,nodev,relatime shared:332 - tmpfs tmpfs rw,size=609100k,mode=700,uid=1000,gid=1000

Also my $PATH:

echo $PATH
/home/chickyd3v/.magento-cloud/bin:/home/chickyd3v/go/bin:/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/chickyd3v/phpstorm/jre64/bin:/var/www/parallel-phpunit/bin

@benhillis
Copy link
Member

@chickyd3v - your path does not contain the Windows paths. Likely /etc/profile is overriding it.

@homotechsual
Copy link

I've noticed that dir does work (should be a windows software too) and it's located in /bin which I'm not sure where it's mounted from.

dir works for me too.

dir works because it is it's own Linux command, part of coreutils.

@ghost ghost added the no-recent-activity label Oct 25, 2019
@ghost
Copy link

ghost commented Oct 25, 2019

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. Thank you for your contributions to WSL!

@saikrishnav
Copy link
Member

I am facing the same issue on my WSL2 instance. it was working before, suddenly it stopped working with this error. i am trying to launch VS Code.

@saikrishnav
Copy link
Member

After doing "wsl --shutdown" and starting WSL again - it started working.

@ghost ghost closed this as completed Nov 5, 2019
@sharpninja
Copy link

Please re-open. I am having the same problem and doing wsl --shutdown does not help.

@onomatopellan
Copy link

@sharpninja What does it show when you enter this in terminal?

echo $PATH

@maxidela
Copy link

Im also having the same problem. wsl --shutdown is not working for me

@grogzoid
Copy link

grogzoid commented Jun 20, 2020

I have the a similar problem: wsl --shutdown does not fix it. Tested windows executables are in my path (code.exe, notepad.exe)

~$ code
run-detectors: unable to find an interpreter for /mnt/c/Users/gfinn/AppData/Local/Programs/Microsoft VS Code/Code.exe
~$ which code
/mnt/c/Users/gfinn/AppData/Local/Programs/Microsoft VS Code/bin/code

Maybe the contents of /proc/sys/fs/binfmt_misc/WSLInterop are relevant:

~$ cat /proc/sys/fs/binfmt_misc/WSLInterop
enabled
interpreter /tools/init
flags: F
offset 0
magic 4d5a

/tools/init does not exist
instead, init is in /
trying a cheap hack of creating /tools and symlinking to /init , or copying /init to /tools did not help.

@grogzoid
Copy link

Here's my /proc/self/mountinfo:

~$ cat /proc/self/mountinfo
110 101 8:16 / / rw,relatime shared:2 - ext4 /dev/sdb rw,discard,errors=remount-ro,data=ordered
111 110 0:20 /init /init ro,relatime shared:3 - 9p tools ro,dirsync,aname=tools;fmask=022,loose,access=client,trans=fd,rfd=6,wfd=6
112 110 0:6 / /dev rw,nosuid,relatime shared:4 - devtmpfs none rw,size=6528676k,nr_inodes=1632169,mode=755
113 112 0:24 / /dev/pts rw,nosuid,noexec,noatime shared:5 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
114 110 0:16 / /sys rw,nosuid,nodev,noexec,noatime shared:6 - sysfs sysfs rw
115 114 0:29 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:7 - tmpfs tmpfs ro,mode=755
116 115 0:30 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:8 - cgroup2 cgroup2 rw
117 115 0:31 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,cpuset
118 115 0:32 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,cpu
119 115 0:33 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,cpuacct
120 115 0:34 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,blkio
121 115 0:18 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,memory
122 115 0:35 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,devices
123 115 0:36 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,freezer
124 115 0:37 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,net_cls
125 115 0:38 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,perf_event
126 115 0:39 / /sys/fs/cgroup/net_prio rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,net_prio
127 115 0:40 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,hugetlb
128 115 0:41 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:20 - cgroup cgroup rw,pids
129 115 0:42 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime shared:21 - cgroup cgroup rw,rdma
130 110 0:23 / /proc rw,nosuid,nodev,noexec,noatime shared:23 - proc proc rw
131 130 0:21 / /proc/sys/fs/binfmt_misc rw,relatime shared:24 - binfmt_misc binfmt_misc rw
132 110 0:25 / /run rw,nosuid,noexec,noatime shared:26 - tmpfs none rw,mode=755
133 132 0:26 / /run/lock rw,nosuid,nodev,noexec,noatime shared:27 - tmpfs none rw
134 132 0:27 / /run/shm rw,nosuid,nodev,noatime shared:28 - tmpfs none rw
135 132 0:28 / /run/user rw,nosuid,nodev,noexec,noatime shared:29 - tmpfs none rw,mode=755
136 110 0:19 / /mnt/wsl rw,relatime shared:30 - tmpfs tmpfs rw
137 110 0:43 / /mnt/c rw,noatime shared:31 - 9p C:\134 rw,dirsync,aname=drvfs;path=C:;uid=0;gid=0;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=10,wfd=10
139 130 0:44 / /proc rw,nosuid,nodev,noexec,relatime shared:25 - proc proc rw
140 115 0:45 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:22 - cgroup cgroup rw,xattr,name=systemd
141 139 0:46 / /proc/sys/fs/binfmt_misc rw,relatime shared:32 - autofs systemd-1 rw,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=2152
142 112 0:47 / /dev/hugepages rw,relatime shared:33 - hugetlbfs hugetlbfs rw,pagesize=2M
143 112 0:22 / /dev/mqueue rw,relatime shared:34 - mqueue mqueue rw
144 114 0:7 / /sys/kernel/debug rw,relatime shared:35 - debugfs debugfs rw
145 114 0:48 / /sys/fs/fuse/connections rw,relatime shared:36 - fusectl fusectl rw
467 141 0:21 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime shared:37 - binfmt_misc binfmt_misc rw
199 110 0:53 / /var/lib/lxcfs rw,nosuid,nodev,relatime shared:143 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other

@LBates2000
Copy link

Also having the same issue, and no /tools/init.

@iarunpaul
Copy link

having the same problem here...
please revert if any solutions yet...
:~$ cat /proc/self/mountinfo
105 97 8:16 / / rw,relatime - ext4 /dev/sdb rw,discard,errors=remount-ro,data=ordered
106 105 0:18 /init /init ro,relatime - 9p tools ro,dirsync,aname=tools;fmask=022,loose,access=client,trans=fd,rfd=6,wfd=6
107 105 0:6 / /dev rw,nosuid,relatime - devtmpfs none rw,size=2011484k,nr_inodes=502871,mode=755
108 107 0:22 / /dev/pts rw,nosuid,noexec,noatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
109 105 0:16 / /sys rw,nosuid,nodev,noexec,noatime - sysfs sysfs rw
110 109 0:27 / /sys/fs/cgroup ro,nosuid,nodev,noexec - tmpfs tmpfs ro,mode=755
111 110 0:28 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime - cgroup2 cgroup2 rw,nsdelegate
112 110 0:29 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
113 110 0:30 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
114 110 0:31 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
115 110 0:32 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
116 110 0:33 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
117 110 0:34 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
118 110 0:35 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
119 110 0:36 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
120 110 0:37 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,perf_event
121 110 0:38 / /sys/fs/cgroup/net_prio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_prio
122 110 0:39 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,hugetlb
123 110 0:40 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,pids
124 110 0:41 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,rdma
125 105 0:21 / /proc rw,nosuid,nodev,noexec,noatime - proc proc rw
126 125 0:19 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc binfmt_misc rw
127 105 0:23 / /run rw,nosuid,noexec,noatime - tmpfs none rw,mode=755
128 127 0:24 / /run/lock rw,nosuid,nodev,noexec,noatime - tmpfs none rw
129 127 0:25 / /run/shm rw,nosuid,nodev,noatime - tmpfs none rw
130 127 0:26 / /run/user rw,nosuid,nodev,noexec,noatime - tmpfs none rw,mode=755
131 105 0:17 / /mnt/wsl rw,relatime - tmpfs tmpfs rw
132 105 0:42 / /mnt/c rw,noatime - 9p C:\134 rw,dirsync,aname=drvfs;path=C:;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8
134 125 0:43 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
135 134 0:19 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc binfmt_misc rw
136 110 0:44 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,xattr,name=systemd
137 109 0:7 / /sys/kernel/debug rw,relatime - debugfs debugfs rw
138 127 0:45 / /run/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
139 134 0:46 / /proc/fs/nfsd rw,relatime - nfsd nfsd rw
140 107 0:47 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw,pagesize=2M
141 107 0:20 / /dev/mqueue rw,relatime - mqueue mqueue rw
142 109 0:48 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
188 105 8:16 /snap /snap rw,relatime shared:2 - ext4 /dev/sdb rw,discard,errors=remount-ro,data=ordered
189 188 0:49 / /snap/heroku/3947 ro,nodev,relatime shared:3 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
190 188 0:50 / /snap/code-insiders/504 ro,nodev,relatime shared:4 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
191 188 0:51 / /snap/core/9665 ro,nodev,relatime shared:5 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
192 188 0:52 / /snap/core/9804 ro,nodev,relatime shared:6 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
341 130 0:54 / /run/user/1000 rw,nosuid,nodev,relatime - tmpfs tmpfs rw,size=402776k,mode=700,uid=1000,gid=1000

@iarunpaul
Copy link

:~$ file /bin/cp
/bin/cp: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9720743c3b9fbf61b6f38b7568c10a6dbed05a61, stripped

@iarunpaul
Copy link

Following an older installation steps inadvertently i had added
export DISPLAY="$(/sbin/ip route | awk '/default/ { print $3 }'):0" to ~/.bashrc
and sourced it
$ source ~/.bashrc
and when I ran into issues I removed that
But the issue persists and I don't know if it has something to do with it

@iarunpaul
Copy link

I had also installed some additional packages...
sudo apt-get install libgtk2.0-0 libxss1 libasound2
sudo dpkg -i <the_file_you_just_downloaded>.deb
sudo apt-get install -f

@kodsnutten
Copy link

kodsnutten commented Aug 25, 2020

I also ran into this problem (e.g. error message "run-detectors: unable to find an interpreter for /mnt/c/Windows/explorer.exe").

It turned out that my problem was that I installed nuget package manager in the wsl2-container, and nuget required mono-runtime, which registered another entry (named cli) with /proc/sys/fs/binfmt_misc .

I was able to confirm this by disabling the cli interpreter using the command:
sudo update-binfmts --disable cli

After that nuget did not work from within the wsl2 container, but I was able to start explorer.exe

@iarunpaul
Copy link

I also ran into this problem (e.g. error message "run-detectors: unable to find an interpreter for /mnt/c/Windows/explorer.exe").

It turned out that my problem was that I installed nuget package manager in the wsl2-container, and nuget required mono-runtime, which registered another entry (named cli) with /proc/sys/fs/binfmt_misc .

I was able to confirm this by disabling the cli interpreter using the command:
sudo update-binfmts --disable cli

After that nuget did not work from within the wsl2 container, but I was able to start explorer.exe

This worked for me!!

@sharpninja
Copy link

sharpninja commented Oct 21, 2020 via email

@ouamer-dahmani
Copy link

Hello!

I had a similar issue. After a bit of searching I checked /etc/wsl.conf and noticed that it only contained the following:

[interop]
appendWindowsPath = false

Setting it to true and then forcing a restart of wsl (wsl --shutdown) fixed it for me.

I can't figure what changed this though.

@wdzeng
Copy link

wdzeng commented Apr 22, 2021

This happened to me after I had

sudo apt install nuget -y

and

wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash

and some other simple operation using dotnet command without sudo. Not sure if either of the above two actions led to the problem. I tried to reproduce the scenario after rebooting WSL but nothing happened.

@terminaldweller
Copy link

terminaldweller commented Jun 10, 2021

This happened to me after i exported my wsl2 instance from drive C to an external SSD.

What fixed it for me was to run export WSL_INTEROP=/run/WSL/12_interop manually. please note that the 12_interop part could be different for you so choose the socket that is actually in /run/WSL.

@j1nxxn1j
Copy link

It should be caused by the conflict with systemd.

Please check the file /etc/wsl.conf and see if the systemd = true flag was added under [boot] settings as shown below. If so, please switch it to false.

Snipaste_2023-01-12_11-45-09

For more info, please refer to https://learn.microsoft.com/en-us/windows/wsl/wsl-config#per-distribution-configuration-options-with-wslconf

@EdwinLiavaa
Copy link

sudo update-binfmts --disable cli

This worked for me too

@rafaspimenta
Copy link

I also ran into this problem (e.g. error message "run-detectors: unable to find an interpreter for /mnt/c/Windows/explorer.exe").

It turned out that my problem was that I installed nuget package manager in the wsl2-container, and nuget required mono-runtime, which registered another entry (named cli) with /proc/sys/fs/binfmt_misc .

I was able to confirm this by disabling the cli interpreter using the command: sudo update-binfmts --disable cli

After that nuget did not work from within the wsl2 container, but I was able to start explorer.exe

That worked for me, but every time I restart my WSL I need to run this command again

@nam20485
Copy link

It should be caused by the conflict with systemd.

Please check the file /etc/wsl.conf and see if the systemd = true flag was added under [boot] settings as shown below. If so, please switch it to false.

Snipaste_2023-01-12_11-45-09

For more info, please refer to https://learn.microsoft.com/en-us/windows/wsl/wsl-config#per-distribution-configuration-options-with-wslconf

That's fine, I just set this property and I can set it back to false. But what if I want to actually enable systemd? Are they really mutually exclusive?

shaneharper added a commit to shaneharper/dotfiles that referenced this issue Nov 2, 2023
…mono-runtime is installed and systemd is enabled.

Trying to run "explorer.exe" from a WSL/Ubuntu command prompt, for example, would result in the following error:
    run-detectors: unable to find an interpreter for /mnt/c/Windows/explorer.exe

The fix was taken from microsoft/WSL#4567 (comment).

(I confirmed that the mono-runtime package added the cli entry that caused the problem by running "update-binfmts --display".)

I'd tried the following but they didn't work for me:
    microsoft/WSL#8843 (comment)   (Create /usr/lib/binfmt.d/WSLInterop.conf.)
    microsoft/WSL#8843 (comment)   (sudo systemctl mask systemd-binfmt.service)
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests