wslbridge icon indicating copy to clipboard operation
wslbridge copied to clipboard

Does not work with WSL 2

Open myoung34 opened this issue 6 years ago • 22 comments

Was working perfectly, but just updated windows to the latest insider build for WSL 2 support

C:\Users\3vilp\ver

Microsoft Windows [Version 10.0.18917.1000]
C:\Users\3vilp\AppData\Local\wsltty\bin>wslbridge.exe
wslbridge error: failed to start backend process
note: backend error output: wslbridge-backend: wslbridge-backend.cc:45: int {anonymous}::connectSocket(int, const string&): Assertion `connectRet == 0' failed.

myoung34 avatar Jun 13 '19 15:06 myoung34

Are there any alternatives that work?

nightwolfz avatar Jul 28 '19 11:07 nightwolfz

If you want to test I've done something here: https://github.com/Biswa96/wslbridge2/releases

Biswa96 avatar Jul 28 '19 12:07 Biswa96

Would be friendlier to do a PR against wslbridge, making the minimal changes required to support the pty naming at runtime. Also supporting other Linux flavour ptys e.g. Fedora, SuSE, if different, would be nicer.

BrianInglis avatar Jul 28 '19 15:07 BrianInglis

A different error occur on WSL 2 with Windows 10 18945.1001.

C:\Users\brigh\AppData\Local\wsltty\bin>wslbridge
wslbridge error: failed to start backend process
note: backend error output: -v: -c: line 0: unexpected EOF while looking for matching `''
-v: -c: line 1: syntax error: unexpected end of file

AiOO avatar Jul 30 '19 10:07 AiOO

I've added another method hvpty in my wslbridge2 repository which uses Hyper-V sockets to connect with WSL2, can be used with mintty like terminals.

Biswa96 avatar Aug 14 '19 12:08 Biswa96

I've added another method hvpty in my wslbridge2 repository which uses Hyper-V sockets to connect with WSL2, can be used with mintty like terminals.

In my tests on latest Insider build, hvpty just exits without printing an error but rawpty wsl still works.

ismail avatar Aug 14 '19 13:08 ismail

Cygwin now has Windows ConPTY support. See this commit. Released in Cygwin 3.1.0-0.3 test build. So, wsl.exe and other Windows console programs can be executed directly in mintty, no need to use wslbridge or winpty related programs.

Biswa96 avatar Aug 30 '19 17:08 Biswa96

So, if mintty is running under Cygwin 3.1.0 or later and Windows supports WSL and a distro is to be launched:

  • if WSL 2 is supported and a distro is to be run which is configed to run under WSL 2,
  • the user login shell can be execed
  • instead of execing wslbridge-backend to fork the user login shell?

BrianInglis avatar Aug 30 '19 20:08 BrianInglis

I can not understand your query properly. In simple words, mintty becomes similar as CMD technically.

Biswa96 avatar Aug 31 '19 03:08 Biswa96

How should the specification for mintty read to run wsl now: under what conditions, and with which arguments, does mintty invoke wsl, to either skip wslbridge-backend or invoke wslbridge-backend?

BrianInglis avatar Sep 01 '19 03:09 BrianInglis

Theoratically, No backend, no extra code needed 🎉 Just type wsl.exe. One thing must be noted. The cygwin is now in test build so there are some issues.

Biswa96 avatar Sep 01 '19 03:09 Biswa96

BTW on build Microsoft Windows [Version 10.0.18975.1000] and for WSL1 I still get

