ConEmu build: 170807 x64
OS version: Windows 10.0.16299.x64
Used shell version: WSL
Right now WSL support seems to be limited to invoking the default distribution when using wslbridge and the cygwin/msys2 connector.
wslbridge supports a --distro-guid option to invoke a specific Distribution listed under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss. See rprichard/wslbridge#14
Can this be exposed on the connectors? Or more generally, is there be a way to passthrough arguments to wslbridge when invoking the connector?
Wondering what is the "better" way to use WSL: through wslbridge or simply invoking wsl.exe -new_console:pm:/mnt [{guid}] which seems to work out of the box? (And I guess the -new_console:p won't be needed after #1291 ?)
With wsl.exe, you get true login shell on the distribution of your choice, but broken console (colors, and possibly other things like resizing).
With the bridge you currently can't get a proper login shell, a non bash shell, nor selectable distribution.
@mhofman you can pass wslbridge its own arguments after the --wsl flag.
So if it's supported in wslbridge to launch a different distro, you can pass it its own arguments. You should ask here: https://github.com/rprichard/wslbridge
It does support it in the 0.24 version of wslbridge
After some some trial and error, I did finally figure it out. The trick was to add a - after the --wsl flag.
For anyone searching, I managed to get a Login shell through wslbridge, using a specific distribution.
Here is the full command line I used:
%ConEmuBaseDirShort%\conemu-msys2-64.exe --wsl -cur_console:pm:/mnt - -t --distro-guid {0302fe33-e328-413d-8520-077ab52d55ad} -- /bin/bash -i -l
@mhofman eh, how does that whole thing work? Why does -t get followed by --distro-guid, then --, then the shell and its arguments
Everything (except -new_console) after --wsl is passed directly to wslbridge, so I believe there are spare flags in the solution.
Anything after the first - is the args passed to wslbridge.exe. I had to include this, without it, the arguments were ingested by the connector itself, with it complaining of unknown args.
The -t is to get wslbridge to open a pty since we're executing a command.
Anything after the -- is the command executed by wslbridge-backend.
@mhofman you can put the current_console part at the very end and then you don't need all those dashes
I was not able to use solution above, was getting error about inability to run -
So I ended up modifying my wslbridge binary so it get distro guid from environment (I already had custom binary supporting docker compatible disks mounts anyway):
set "DISTROGUID={3d833ab2-222f-4e10-8ceb-d56423d90556}" & set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt
commit - https://github.com/isanych/wslbridge/commit/d51470cc08dc000a6c2c6537ea151811b7e0b77a
What was the error message?
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt - -t --distro-guid {3d833ab2-222f-4e10-8ceb-d56423d90556} -- /bin/bash -i -l
error: could not exec '-': No such file or directory
ConEmuC: Root process was alive less than 10 sec, ExitCode=0.
ConEmu 180506 [64] on Windows Server 2019 17650
Why do you pass this - as argument? Simple --distro-guid={3d833ab2-222f-4e10-8ceb-d56423d90556} is enough addition.
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl --distro-guid={3d833ab2-222f-4e10-8ceb-d56423d90556} -cur_console:pm:/mnt
yes, it is working like this. I was using command from comment above in thread and help
conemu-cyg-64.exe --help
ConEmu cygwin/msys connector version 1.2.5
Windows drive mount root: `/cygdrive`
Usage: conemu-cyg-64 [switches] [- | shell [shell switches]]
-?, -h, --help this help
-d, --dir <dir> chdir to `dir` before starting shell
forces `set CHERE_INVOKING=1`
-l, --log <dir> write console IN and OUT to files in `dir` folder
use current folder if <dir> is not specified`
-t <new-term> forces `set TERM=new-term`
--debug wait for debugger for 60 seconds
--environ print environment on startup
--isatty do isatty checks and print pts names
--keys read conin and print bare input
--shlvl forces `set SHLVL=1` to avoid terminal reset on exit
--verbose additional information during startup
--version print version of this tool
--wsl run wslbridge to start Bash on Ubuntu on Windows 10
Could not google other samples of usage distro-guid in conemu beside this issue.
--wsl --distro-guid={3d833ab2-222f-4e10-8ceb-d56423d90556} -cur_console:pm:/mnt is good.
Ok, where can I look up the distro guids?
Have you read docs?
https://conemu.github.io/en/BashOnWindows.html#wsl-distro
Most helpful comment
Have you read docs?
https://conemu.github.io/en/BashOnWindows.html#wsl-distro