Announcement (and discussion) of changes to come... #774
Replies: 7 comments 9 replies
-
@benmcmorran |
Beta Was this translation helpful? Give feedback.
-
@andrewleech @dushanabe |
Beta Was this translation helpful? Give feedback.
-
Here is one more ramble about a common issue that will be resolved. I've had a few dozen issues reported by people that run as a standard user, and therefore require admin rights from a different account (instead of elevated rights). When they use With the upcoming changes you must first Furthermore, somewhere in version 2.x the The changes will make all of this much easier to explain and document:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for looping me in. These changes all make sense to me and seem well-reasoned. In addition to the docs in this project, I know on the Microsoft side we'd also want to update this Microsoft Learn article and this blog post to mention the new commands. I've also started an internal discussion with @craigloewen-msft and the WSL team in case anyone else with more subject mater expertise on WSL has feedback. My availability will be limited the rest of this week for US Thanksgiving. |
Beta Was this translation helpful? Give feedback.
-
@craigloewen-msft I have managed to compile the required client-side tooling in a distro-independent way. It's already merged in the master branch; see the README. This solves the long standing problem of users having to install the "right" client tooling, which is distribution dependent. It was especially cumbersome for Ubuntu, because even if you did install How it was solved
More changes to come (TODO)In the past, Now that the required client tool will be shipped as part of However, I will leave the (optional) argument to I did consider using I did consider to use |
Beta Was this translation helpful? Give feedback.
-
Everything is committed to the master branch now. @craigloewen-msft
I think those are right/stable. Mirrored mode detection works great (it is using It all seems to work nicely, except that there is a nasty bug in WSL mirrored mode networking. I've reported it at microsoft/WSL#10741. Either that needs to get fixed soon, or I will have to work around it by disabling keep-alive on all localhost connections. That has the drawback that people using localhost connections for tunneling do not have keep-alives either... Regression testing starts now. ETA for 4.0.0 is about a week from now. Expect some documentation changes... |
Beta Was this translation helpful? Give feedback.
-
@craigloewen-msft Next up: I will modify the WSL Support wiki accordingly... |
Beta Was this translation helpful? Give feedback.
-
History
When
usbipd-win
was first developed, WSL was not part of the project. Microsoft picked up on the project and added some WSL-specific stuff. This lead to theusbipd wsl ...
convenience commands.usbipd wsl attach
is essentially ausbipd bind
(but only the first time, which requires admin rights) followed by a remote WSLusbip attach
(client side, not requiring admin on Windows).usbipd wsl detach
is essentially a "disconnect" of the TCP connection. It doesn't actually do a detach (which would be graceful) but rather a "yank the device out of the virtual USB port". In fact, WSL is not even called, it does this entirely host-side, and it requires either admin rights or being the interactive user on Windows.usbipd wsl list
was intended to augment the regularusbipd list
to display one additional detail: to which distro is your device attached.Problems in the past
Originally, the WSL stuff was intended to be per-distro. But that never was really the case. When you attach a device to WSL, you attach it to the one-and-only WSL kernel, and the device becomes available in all distros. The
usbipd wsl attach --distribution
option is just there to choose a distro that has the client tools installed. Once attached, all distros are equal.usbipd wsl list
tried to display to which WSL distro the device was attached. Given the previous paragraph, it is now obvious that this never worked. It tried to match the client IP address to one specific distro, but all distros share the same network, and therefore have the same IP address. In fact, it is impossible to detect which distro was used to execute the attach, and it also doesn't matter.Previous changes
Recently (version 3.x.y, I cannot remember) I removed the client details from
usbipd wsl list
, as they were bogus anyway. It used to just always display the first running distro. Currently,usbipd wsl list
simply lists "Attached - WSL" or "Attached - non-WSL". Otherwise, there is no difference with the regularusbipd list
command.New problems
WSL keeps changing (for the better...) and new problems arise. For example: WSL creates a network switch with "WSL" in the name.
usbipd
uses this to determine the host address to be used by the WSL client tools. Now it turns out that Windows Subsystem for Android (WSA) also creates such a switch with a name like "WSL Core". People that are using both WSL and WSA are experiencing problems because (depending on chance)usbipd
sometimes finds the WSA switch first, which is of course unreachable from WSL. Furthermore, recent WSL versions (2.0.x) also create a second switch "WSL Firewall". And it depends on your settings in.wslconfig
which of the two is actually used.On top of that, there is now
mirrored
mode (which is great), but that doesn't use the WSL switch(es) (which still exist), but instead requires to use a localhost address. There are actually two options to selectmirrored
mode: in the early[experimental]
section, and in later in the[wsl2]
section (both are honored by recent WSL). But you can also have these options in.wslconfig
without running a new WSL versions. In that case they do nothing and the regular WSL switch needs to be used. All-in-all, somewhat of a mess to parse and do right 100%. There is also a command on the Linux side (wslinfo --networking-mode
), but the current code ofusbipd
needs to know before we run WSL commands.usbipd wsl list
currently determines if a device is WSL-attached by checking the client IP without running any remote WSL commands. This remote command would slow listing down considerably. Finally, a lot of people use ssh reverse tunnels to bind there device to remote machines. Those appear to be coming from localhost as well (that is how tunnels work), and now cannot be told apart from WSL mirror-mode attaches.Decisions with rationale
The upcoming version 4.0.0 of
usbipd
will have some breaking changes:usbipd wsl list
command will be removed entirely. Currently the only difference withusbipd list
is that it will show whether a device is attached to either WSL or to some non-WSL client. With mirrored mode now available, this detection is no longer reliable. Simply removing that information fromusbipd wsl list
would make the two commands identical. I have decided not to keep both (for "backward compatibility") because: a) the output ofusbipd wsl list
would change anyway, breaking backward compatibility, and b) I don't like redundant clutter.usbipd state
(and the PowerShell commandGet-UsbipdDevice
) will no longer have the fieldIsWslAttached
, as that information is no longer available.usbipd wsl detach
will becomeusbipd detach
. It works (and already worked in the past) just as well for devices attached to other clients. I.e., it is really not WSL-specific at all. I did consider to give it a different name, as "detach" suggests graceful removal whereas to the client it is what is known as a "suprise removal" in USB-land. But terms like "disconnect", "yank", "unplug" all do not quite cover what it does or would just add to the confusion. We usebind
andunbind
(because that is how the Linux tools call them) for "sharing" (which is more a Windows term, just like sharing a printer). Likewise we useattach
anddetach
. Even thoughdetach
is slightly different (as in: we do not actually call detach from the client, but disconnect from the server), to a user they are each others complement. Therefore, I stuck withusbipd detach
.usbipd wsl attach
will becomeusbipd attach --wsl [optional-distro-name]
. It seems silly to have awsl
subcommand that only has a single commandattach
(remember thatdetach
andlist
will be gone fromusbipd wsl
). Furthermore, it makes sense to provide theattach
anddetach
available at the same command level; sincedetach
is generic now,attach
will be at the top level as well. Finally, in the future maybe (just maybe)--wsa
and--hyper-v
options might become available. You must supply the--wsl
(or-w
) option, to make clear thatusbipd attach
(for now) only works for WSL. It is not possible to attach host-side to generic clients, as we have no way of executing a generic remote attach.Beta Was this translation helpful? Give feedback.
All reactions