wslbridge error: failed to start backend process
note: backend error output: -v: -c: line 0: unexpected EOF while looking for matching `''

it might be related to latest build changes.. is there any options to checkout logs or that backend output?

bullmastiffo avatar Sep 13 '19 18:09 bullmastiffo

Try this https://github.com/Biswa96/wslbridge2. See previous comments. Also this https://github.com/mintty/wsltty/issues/186

Biswa96 avatar Sep 13 '19 19:09 Biswa96

Apologies for my ignorance - I don't understand all of the puzzle-pieces well enough. How can I make conemu use wslbridge2? I'm currently on Windows Insider build 18980, and started hitting this problem a few builds back.

dseven avatar Sep 14 '19 20:09 dseven

@dseven Thank you for the question. I will add a detailed instructions in my repo and let you know.

Biswa96 avatar Sep 14 '19 20:09 Biswa96

I just ended up bypassing the WSL bridge. Tested on WSL 1 & 2.

set PATH="%ConEmuBaseDirShort%\wsl";%PATH% & wsl -d ubuntu -u lester -cur_console:t:"Ubuntu" -- boot.sh

The boot.sh I run is of course optional, and could be removed or replaced with some other command you want to run. I've just used one for a long time with ConEmu to instantiate ANSI support so my powerline and boot splash look puuuurdy (some of it is prob superfluous).

#!/bin/bash
cat /mnt/d/some/long/path/conemu-maximus5/ConEmu/boot.ans
cd ~
screenfetch
bash -l -i

LesterCovax avatar Dec 14 '19 09:12 LesterCovax

I tried that approach bypassing the WSL bridge but have to find out that it works quite laggy in some cases. I think this is related to reading directories and files. For example, I do the following sequence of actions (I am using oh-my-zsh):

  1. Type in vim p
  2. Press <Tab>
  3. See the following file list package.json, package-lock.json and pom.xml
  4. Press <Tab> to select package.json
  5. Press <Enter> to confirm the selection
  6. Press <Enter> to execute vim package.json
  7. Type :q to quit vim

In ConEmu there is a delay after actions 2, 4, 5, 6 and 7, which makes the work quite uncomfortable. In native WSL console, there is no noticeable delay. I am not sure though if that's somehow wslbridge related.

Smasherr avatar Mar 20 '20 12:03 Smasherr

@Smasherr - Might be related to rendering UTF/ANSI and screen redraws? I think there were some major changes around that on the Windows side. Have you tried it in the new MS Terminal app? Curious if it lags in that as well. I would personally enable debugging output to a log file, then run through those same steps. That way you'll be able to see the raw ANSI/etc that's being sent to the session, and any other silent errors/warnings that may be occurring.

LesterCovax avatar Mar 24 '20 19:03 LesterCovax

Apologies for my ignorance - I don't understand all of the puzzle-pieces well enough. How can I make conemu use wslbridge2? I'm currently on Windows Insider build 18980, and started hitting this problem a few builds back.

I still do not find any instructions on how to use wslbridge2 with conemu. I just updated to windows 2004 and now Conemu crashes per @AiOO comment above.

cyberis avatar Aug 23 '20 19:08 cyberis

For WSL 1 users (possibly WSL 2 but I don't know), I found a solution that seems to work pretty good. Similar to the answer posted by @LesterCovax, this bypasses the bridge, but it's less complicated. Now, it should be said, this is not my area of expertise and I figured this out with the help of someone in my group who is more savvy but, to my understanding, this uses the Windows terminal to access WSL instead of going through the bridge which seems to be a more efficient route anyway.

Instead of set PATH="%ConEmuBaseDirShort%\wsl..., use wsl.exe -new_console:d:C:\<path_you_want_to_default_to>.

I hope this helps.

hheavener-kyd avatar Sep 10 '20 19:09 hheavener-kyd

Fyi I started having this problem today on Windows 10.0.18363.1082 (aka release 1909).

Not quite sure how to implement hheavener-kyd's solution as I've been using wsltty. Screenshot: https://imgur.com/a/8Ughyan

agirardeau avatar Sep 11 '20 17:09 agirardeau

Fyi I started having this problem today on Windows 10.0.18363.1082 (aka release 1909).

Not quite sure how to implement hheavener-kyd's solution as I've been using wsltty. Screenshot: https://imgur.com/a/8Ughyan

Odd...my WSL terminal worked just fine but my Cmder-mini was throwing this error. I just plugged the value into the startup scripts for Cmder-mini and it worked. Like I said, though, not really my area of expertise unfortunately.

hheavener-kyd avatar Sep 11 '20 22:09 hheavener-kyd