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

Unable to run exe from Gnome-Terminal #4148

Closed
karuboniru opened this issue Jun 15, 2019 · 8 comments
Closed

Unable to run exe from Gnome-Terminal #4148

karuboniru opened this issue Jun 15, 2019 · 8 comments
Assignees
Labels
bug interop wsl2 Issue/feature applies to WSL 2

Comments

@karuboniru
Copy link

karuboniru commented Jun 15, 2019

Your Windows build number:

18197.1000

What you're doing and what's happening:

When In Gnome-terminal (tilix had the same problem)

[yan@BOOK-Karuboniru ~]$ ipconfig.exe
<3>init: (217) ERROR: UtilConnectToInteropServer:270: connect failed 2
[yan@BOOK-Karuboniru ~]$

When In CMD.exe ----> run wsl.exe--->run something else

I can call exe programs normally

What's wrong / what should be happening instead:

I didn't test if it behaves the same in WSL1. I am using WSL 2

Calling exe should work fine even in Linux Terminal apps

log.zip

@karuboniru
Copy link
Author

I think I have found the reason. Different session gives different WSL_INTEROP, and those in Gnone-Terminal or some other gui terminal apps doesn't work.

If I export WSL_INTEROP in wsl started from cmd to Gnome-Terminal, everything works fine. If I do the opposite way, both will stop calling exe programs

@karuboniru
Copy link
Author

Actually if I start Gnome-terminal with
ubuntu1804.exe run "cd \"$(wslpath .)\"; source /home/yan/.profile; gnome-terminal"
I will found the wsl instance would have wrong WSL_INTEROP
but if I run ubuntu1804.exe first, and then gnome-terminal. Everything will work.

@karuboniru
Copy link
Author

karuboniru commented Jun 17, 2019

Found a solution:
add

if [ ! -e "$WSL_INTEROP" ]; then
	export WSL_INTEROP=/run/WSL/`ls /run/WSL/|awk 'NR==1{print}'`
fi

to ~/.bash_profile
and go to Edit -> Profile Preferences -> Title and Command tab check the "Run command as a login shell" option.
Gnome-terminal will work fine in this way.

@craigloewen-msft
Copy link
Member

Hi @karuboniru it seems like you have a solution to your issue! Thank you for your detective work, if everything is working please close out the issue. :)

@benhillis
Copy link
Member

@karuboniru - I wouldn't suggest that solution. I am working on a fix for this.

@benhillis benhillis added bug interop wsl2 Issue/feature applies to WSL 2 labels Jun 17, 2019
@benhillis benhillis self-assigned this Jun 17, 2019
@karuboniru
Copy link
Author

@karuboniru - I wouldn't suggest that solution. I am working on a fix for this.

Yes. My code "stole" a WSL_INTEROP socket randomly from /run/WSL/. and the socket may close before you exit your Terminal.

Maybe you can provide a persisting socket in next releases?

@elig0n
Copy link

elig0n commented Oct 20, 2020

I experience similar problem in TMUX but not outside it.

<3>init: (4919) ERROR: UtilConnectToInteropServer:300: connect failed 2

I have several _interop files under /run/WSL/. Setting $WSL_INTEROP to some of them would make my terminal hang while few others (mostly ones who show up in 'clean' wsl terminals outside of tmux) would proceed to execute windows .exe files normally.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug interop wsl2 Issue/feature applies to WSL 2
Projects
None yet
Development

No branches or pull requests

4 participants