Git Product home page Git Product logo

wslbridge2's Introduction

wslbridge2's People

Contributors

biswa96 avatar dxhisboy avatar mavaddat avatar meisenbraun avatar mintty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wslbridge2's Issues

Static linking

In order to support WSL distros with different runtime environments, it would be better to have the backend statically linked (mintty/wsltty#156).
That probably also needs the getpwuid patch that wsltty currently adds to wslbridge(1).

Implementing Interop

This isn't an issue - this is me not understanding how WSL works and seeking clarity.

I've been trying to grok the work between here, lxss, mintty, and some of your other projects involving WSL and WSL2. Essentially, my aim is to launch a process in WSL/WSL2 from Windows (such as, "/usr/bin/whoami") and retrieve the output. My questions are two-fold:

  1. How did you derive these function definitions and names? I was perusing the COM objects using the OLE.NET viewer from James Foreshaw, but didn't see the symbols you retrieved (or how you derived the function parameters for that matter).
  2. How could I achieve my goal (such as running /usr/bin/whoami) from Windows using this interop? For context, I'm running on Windows 11 using Ubuntu distribution, but I believe your typedefs are correct as copying the code from this project as-is seems to work for CreateLxProcess when passing nullptr to several variables (as done here: https://github.com/Biswa96/wslbridge2/blob/master/src/GetVmId.cpp#L218-L233), but when I attempt to populate them I receive an invalid memory read. Sample code and error is attached:

image

HRESULT hRes;
    GUID InitiatedDistroID;
    HANDLE LxProcessHandle, ServerHandle;
    SOCKET SockIn, SockOut, SockErr, ServerSocket;
    SockIn = win_vsock_create();
    SockOut = win_vsock_create();
    SockErr = win_vsock_create();
    ServerSocket = win_vsock_create();

    // Initialize StdHandles members to be console handles by default.
    // otherwise LxssManager will catch undefined values.
    LXSS_STD_HANDLES StdHandles;
    memset(&StdHandles, 0, sizeof StdHandles);
    
    // Provides \Device\ConDrv\Connect interface of attached ConHost.
    const HANDLE ConsoleHandle = NtCurrentTeb()->
                                 ProcessEnvironmentBlock->
                                 ProcessParameters->
                                 Reserved2[0];

    const int WindowsBuild = GetWindowsBuild();
    std::string bin("/usr/bin/bash");
    std::string args("-c whoami");
    LPCSTR lpcArgv = args.c_str();
    /* Before Build 20211 Fe */
    if (WindowsBuild < 20211)
    {
       // snipped
    }
    else
    {
        /* After Build 20211 Fe */
        PCWSTR LxssDefaultEnvironmentStrings[4] =
        {
            L"HOSTTYPE=x86_64",
            L"TERM=xterm",
            L"LANG=en_US.UTF-8",
            L"SHELL=/usr/bin/bash"
        };
        hRes = ComObj.wslSessionThree->lpVtbl->CreateLxProcess(
            ComObj.wslSessionThree,
            DistroId,
            bin.c_str(),
            3,
            &lpcArgv,
            L"C:\\Windows\\System32;C:\\Windows",
            L"/",
            *LxssDefaultEnvironmentStrings,
            4,
            L"user",
            0,
            0,
            HandleToULong(ConsoleHandle),
            &StdHandles,
            0, // maybe update this to 1?
            &InitiatedDistroID,
            LxInstanceID,
            &LxProcessHandle,
            &ServerHandle,
            &SockIn,
            &SockOut,
            &SockErr,
            &ServerSocket);
    }

    assert(hRes == 0);

    /* wsltty#254: Closes extra shell process. */
    if (SockIn) closesocket(SockIn);
    if (SockOut) closesocket(SockOut);
    if (SockErr) closesocket(SockErr);
    if (LxProcessHandle) CloseHandle(LxProcessHandle);
    if (ServerHandle) CloseHandle(ServerHandle);

    if (ComObj.wslSessionOne)
        ComObj.wslSessionOne->lpVtbl->Release(ComObj.wslSessionOne);
    CoUninitialize();
    return hRes;

Any insight you could give me or pointers to put me in the right direction would be helpful. Thanks for your time!

execvp: No such file or directory (hvpty v0.4)

I've been trying to get hvpty to get to ~ (home directory of user) on launch, however no matter what tool I use (cmd, mintty-cyg, mintty-msys2) I get "execvp: No such file or directory". It works if I give an explicit path, but that's not an elegant solution.
It hasn't worked with previous versions either. I've been at this for 2-3 days now.

could wslbridge2 be made a cygwin package

Summary

If wslbridge2 could be made a cygwin package, then mintty could somehow be directly used as wsltty - thus, for msys2 users, reducing duplicacy of installed softwares and also confusion among users

Details

Refer to mintty/mintty#1166 (comment) for details, TL;DR:

  • mintty is already included in msys2/cygwin
  • for using it with wsl, either wsltty has to be installed separately, or wslbridge has to be installed at /bin

Unable to close window when using wslbridge2 with wsltty and WSL2

Pressing the close button on a terminal does nothing when running wsltty with wslbridge2 and wsl2.

Steps to recreate:

  1. Install wslbridge2 to %LOCALAPPDATA\wsltty\bin.
  2. Run in cmd:
%LOCALAPPDATA%\wsltty\bin\mintty.exe  --configdir="%APPDATA%\wsltty" %LOCALAPPDATA%\wsltty\bin\hvpty.exe -W '$HOME' -l
  1. Try to close the window with the X button on the top right. ^D in the spawned shell works fine.

Confirmed with latest wsltty version 3.0.2.3 and wslbridge2 v0.3.

Not sure if this is a wsltty bug or a wslbridge2 bug. I can cross-post if necessary.

wslbridge2 can't start multiple session simultaneously

Ex If I use conemu to open 3 tabs at startup. First tab opens normally, but the other ones show this error

assertion "listenRet == 0" failed: file "WindowsSock.cpp", line 131, function: int ListenHvSock(size_t, const GUID*, int)

cmd is wslbridge2.exe -l -eConEmuBuild -eConEmuPID -eConEmuServerPID -e WSL_HOST_IP

hvpty does not compile in cygwin-32

After removing the -m64 from Makefiles, still the GetVmId module won't compile, due to some embedded assembler instructions. Where is that module from and does a 32-bit version exist?

Discussion: Merge the networking logic of WSL1 and WSL2 in wslbridge2

tl;dr: What are the odds of rand() (in Cygwin) returning same value twice in one session?

  • How the network channels are initiated now in wslbridge2?

    • In case of WSL1 (AF_INET), 1. frontend listens with three sockets 2. frontend sends three unassigned port number with command line to backend 3. backend connects 4. frontend accepts. Done.

    • In case of WSL2 (AF_HYPERV), 1. frontend listens with one socket 2. frontend sends one port number with command line to backend 3. backend connects 4. backend creates three sockets with a random unassigned port number and listens 5. frontend receives that random port and creates three sockets with that random port number and connects 6. backend accepts. Done.

  • What will it be after merging?

    • The networking will be same in wslbridge2 frontend and backend as in WSL1 now.
  • Why has not it done in first place?

    • Due to difference in Hyper-V and TCP/IP network sockets. In AF_INET, if bind() is used with port zero the socket is automatically bound with random free port. But it is possible in Linux's AF_VSOCK, not in AF_HYPERV in MS Windows. The win_vsock_listen() in frontend mimics that behavior using rand(). The one and only failure point is that rand() returning same integer twice resulting same port for in and out.

So the main question, is it possible for rand() (in Cygwin) returning same integer twice in one session of wslbridge2?

Ubuntu-Preview hangs in mintty from cygwin

When running mintty --WSL=Ubuntu-Preview from cygwin, it hangs for me after this greeting:

To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

Tried both WSL V1 and V2, on Windows 10.
Running wslbridge2 from bash in mintty works, also starting wsltty with the configured shortcut works for Ubuntu-Preview,
so it's likely some spurious effect... Just noting here for the records as requested.

X11 forwarding support

Perhaps I am misunderstanding something but it seems like wslbridge2 is basically a WSL2 specific replacement for ssh (using a different/vm local socket type so it is inherently secure). As such, it would be really cool if this was extended so support X11 forwarding (and perhaps ssh agent forwarding other ssh types of port forwarding/tunneling too) so people can use this seamlessly with a Window X11 server (e.g., Cygwin/X, Xming, VcXsrv, X410, etc.).

I consider this an enhancement request since clearly nothing is really broken as per se.

GetVmId:318: CreateLxProcess: WSL 2 requires an update to its kernel component.

I get this error message while there is no update I could apply (at the moment). Also, my wsl2 setup runs without issues using the stock terminal.

c:\Users\x\AppData\Local\wsltty\bin>wslbridge2.exe
ERROR: GetVmId:318: CreateLxProcess: WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel

c:\Users\x\AppData\Local\wsltty\bin>wsl -v
WSL version: 1.1.2.0
Kernel version: 5.15.83.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1265

vmsocket with mintty

Saw your post. First off, very nice work on getting AF_VSOCK working.

That being said, I am pretty sure mintty isn't going to be the killer-app for this. Thing is, we already have a channel. You've probably already also noticed that old /dev/tty1 in WSL1 is now the (infinitely more sensible) new /dev/pts/0 in WSL2.

Which is to say: there isn't actually a point to using another channel (be it AF_INET on localhost like wsltty, or AF_VSOCK in a hypothetical wsltty2). But not to discourage you or anyone from doing it for the time-sink value. It just doesn't make much sense when /dev/pts/0 is right there.

The fix is going to be along the lines of WSL#3279.

But regarding the mail you cited... If you do take a run at a wsltty2, you want MSYS2 via vcpkg, not Cygwin. MSYS2 apps are otherwise native Windows apps. In particular, they don't pretend to support </sys/socket.h> (see this thread). You'd just use <winsock2.h>. All of which to be clear has nothing to do with mintty, which doesn't care whether the bytes are going over a AF_VSOCK or a 300 baud modem. And after you've gone and marshaled the bytes over AF_VSOCK, on the WSL2 side you are going to have to create a (wait for it) /dev/pts/N just like sshd or telnetd (in your case let's call it wslvsockttyd). [The pretty screencap with all the sixels is by the way just Git Bash (note the icon) aka mintty with Windows OpenSSH and sshd doing the pty heavy lifting.]

As an aside since I'm here, I also have in my head (but not on paper) an api for marshaling data in and out of WSL2 which is not susceptible to the flawed "sorry the api is in flux" line of reasoning that we've been faced with since 2016. I'm sure you've noticed by now the disappearance of /dev/lxss in WSL2. In a more perfect world, that implementation detail wouldn't have changed anything. Think URIs to describe the channel and closed-but-extensible backends to implement the channel. One such backend could be based on vmsocket.

wslbridge2 in WSL1 breaks connection when linked with glibc statically

  • Problem: wslbridge2 in WSL1 breaks connection when linked with glibc
    statically. This is not issue for hvpty in WSL2.

  • Experiments:

    • This issue does not occur with dynamic linking. Also static linking with
      musl libc does not produce any error. Hence the v0.4 released binaries are
      compiled with musl libc statically.

    • This issue is inherited from the base wslbridge repository by @rprichard.
      To reproduce this issue clone @rprichard's wslbridge repository.

      • Apply the following patch which replaces wsl.exe with bash.exe
        and getpwuid() with getenv("SHELL") for static linking.
      • Compile both backend and frontend.
      • Then check if the default distribution is in WSL V1.
      • Run ./out/wslbridge.exe.
      • Run any command that produces big output. For example, ls /usr/bin.
    • Patch file: wslbridge-conection-broken.patch.txt

Combine wslbridge2 and hvpty

  • Topic: Combine wslbridge2 (for WSL1) and hvpty (for WSL2) into one binary both for backend and frontend. They share most of the option processing and how wsl.exe executes the backend. The difference is the socket in use -- wslbridge2 uses AF_INET (wrapped by cygwin) but hvpty uses raw AF_HYPERV from winsock. Also the multi-threading execution is different between them.

  • Pros:

    • frontend (PE binary) and backend (ELF binary) will detect WSL version V1 or V2 internally, so upstream programs do not have to do extra works.
    • Mitigate any confusion among users about which one to use.
  • Cons:

  • To do:

    • Fix any remaining issues first. Top priority 🚨
    • The two backends can easily combined into one (v0.4), I'll do it after fixing the current issues.
    • Next combine the frontend (v0.5). But there are many hurdles for it. See next section.
    • Try not to create any regression.
  • Problems:

    • Detection of WSL version is not documented. The easiest way to do that is with WslGetDistributionConfiguration() function but the value wslDistributionFlags = 15 for WSL2 is not documented ( see microsoft/WSL#4251).
    • No documented way to get VmID from WSL2 (see microsoft/WSL#4131). hvpty uses the undocumented COM method which is highly volatile
    • For frontend combination, I may have to add a virtual table to combine Local socket and Hyper-V socket classes. This may add some performance penalty during startup. But I am open for suggestion and alternatives.
  • Conclusion: Throw your suggestion or idea on how to solve this. Any suggestions are greatly appreciated 🤗

hvpty login option

wslbridge supports starting the WSL shell as a login shell,
triggered by checking its own argv[0][0] == '-'
Although WSL distros do not seem to make much difference on login shell, this would be a good option to have in general.

xonsh default shell doesn't accept sh syntax

If I set xonsh as my default login shell in WSL2, then I can't use wslbridge2 anymore due to incompatible syntax (the bridge only prepares the sh-syntax command), instead I get the following error:

Backend CommandLine: "C:\WINDOWS\System32\wsl.exe" /bin/sh -c 'exec "$(wslpath -u '\''C:\path\to\wslbridge2-backend'\'')" --login --show --cols 120 --rows 30 -060266 -149859 -359317 -- /home/linuxbrew/.linuxbrew/bin/xonsh'
Traceback

X=/home/linuxbrew/.linuxbrew/Cellar/xonsh/0.10.1/libexec/lib/python3.9/site-packages (shortened for readability)

Traceback (most recent call last):
    _failback_to_other_shells(args, err)    run_code_with_cache(
  File "X/xonsh/__amalgam__.py", line 3328, in run_code_with_cache
    tree = self.parser.parse(
  File "X/xonsh/parsers/base.py", line 523, in parse
    tree = self.parser.parse(input=s, lexer=self.lexer, debug=debug_level)
  File "X/xonsh/ply/ply/yacc.py", line 335, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "X/xonsh/ply/ply/yacc.py", line 1203, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "X/xonsh/ply/ply/yacc.py", line 194, in call_errorfunc
    r = errorfunc(token)
  File "X/xonsh/parsers/base.py", line 3459, in p_error
    self._parse_error(msg, self.currloc(lineno=p.lineno, column=p.lexpos))
  File "X/xonsh/parsers/base.py", line 650, in _parse_error
    raise_parse_error(msg, loc, self.xonsh_code, self.lines)
  File "X/xonsh/parsers/base.py", line 238, in raise_parse_error
    raise err
SyntaxError: 080d92d8c20c62294b20abf38050b6da:1:0: ('code: /',)
/bin/sh -c 'exec "$(wslpath -u '\''C:\path\to\wslbridge2-backend'\'')" --login --show --cols 120 --rows 30 -060266 -149859 -359317 -- /home/linuxbrew/.linuxbrew/bin/xonsh'
^

The proper command for this should be something like (newline-split for readability)

"C:\WINDOWS\System32\wsl.exe"
/bin/sh -c
@("exec '{bridge}' {args}".format(
  bridge=$(wslpath -u r"C:\path\to\wslbridge2-backend").rstrip(),
  args="--show --cols 120 --rows 30 -060266 -149859 -359317 -- /home/linuxbrew/.linuxbrew/bin/xonsh"
  ) )

I'll submit a PR shortly that introduces the new syntax either via the less convenient command-flag or via the auto-detection of the default shell via grep "^$(id -un)": /etc/passwd
(I bypassed the appendWslArg function as there is no need to escape the quotes, and I don't understand how relevant the other corrections are :))

should wslbridge2 return child exit status?

Now that mintty/wsltty#254 is fixed, should wslbridge2 propagate the backend/child exit status, as suggested in this comment mintty/wsltty#254 (comment)?

This would allow mintty --hold error from wsltty to close the window upon a successful command, and hold the window open if the command returns non-zero exit code.

I tried implementing it like this:

diff, CLICK ME
diff --git a/src/wslbridge2-backend.cpp b/src/wslbridge2-backend.cpp
index ad60a1f..13dceae 100644
--- a/src/wslbridge2-backend.cpp
+++ b/src/wslbridge2-backend.cpp
@@ -306,6 +306,7 @@ int main(int argc, char *argv[])
     act.sa_sigaction = [](int x, siginfo_t *y, void *z) { wait(NULL); };
     sigaction(SIGCHLD, &act, NULL);
 
+    int childExitStatus = -1;
     int mfd;
     char ptyname[16];
     const pid_t child = forkpty(&mfd, ptyname, NULL, &winp);
@@ -372,6 +373,18 @@ int main(int argc, char *argv[])
             /* Shutdown I/O sockets when child process terminates */
             if (fds[2].revents & (POLLERR | POLLHUP))
             {
+                int status;
+                if (wait(&status))
+                {
+                    if (WIFEXITED(status))
+                    {
+                        childExitStatus = WEXITSTATUS(status);
+                        printf("exit-status 0x%x 0x%x\n", childExitStatus, status);
+                    }
+                } else {
+                    perror("wait");
+                }
+
                 for (size_t i = 0; i < ARRAYSIZE(ioSockets.sock); i++)
                     shutdown(ioSockets.sock[i], SHUT_RDWR);
 
@@ -454,7 +467,7 @@ int main(int argc, char *argv[])
          * Do not use exit() because it performs clean-up
          * related to user-mode constructs in the library
          */
-        _exit(0);
+        _exit(-1);
     }
     else
         perror("fork");
@@ -463,5 +476,5 @@ int main(int argc, char *argv[])
     for (size_t i = 0; i < ARRAYSIZE(ioSockets.sock); i++)
         close(ioSockets.sock[i]);
 
-    return 0;
+    return childExitStatus;
 }
diff --git a/src/wslbridge2.cpp b/src/wslbridge2.cpp
index f0b49ae..595a22e 100644
--- a/src/wslbridge2.cpp
+++ b/src/wslbridge2.cpp
@@ -481,7 +481,8 @@ int main(int argc, char *argv[])
     if (!ret)
         fatal("SetHandleInformation: %s", GetErrorMessage(GetLastError()).c_str());
 
-    const auto watchdog = std::thread([&]() {
+    DWORD exitCode = 0;
+    auto watchdog = std::thread([&]() {
         WaitForSingleObject(pi.hProcess, INFINITE);
 
         std::vector<char> outVec = readAllFromHandle(outputPipe.rh);
@@ -501,6 +502,10 @@ int main(int argc, char *argv[])
             msg.append(err);
         }
 
+        if (!GetExitCodeProcess(pi.hProcess, &exitCode)) {
+            exitCode = -1;
+        }
+
         /* Exit with error if output/error message is not empty. */
         if (!msg.empty())
             termState.fatal("%s", msg.c_str());
@@ -546,6 +551,8 @@ int main(int argc, char *argv[])
     ret = pthread_create(&tidOutput, nullptr, receive_buffer, nullptr);
     assert(ret == 0);
 
+    watchdog.join();
+
     termState.enterRawMode();
 
     /*
@@ -562,5 +569,5 @@ int main(int argc, char *argv[])
     CloseHandle(pi.hProcess);
     CloseHandle(pi.hThread);
     WSACleanup();
-    termState.exitCleanly(0);
+    termState.exitCleanly(exitCode);
 }

But it doesn't seem to always work. Running ./bin/wslbridge2.exe /bin/false should always return 1. The proper exit code from wait() is not always captured, sometimes WEXITSTATUS wrongly gives 0, sometimes it correctly gives the real status code from the child.

wslbridge2 version e4b44dd236c587613e461d56011016292051d05d

ERROR: GetVmId:271: CreateLxProcess: the system cannot find the file specified

When I try to start wslbridge2 with a WSL2 Distriburtion (e.g. wslbridge2.exe -d centos7) I get this error. If I start the distribution with "wsl -d centos7" it works, and after that, when I try to start "wslbridge2.exe -d centos7) it also works. When I do "wsl --shutdown" the same error reappears. Any ideas why?

Thanks
br
rola

WSL2 with mirrored networking mode error ioctl(SIOCGIFADDR): Address not available

Hello,

I am using the most updated version of wslbridge2.exe:

$ %ConEmuBaseDirShort%\wsl\wslbridge2.exe --help

wslbridge2 v0.12 : Runs a program within a Windows Subsystem for Linux (WSL) pty.
Copyright (C) 2019-2022 Biswapriyo Nath.
Licensed under GNU General Public License version 3 or later.

I have enabled the new experimental mirrored networking mode in WSL2.

On launching a session as I normally do in conemu, I get the following message/warning:
ioctl(SIOCGIFADDR): Address not available

The shell session seems to continue to function normally without any other issues, that I can identify. But am more than happy to troubleshoot. I am not too familiar with the code base here to identify what socket this is referencing, I am assuming this is trying to connect to address of the wsl2 network stack which would no longer exist and seemingly should connect to localhost. I had what I assume is a simillar issue with Pycharm/Intellij using this configuration and they had resolved the issue here by allowing the proxy to connect to localhost.

Some additional debugging output:

$ wslinfo --networking-mode
mirrored

$ wsl --version
WSL version: 2.0.14.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.2861

edit: Looking at the error and code, it would seem the issue is potentially coming from this call: https://github.com/Biswa96/wslbridge2/blob/1770edd37f6f6c767970dcec69896ef22fe4618c/src/nix-sock.c#L176C1-L176C1

It seems this function is using the eth0 interface, on my machine (a laptop with multiple network interfaces) wsl2 is not using eth0:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether {removed mac} brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether {removed mac} brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.160/24 brd 10.0.0.255 scope global noprefixroute eth1
       valid_lft forever preferred_lft forever
    inet6 {removed}/64 scope global nodad deprecated noprefixroute
       valid_lft forever preferred_lft 0sec
    inet6 {removed}/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 {removed}/64 scope link nodad noprefixroute
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether {removed mac} brd ff:ff:ff:ff:ff:ff
5: loopback0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether {removed mac} brd ff:ff:ff:ff:ff:ff
    .... abbreviated ....

I guess the question comes down to, how is this used? It seems in setting the env vars, does it break without it? If so could a call to getifaddrs be made to get back a list of the available interfaces and maybe choose the first one with an active ip?

hvpty options

hvpty does not have options -t (maybe not needed) and -e (useful).
Option -C~ stalls hvpty. Even parallel instances cannot be started while hvpty is running (and stalled) with this option.
Sometimes it's reporting
assertion "ret == 0" failed: file "hvpty.cpp", line 58, function: SOCKET Initialize(std::wstring&, GUID*)
(not sure yet whether this is always related to an instance with -C~).

Error code: Wsl/Service/CreateInstance/MountVhd/0x80070020

The problem comes from WSL, see microsoft/WSL issue-8696


I'm facing the problem of wslbridg2 after run wsl --update --web-download, here is my error message:

command:

wsl --terminate Ubuntu
mintty --WSL= -h error

Error message:

/bin/wslbridge2: Exit 1.
note: wsl.exe output: 無法將磁片'C:\VMs\WSL-Ubuntu\ext4.vhdx'連結到 WSL2: The process cannot access the file because it is being used by another process.
Error code: Wsl/Service/CreateInstance/MountVhd/0x80070020

Sorry for the mandarin of error message.
Any comment would be appreciated.

My WSL version:

WSL version: 1.1.3.0
Core version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1413

My Windows version:

Windows 11 Professional
22H2
OS Built	22621.1413
Windows Feature Experience Pack 1000.22639.1000.0

hvpty command argument

wslbridge2, like wslbridge, also takes a command argument which would be used instead of starting a shell, like wslbridge2 ls or wslbridge2 ls -l.
This does not work with hvpty.

wslbridge2 stops with black screen if wsl shell requires some input to proceed further

I use the keychain [1] utility to keep my SSH key with a passphrase in running wsl session. On the first WSL run, keychain asks for the SSH password.

WSLbridge never shows this request and stops with a black screen here.

But, if I start wsl separately and input the passphrase, the subsequent wslbridge2 runs are successful.

Also, if I start wslbridge2 with the -s option, I see a separate WSL window with the keychain pass request. If I put my password, wslbridge2 will continue in the main window.

Please check and fix it if possible.

WSLBridge2 ver:
wslbridge2 v0.8

WSL:

wsl --status
Default Distribution: Ubuntu-20.04
Default Version: 2

Windows Subsystem for Linux was last updated on 01/04/2022
WSL automatic updates are on.

Kernel version: 5.10.102.1

[1] https://manpages.ubuntu.com/manpages/bionic/man1/keychain.1.html

Re-license Get-VmID.{cpp,hpp} using LGPL 2.1+?

Hi,

I've got a set of patches against PulseAudio (https://github.com/e45lee/pulseaudio-hyperv/) for running a PulseAudio server instance on Windows listening on Hyper-V sockets. These changes use your VM ID detection code for determining the appropriate VM to bind to, as binding to the wildcard address doesn't allow the WSL2 VM to connect to the socket.

I'm thinking of making a PR for these changes upstream, and ideally I'd like to upstream these changes with PulseAudio's existing licensing (which is LGPL 2.1 or later). I think I can contribute a patch that is GPL 3 though, but...

  1. Is the current license on Get-VmID.cpp an oversight? All the other files in the repository are GPL 3 or later, but this one in particular is GPL 3 only.
    * Licensed under the GNU General Public License version 3
    (compared to)
    * Licensed under the terms of the GNU General Public License v3 or later.
  2. Is it possible to re-license Get-VmID.{hpp,cpp} to LGPL 2.1+?

wslbridge2 waits for setsid program to finish

Hello,

I started wslbridge2 v0.5 from a regular command prompt window:

C:\cygwin\bin>wslbridge2

Next, I did the following:

$ setsid sleep 10
$ exit

I expected the wslbridge2 process to exit immediately. However, it waits for sleep to finish before exiting.

First, I thought that it was a mintty issue mintty/mintty#993, but it also happens in Command Prompt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.