Closed rashil2000 closed 3 years ago
That is not correct. You can run e.g. cmd
within mintty. You can also start a mintty window with full WSL support: mintty --WSL=
, optionally selecting a WSL distribution with a parameter value.
You can also configure a WSL session launcher item into your context menu, see https://github.com/mintty/mintty/wiki/Tips#supporting-linuxposix-subsystems.
However, you'd need to install wslbridge2 into your system to make this work. I'll check whether to improve documentation on how to do this.
Mintty doesn't support running Windows commandline apps (like cmd, powershell).
mintty is a terminal emulator, so you can run any program there. But the question is will it work without any issue?
I use MSYS and the terminal Mintty that comes with it.
Do you mean msys2? If yes then you can run wsl.exe there. But before that, you have to set the global environment variable MSYS=enable_pcon
to enable ConPTY feature.
But ConPTY does not support all characters (e.g. ♥♦♣♠). So, there are programs like socat, ssh, wslbridge, wslbridge2 etc.
Hi!
So I tried running mintty --WSL=arch-linux
, but it threw the error Failed to run '/bin/wslbridge2': No such file or directory
.
However, you'd need to install wslbridge2 into your system to make this work.
You're right, how do I do this?
mintty is a terminal emulator, so you can run any program there. But the question is will it work without any issue?
Exactly my point, the programs are in PATH, so they will start, but the I/O would not be what we usually expect. Let me give some examples to show this:
mintty /c/Windows/System32/OpenSSH/ssh.exe azureuser@104.211.92.154
, notice the initial error Pseudo-terminal will not be allocated because stdin is not a terminal. Even the shell prompt isn't shown at all. The lower window is mintty /usr/bin/ssh azureuser@104.211.92.154
, which is working as expected.mintty /c/Windows/System32/cmd.exe
, lower is normal cmd.exe
. Here too the shell prompt is missing, and arrow keys are misbehaving:mintty /c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
, lower is normal powershell.exe
. Notice the explicit errors. Do you mean msys2? If yes then you can run wsl.exe there. But before that, you have to set the global environment variable MSYS=enable_pcon to enable ConPTY feature.
Setting the value to 'enable_pcon' seems to have solved the issue.
May I ask what additional stuff wslbridge is providing?
May I ask what additional stuff wslbridge is providing?
wslbridge and walbridge2 just grab the buffer from WSL side and spit it to Windows side and vice versa. No extra processing in-between. But ConPTY does some.
Is there a reason MSYS=enable_pcon is not set by default on MSys2/Mintty? Does it break some stuff?
You may ask them:) Actually, one reason might be this: Throughout cygwin 3.1.*, ConPTY support is enabled by default, not only for Windows programs, but always active, i.e. also for cygwin programs, which unfortunately has some performance impact on their terminal output. This shall be fixed with cygwin 3.2, with unknown release date though.
Does it break some stuff?
Yes, it breaks some stuff. Here is the commit in msys2 which makes the ConPTY feature as opt-in https://github.com/msys2/msys2-runtime/commit/22ba7ac08035c470a3927fa53805bcdcdfe5fc21. Also if you search conpty
in any msys2 packaging repository you could find related issues. Personally, I get some overlapping while building projects with mingw-w64-cmake in msys2/MINGW-packages.
Speaking of the actual question here, I have added a wslbridge2 release compiled with msys2 https://github.com/Biswa96/wslbridge2/releases. Just download, extract, run wslbridge2.exe in msys2. ConPTY is NOT required.
Does it break some stuff?
Yes, it breaks some stuff. Here is the commit in msys2 which makes the ConPTY feature as opt-in msys2/msys2-runtime@22ba7ac. Also if you search
conpty
in any msys2 packaging repository you could find related issues. Personally, I get some overlapping while building projects with mingw-w64-cmake in msys2/MINGW-packages.
Thanks for this. I noticed some issues with it too. Like, I ran mintty cmd
then opened up neovim, and it had registered some keystrokes by itself (see bottom)
Speaking of the actual question here, I have added a wslbridge2 release compiled with msys2 https://github.com/Biswa96/wslbridge2/releases. Just download, extract, run wslbridge2.exe in msys2. ConPTY is NOT required.
Sure, I'll check it out!
... run wslbridge2.exe in msys2.
Or copy the two wslbridge2 binaries (frontend and backend) into your /bin directory to enable full WSL-related feature support via mintty --WSL
.
... run wslbridge2.exe in msys2.
Or copy the two wslbridge2 binaries (frontend and backend) into your /bin directory to enable full WSL-related feature support via
mintty --WSL
.
That's what I did, thanks!
So should I close this now?
Actually, the mintty wiki already describes how to set up wslbridge2 to support launching WSL in mintty from cygwin or MSYS2: https://github.com/mintty/mintty/wiki/Tips#manual-setup-of-wsl-terminal
Just a quick unrelated question - this wsl bridge method works only for WSL, right? And not for linux systems through SSH?
Here is a direct quote from actual wslbridge's README:
wslbridge is a Cygwin program that allows connecting to the WSL command-line environment over TCP sockets, as with ssh, but without the overhead of configuring an SSH server.
Oh, okay, now it makes sense. Thanks!
For remote ssh, wslbridge2 is not needed; just run ssh.
I had this doubt because SSH from mintty was also problematic, before I set MSYS=enable_pcon
You can also configure ssh shortcuts for the context menu session launcher and also for the taskbar icon as described in the manual.
I've spent plenty of time customizing mintty (I absolutely love it for the sheer amount of SGR parameters it supports xD) - here's what I settled into:
Transparency=off
Font=RecMonoSemicasual NF
FontHeight=10
FontWeight=400
BoldAsFont=yes
BoldAsColour=no
Scrollbar=right
ConfirmExit=no
ThemeFile=google-light
Term=xterm-256color
BellType=0
TabBar=9
Icon=D:\Data\Pictures\Icons\bash.ico
SessionGeomSync=4
SessionCommands=Kali Linux:-i D:\Data\Pictures\Icons\kali-menu.ico wsl;Arch Linux:-i D:\Data\Pictures\Icons\archlinux.ico wsl -d arch-linux;Ubuntu - Azure:-i D:\Data\Pictures\Icons\ubuntuazure.ico ssh ubuntuazure;Ubuntu - OSBoxes:-i D:\Data\Pictures\Icons\Ubuntu.ico ssh ubuntuosboxes;
Columns=90
Rows=30
I'm considering to add an option to enforce enabling ConPTY support, for use in combination with your remote SessionCommands entries on MSYS2.
Yes, that might be helpful. One thing to note here is that I don't have OpenSSH installed on Msys2; the session commands here are using the ssh executable from Windows\System32 side.
Released 3.4.5.
Hi all!
Just wanted to follow up on this issue after this was posted: https://www.msys2.org/news/#2022-09-24-conpty-support-enabled-by-default
I still need to set MSYS=enable_pcon
explicitly in order to avoid the issues mentioned in the recordings above. What seems to be the issue here? Do I need some specific versions of some packages?
Just speculating: I guess the changed default is only applied on fresh installation. You might ask them whether it can be switched during update.
I guess the changed default is only applied on fresh installation.
Okay, I downloaded a fresh tar file of MSYS2, and it works fine there.
You might ask them whether it can be switched during update.
Where should I post this question?
You might ask them whether it can be switched during update.
Where should I post this question?
Don't know, look on their homepage.
I use MSYS and the terminal Mintty that comes with it. However, as is well known, Mintty doesn't support running Windows commandline apps (like cmd, powershell). So I can't launch WSL from inside Mintty.
Question is, will I need to download and install WSLtty separately for WSL? Is there a way I can configure my already-installed Mintty to run WSL (possibly by using scripts/files from this repository)?