mintty / wsltty

Mintty as a terminal for Bash on Ubuntu on Windows / WSL
Other
3.12k stars 104 forks source link

wsltty exits immediately after Windows 11 update KB5032190 #343

Closed analytic-garden closed 1 year ago

analytic-garden commented 1 year ago

wsltty 3.7.0 starts and immediately exits with no error message. wsltty worked prior to latest Windows update.

Launching C:\Users\bbth\AppData\Local\wsltty\bin\mintty.exe produces the following message: /bin/bash: Exit 126. Failed to run '/bin/bash': No such file or directory

/bin/bash exists.

Launching wsl from Windows terminal works. Launching other terminal programs such as Gnome-terminal or xfce4-terminal work under WSL.

Windows info Windows 11 Pro Version 10.0.22631 Build 22631 2023-11 Cumulative Update for Windows 11 Version 23H2 for x64-based Systems (KB5032190)

PS C:\Users\bbth> wsl --version WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.2715

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

mintty commented 1 year ago

Possibly duplicate of #342. What does wsl -l -v say? Please try to change one WSL distribution to WSL 1 and test it.

gvl2023 commented 1 year ago

Same issue.

C:\Users\zzz>wsl --version WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.2283

C:\Users\zzz>wsl -l -v NAME STATE VERSION

analytic-garden commented 1 year ago

PS C:\Users\bbth> wsl -l -v NAME STATE VERSION

analytic-garden commented 1 year ago

In addition, running C:\Users\bbth\AppData\Local\wsltty\bin\mintty.exe --WSL=Ubuntu --configdir="C:\Users\bbth\AppData\Roaming\wsltty" -~ -h always -

opens a window with the following text:

/bin/wslbridge2: Exit 1. r process.

haard commented 1 year ago

Same,

C:\Users\xxx>wsl --version
WSL-version: 2.0.9.0
Kernelversion: 5.15.133.1-1
WSLg-version: 1.0.59
MSRDC-version: 1.2.4677
Direct3D-version: 1.611.1-81528511
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-version: 10.0.22621.2715

C:\Users\xxx>wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu-20.04           Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2

Emacs28 runs happily, and runs /bin/bash in ansi-term.

mintty commented 1 year ago

C:\Users\xxx>wsl -l -v NAME STATE VERSION

  • Ubuntu-20.04 Running 2

What I meant above is: please try wsl --set-version Ubuntu-20.04 1

tanminivan commented 1 year ago

Forcing WSLv1 allows wsltty to run again without issue for me.

More details, hopefully this helps for troubleshooting:

I have a similar issue, although I do not appear to have KB5032190 installed. In fact, I am on Windows 10, version 22H2. wsltty had been working just fine until this morning. The only Windows update patch that I see was recently installed is KB4023057, aside from Microsoft Defender updates. I am using wsltty 3.7.0.

Executing wslbridge2.exe shows this message which looks similar to analytic-garden's previous comment, just not trimmed:

C:\Users\xxx\AppData\Local\wsltty\bin>wslbridge2.exe
ERROR: GetVmId:294: CreateLxProcess: The process cannot access the file because it is being used by another process.

This is with WSLv2:

C:\Users\xxx>wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2

WSL version:

C:\Users\xxx\AppData\Local\wsltty\bin>wsl --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3570
gvl2023 commented 1 year ago

One other oddity, which may or may not be related, my hand-crafted /etc/resolv.conf was obliterated at the same time wsltty issues started. I had previously configured WSL to not generate this file on startup, which it did not, so I ended up with no /etc/resolv.conf at all.

mintty commented 1 year ago

I've added a hint to use WSL V1 to the project page.

xuefer commented 1 year ago
/bin/wslbridge2: Exit 1.
it is being used by another process.
pnetherwood commented 1 year ago

Recntly I've been getting the following error launching wslbridge.exe:

ERROR: ComInit:83: CoCreateInstance: The supplied kernel information version is invalid.

WSL Version:

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2506

I think it might be down to KB5031455 Windows update as WSLtty still works ok on another machine without this update.

Windows version:

OS Name:                   Microsoft Windows 11 Business
OS Version:                10.0.22621 N/A Build 22621
mikelue commented 1 year ago

I have same issue(have tried WSLTTY 3.6.5 or 3.7.0).

I try to start wslbridge2.exe and got following error message:

For state of WSL instance is Stopped

note: wsl.exe output: Failed to attach disk 'C:\WSL\Ubuntu\ext4.vhdx' to WSL2: The process cannot access the file because it is being used by another process.
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION

For state of WSL instance is Running

ERROR: GetVmId:294: CreateLxProcess: The process cannot access the file because it is being used by another process.

If the state is Stopped, but you got ...CreateLxProcess... error, try to close process by task manager.


My WSL Version:

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2715

WSL: 1.2.5.0 is working. WSL: 1.3.17.0 is working.

You can download WSL releases release for older version.

ktabata commented 1 year ago

Hello! Downgrading WSL to 1.3.17.0 worked for me. Reinstallation of Windows11 was needed, though. Thank you very much for your useful information @mikelue !

The implementation of COM API CreateLxProcess() seems aparently changed. We need to modify this code https://github.com/Biswa96/wslbridge2/blob/master/src/GetVmId.cpp#L227

Satanepigone commented 1 year ago

same issue here with WSL v2

ghost commented 1 year ago

I have the same issue with WSL v2

ERROR: ComInit:83: CoCreateInstance: 提供されたカーネル情報のバージョンが無効です。

which should be the same (japanese) message as "The supplied kernel information version is invalid" in https://github.com/mintty/wsltty/issues/343#issuecomment-1814624947

WSL バージョン: 2.0.9.0
カーネル バージョン: 5.15.133.1-1
WSLg バージョン: 1.0.59
MSRDC バージョン: 1.2.4677
Direct3D バージョン: 1.611.1-81528511
DXCore バージョン: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows バージョン: 10.0.22631.2715

which also should be the same versions as in https://github.com/mintty/wsltty/issues/343#issuecomment-1814624947

analytic-garden commented 1 year ago

I have a Cygwin terminal installed. It is mintty 3.1.0. It works with WSL2.

MaxwellWibert commented 1 year ago

Same issue here with Ubuntu 20.04.6 LTS on WSL v2. Downgrading to WSL v1 is kind of a non-starter for me. I have little choice but to go with another terminal until such time as this one is fixed (which is unfortunate as this is my favorite WSL terminal by a country mile!)

ktabata commented 1 year ago

@MaxwellWibert You don't have to downgrade to WSL1. We mean that WSL2 v1.3 works well. The following are the steps:

bluddy commented 1 year ago

As a user who prefers wsltty to other terminals, there's no way I'm messing with WSL to keep wsltty. I'll have to learn to deal with another terminal until you guys can fix the problem.

ktabata commented 1 year ago

I'm not a developer of wsltty, just a heavy user of it. I just needed a workaround because I can't work without Emacs on wsltty. To fix wslbridge2, a developer would have to receive information from Microsoft about the undocumented API CreateLXProcess(). There is another way to do it, which is to analyze the COM binary, but I shouldn't write about it here. To me, the current version of wsltty is more valuable than the latest WSL2 v2.0.

mintty commented 1 year ago

Thanks for pointing out the 1.3.17 release as a workaround, I've updated the project page to reflect this.

For an adaptation (which I wouldn't call a fix as it's not really broken, rather Windows API documentation is broken), I don't know what @Biswa96 likes to do; my approach would be to go without any specific Windows functions instead.

bluddy commented 1 year ago

I'm not a developer of wsltty, just a heavy user of it. I just needed a workaround because I can't work without Emacs on wsltty. To fix wslbridge2, a developer would have to receive information from Microsoft about the undocumented API CreateLXProcess(). There is another way to do it, which is to analyze the COM binary, but I shouldn't write about it here. To me, the current version of wsltty is more valuable than the latest WSL2 v2.0.

That's fine for now, but this is not a long-term solution, since WSL is deeply tied into Windows and MS does global updates. We can't get stuck on any particular version of WSL.

kafkafuura commented 1 year ago

My current workaround to use WSL2 with mintty is to run 'mintty -e wsl &' from an existing cygwin installation — this works without wslbridge, though I am not sure if there is a performance hit using this method.

mintty commented 1 year ago

Running mintty wsl imposes functional limitations on the terminal, see https://github.com/mintty/wsltty/issues/342#issuecomment-1815352190

hori87 commented 1 year ago

Thx to @kafkafuura. I decided to use 'mintty -e wsl' as a workaround after trying Tabby and Windows Terminal. Then I realized the output of 'duf' command is colored on mintty which was not in color on wsltty. Using mintty 3.7.0 for both cases.

mintty commented 1 year ago

What is duf?

Biswa96 commented 1 year ago

What is duf?

https://github.com/muesli/duf

Biswa96 commented 1 year ago

Apology for late reply to this issue. I have added a fix here https://github.com/Biswa96/wslbridge2/commit/fe0e75a08fb479f994ee73d4b4bf5f9c98c2dd88

I shall re-check things further and make a release quickly. Feel free to ping me, I forgot this issue.

yamam commented 1 year ago

I built wslbridge2 with cygwin and placed it in the wsltty bin folder and now wsltty starts.

l1n3n01z commented 1 year ago

I built wslbridge2 with cygwin and placed it in the wsltty bin folder and now wsltty starts.

I did the same and it works for me too.

For cygwin you will need to install gcc-g++ and make. The correct headers for winapi will be installed during setup of gcc

xuefer commented 1 year ago

i wish the github workflow use cygwin for building

Biswa96 commented 1 year ago

i wish the github workflow use cygwin for building

Yes, I agree and shall add that also.

Biswa96 commented 1 year ago

i wish the github workflow use cygwin for building

@xuefer Here is the first nightly build of wslbridge2 compiled in cygwin https://github.com/Biswa96/wslbridge2/actions/runs/6954957979

ktabata commented 1 year ago

@Biswa96 I've confirmed that the nightly works perfectly with WSL2 2.0.9.0 on Windows 11. Thank you very much for your hard work. Your patch really made my day!

xuefer commented 1 year ago

i wish the github workflow use cygwin for building

@xuefer Here is the first nightly build of wslbridge2 compiled in cygwin https://github.com/Biswa96/wslbridge2/actions/runs/6954957979

Cool, good job. Nicely done. Everything's fine as far as i see

ElvenSpellmaker commented 1 year ago

FWIW it used to work pre the 23H2 with WSL 2.x, it's just since that update. I believe people have found the issues now, but as extra info typing wsl into a mintty terminal does work, so whatever wsltty is up to seems strange if it works in mintty.

EDIT: Is there any way to get mintty to start up as exec wsl? Then I wouldn't even need wsltty? Or is there something special about wsltty vs mintty?

mintty commented 1 year ago

See reference above to explain that wslbridge (as involved in wsltty) is a much better gateway to WSL than wsl.exe which limits terminal functionality. Was WSL 2.x introduced with 23H2? Anyway, as there is a workaround now, I'll release an update as soon as there's a new release of wslbridge2 (modulo a few days that I may be on travel...).

ElvenSpellmaker commented 1 year ago

See reference above to explain that wslbridge (as involved in wsltty) is a much better gateway to WSL than wsl.exe which limits terminal functionality. Was WSL 2.x introduced with 23H2? Anyway, as there is a workaround now, I'll release an update as soon as there's a new release of wslbridge2 (modulo a few days that I may be on travel...).

Was WSL 2.x introduced with 23H2?

Nope I've been running 2.x for ages on both Windows 10 and 11. WSL 1.x is not recommended by MS unless you have a specific use-case: https://learn.microsoft.com/en-us/windows/wsl/compare-versions#exceptions-for-using-wsl-1-rather-than-wsl-2

than wsl.exe which limits terminal functionality.

What terminal functionality does it limit out of interest? So far everything I've done with exec wsl runs perfectly fine in mintty, such as colours and title bar escape sequences.

xuefer commented 1 year ago

See reference above to explain that wslbridge (as involved in wsltty) is a much better gateway to WSL than wsl.exe which limits terminal functionality. Was WSL 2.x introduced with 23H2? Anyway, as there is a workaround now, I'll release an update as soon as there's a new release of wslbridge2 (modulo a few days that I may be on travel...).

Was WSL 2.x introduced with 23H2?

Nope I've been running 2.x for ages on both Windows 10 and 11. WSL 1.x is not recommended by MS unless you have a specific use-case: https://learn.microsoft.com/en-us/windows/wsl/compare-versions#exceptions-for-using-wsl-1-rather-than-wsl-2

i suppose @ktabata is right about "You don't have to downgrade to WSL1. We mean that WSL2 v1.3 works well.". which mean v1.3 is WSL2, the version number is confusing

So are you sure you're using WSL2 v2.x for ages?

when @mintty said "Was WSL 2.x introduced with 23H2" he meant WSL2 v2.x (instead of WSL2 v1.x)

than wsl.exe which limits terminal functionality.

What terminal functionality does it limit out of interest? So far everything I've done with exec wsl runs perfectly fine in mintty, such as colours and title bar escape sequences.

ElvenSpellmaker commented 1 year ago

@xuefer I'm not sure what you mean quite, but this is my output for wsl -l -v:

$ wsl -l -v
  NAME                    STATE           VERSION
* fedoraremix             Running         2
  rancher-desktop         Running         2
  rancher-desktop-data    Stopped         2

Are you saying there's a 2.x of WSL 2? Because I haven't changed anything and wsltty was working with VERSION as 2 before the 23H2 update, but now doesn't open with no message (the window closes immediately and no message is shown). I haven't run any wsl --update command for example for ages.

For completeness:

$ wsl --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2506

It's all very confusing!

I'm on Windows 11 and yet that says Windows 10.x? Seems like nothing here makes much sense. But if a fix is found and will be releaseed soon I'll continue to use exec wsl as it works for me.

But for me exec mintty works fine for the stuff I do day-to-day and has been my workaround since I noticed this as a bug (I just assumed I'd broken something somehwere and would look into it later, which turned out to be tonight).

xuefer commented 1 year ago

Are you saying there's a 2.x of WSL 2? Because I haven't changed anything and wsltty was working with VERSION as 2 before the 23H2 update, but now doesn't open with no message (the window closes immediately and no message is shown). I haven't run any wsl --update command for example for ages.

you're on 2.x of WSL 2 already. but what they said about "2.x" is not about "WSL2 vs WSL1", since you (and me) are confused when you mention https://learn.microsoft.com/en-us/windows/wsl/compare-versions#exceptions-for-using-wsl-1-rather-than-wsl-2 well, forget about it, since it's a little bit of off topic

about "default to exec wsl.exe" thing: you may try to copy wsl.exe as bash.exe (or sh.exe) and put it beside mintty.exe, or to ....\bin, the exact name and path depends on which variant version of mintty you're using, be it cygwin or msys2 assume itself (mintty) in different folder, finding /bin/bash (or /bin/sh)

ElvenSpellmaker commented 1 year ago

@xuefer Yeah it seems there's some confusion around all of this for sure 🙃

Biswa96 commented 1 year ago

Here is the new release of wslbridge2 https://github.com/Biswa96/wslbridge2/releases/tag/v0.12. The wslbridge2-cygwin can be drag-and-drop in existing wsltty installation.

mintty commented 1 year ago

Released 3.7.0.2.

CoeJoder commented 1 year ago

I fully uninstalled the old version, installed new version, but same issue. It crashes at startup

Biswa96 commented 1 year ago

What WSL version are you using? Does wsl.exe work?

CoeJoder commented 1 year ago

What WSL version are you using? Does wsl.exe work?

Yes I am able to run wsl.exe from the built-in terminal. C:\Users\CoeJoder>wsl --version WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.2715

mintty commented 1 year ago

And did you install wsltty 3.7.0.2 (released last night)?

KiKoS0 commented 1 year ago

I did install 3.7.0.2 as well and it's still occurring for me too. image

❯ wsl --version
Version WSL : 2.0.9.0
Version du noyau : 5.15.133.1-1
Version WSLg : 1.0.59
Version MSRDC : 1.2.4677
Version direct3D : 1.611.1-81528511
Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Version de Windows : 10.0.19045.3693
Biswa96 commented 1 year ago

It looks like a valid issue but I can not reproduce it in my system using latest Windows 11 and WSL 2.0.11.0. Have you tried the x86_64 wsltty installer? Do you have any setting in wsl.conf or .wslconfig file? Are you using docker for windows?