Giter VIP home page Giter VIP logo

Comments (15)

jeanmichelleconte avatar jeanmichelleconte commented on July 17, 2024 1

@dorssel I had the same issue, usbipd: error: WSL kernel is not USBIP capable; even with the latest kernel. I tried your dev installer and that did fix it for me. I can see the USB device now in wsl.

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

This should work fine, in the sense that Windows 10 and the kernel version are good.

From within your distribution, what is the output of the following command:

cat /sys/devices/platform/vhci_hcd.0/status

This is how usbipd-win finds out if USB/IP is supported, and if it fails, you get the error you got.

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024

Thanks for the engagement!

$ cat /sys/devices/platform/vhci_hcd.0/status
hub port sta spd dev      sockfd local_busid
hs  0000 004 000 00000000 000000 0-0
hs  0001 004 000 00000000 000000 0-0
hs  0002 004 000 00000000 000000 0-0
hs  0003 004 000 00000000 000000 0-0
hs  0004 004 000 00000000 000000 0-0
hs  0005 004 000 00000000 000000 0-0
hs  0006 004 000 00000000 000000 0-0
hs  0007 004 000 00000000 000000 0-0
ss  0008 004 000 00000000 000000 0-0
ss  0009 004 000 00000000 000000 0-0
ss  0010 004 000 00000000 000000 0-0
ss  0011 004 000 00000000 000000 0-0
ss  0012 004 000 00000000 000000 0-0
ss  0013 004 000 00000000 000000 0-0
ss  0014 004 000 00000000 000000 0-0
ss  0015 004 000 00000000 000000 0-0

All Greek to me; hopefully that tells you something...

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

Yes, that tells me something is wrong with the detection, as this is the correct output.

While keeping your distribution running (keep a command prompt to it open), then from Windows, what is the output of:

wsl.exe --distribution Debian --user root --cd / --shell-type none --exec cat /sys/devices/platform/vhci_hcd.0/status

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024

wsl.exe didn't like the --shell-type argument so I had to omit it. Otherwise:

PS> wsl --distribution Debian --user root --cd / --exec cat /sys/devices/platform/vhci_hcd.0/status 
hub port sta spd dev      sockfd local_busid
hs  0000 004 000 00000000 000000 0-0
hs  0001 004 000 00000000 000000 0-0
hs  0002 004 000 00000000 000000 0-0
hs  0003 004 000 00000000 000000 0-0
hs  0004 004 000 00000000 000000 0-0
hs  0005 004 000 00000000 000000 0-0
hs  0006 004 000 00000000 000000 0-0
hs  0007 004 000 00000000 000000 0-0
ss  0008 004 000 00000000 000000 0-0
ss  0009 004 000 00000000 000000 0-0
ss  0010 004 000 00000000 000000 0-0
ss  0011 004 000 00000000 000000 0-0
ss  0012 004 000 00000000 000000 0-0
ss  0013 004 000 00000000 000000 0-0
ss  0014 004 000 00000000 000000 0-0
ss  0015 004 000 00000000 000000 0-0

Looks pretty similar to what comes up inside WSL.

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

Are you sure the original error wasn't a fluke? Maybe the WSL distro was in the process of starting up or being shut down?
Can you reconfirm that the following command still gives that error?

usbipd --version
usbipd attach --wsl --busid 13-3

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024

Yep, already tried again, same error.

PS > usbipd attach --wsl --busid 13-3
usbipd: info: Using WSL distribution 'Debian' to attach; the device will be available in all WSL 2 distributions.
usbipd: error: WSL kernel is not USBIP capable; update with 'wsl --update'.
PS > usbipd --version
4.1.0+52.Branch.master.Sha.b0b7589d2dc4481b1af481787d6d773f46d0758a

The host has also been rebooted a couple times since starting on this journey, and the latest WSL instance has been up quite a while:

$ uptime
 10:51:56 up 16:59,  0 user,  load average: 0.00, 0.00, 0.00

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

I am stumped ...
The check is in this part of the source code:

usbipd-win/Usbipd/Wsl.cs

Lines 272 to 286 in b0b7589

// Check: WSL kernel must be USBIP capable.
{
var wslResult = await RunWslAsync((distribution, "/"), null, cancellationToken, "cat", "/sys/devices/platform/vhci_hcd.0/status");
// Expected output:
//
// hub port sta spd dev sockfd local_busid
// hs 0000 006 002 00040002 000003 1-1
// hs 0001 004 000 00000000 000000 0-0
// ...
if (wslResult.ExitCode != 0 || !wslResult.StandardOutput.Contains("local_busid"))
{
console.ReportError($"WSL kernel is not USBIP capable; update with 'wsl --update'.");
return ExitCode.Failure;
}
}

There are two things that could maybe explain it:

  1. The output is correct, but the exit code is actually not 0 (which means: success).

In PowerShell (not cmd.exe), do:

wsl.exe --distribution Debian --user root --cd / --shell-type none --exec cat /sys/devices/platform/vhci_hcd.0/status
$LASTEXITCODE
  1. The path of wsl.exe is not correct

In PowerShell (not cmd.exe) do:

$env:WINDIR
dir $env:WINDIR\System32\wsl.exe
Get-Command wsl.exe

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024
PS > wsl --distribution Debian --user root --cd / --exec cat /sys/devices/platform/vhci_hcd.0/status 
hub port sta spd dev      sockfd local_busid
hs  0000 004 000 00000000 000000 0-0
hs  0001 004 000 00000000 000000 0-0
hs  0002 004 000 00000000 000000 0-0
hs  0003 004 000 00000000 000000 0-0
hs  0004 004 000 00000000 000000 0-0
hs  0005 004 000 00000000 000000 0-0
hs  0006 004 000 00000000 000000 0-0
hs  0007 004 000 00000000 000000 0-0
ss  0008 004 000 00000000 000000 0-0
ss  0009 004 000 00000000 000000 0-0
ss  0010 004 000 00000000 000000 0-0
ss  0011 004 000 00000000 000000 0-0
ss  0012 004 000 00000000 000000 0-0
ss  0013 004 000 00000000 000000 0-0
ss  0014 004 000 00000000 000000 0-0
ss  0015 004 000 00000000 000000 0-0
PS > $LASTEXITCODE
0
PS C:\Windows\system32> $env:WINDIR
C:\Windows
PS > dir $env:WINDIR\System32\wsl.exe


    Directory: C:\Windows\System32


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         9/12/2022   1:54 PM         107520 wsl.exe


PS > Get-Command wsl.exe

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     wsl.exe                                            10.0.19... C:\Windows\system32\wsl.exe

Again I'll point out that wsl.exe doesn't like the --shell-type argument. If USBIPD is passing that in the exec, it is failing:

PS >  wsl --distribution Debian --user root --cd / --shell-type none --exec cat /sys/devices/platform/vhci_hcd.0/status
Invalid command line option: --shell-type
// wsl usage output...
PS > $LASTEXITCODE
-1

Edit: Doesn't look like the code snippet you quoted mentions shell type...but maybe that's still a clue.

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

Oops, I missed your comment. Sorry.

wsl.exe didn't like the --shell-type argument so I had to omit it.

So the problem is not the distribution, or the WSL kernel, but the wsl.exe executable itself! Now we're getting somewhere!

Can you do in PowerShell:

systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
wsl --version
wsl --help

Maybe (just maybe), we can just leave it out since we already use --exec, see microsoft/WSL#10418. As you see from that open ticket, documentation is poor on this one...

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

I did some testing myself. Note, the goal is to bypass the shell and run a command directly (instead of running the shell which then interprets the command line). The reason is that we don't know what shell the user uses (probably bash, but Docker Desktop doesn't even have bash; it could even be PowerShell!); we need portability.

PS> wsl non-existing-command
/bin/bash: line 1: non-existing-command: command not found
PS> wsl -- non-existing-command
/bin/bash: line 1: non-existing-command: command not found
PS> wsl --shell-type standard non-existing-command
/bin/bash: line 1: non-existing-command: command not found
PS> wsl --shell-type none non-existing-command
<3>WSL (318) ERROR: CreateProcessEntryCommon:502: execvpe non-existing-command failed 2
<3>WSL (318) ERROR: CreateProcessEntryCommon:505: Create process not expected to return
PS> wsl --exec non-existing-command
<3>WSL (327) ERROR: CreateProcessEntryCommon:502: execvpe non-existing-command failed 2
<3>WSL (327) ERROR: CreateProcessEntryCommon:505: Create process not expected to return
PS> wsl --shell-type none --exec non-existing-command
<3>WSL (336) ERROR: CreateProcessEntryCommon:502: execvpe non-existing-command failed 2
<3>WSL (336) ERROR: CreateProcessEntryCommon:505: Create process not expected to return

As you can see --exec and --shell-type none do the same thing. We don't need them both!

Nevertheless, I still think it is a good idea to check your wsl.exe version. And read the first paragraph of https://learn.microsoft.com/en-us/windows/wsl/basic-commands (the part about using the Microsoft Store version of WSL). Maybe you are running the original (and by now outdated) version that came with your Windows 10.

Anyway, I will remove the --shell-type none, as we don't need it. Thanks for the reports!

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024

My wsl.exe does not recognize the --version argument.

PS > systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19044 N/A Build 19044
PS > wsl --help
Copyright (c) Microsoft Corporation. All rights reserved.

Usage: wsl.exe [Argument] [Options...] [CommandLine]

Arguments for running Linux binaries:

    If no command line is provided, wsl.exe launches the default shell.

    --exec, -e <CommandLine>
        Execute the specified command without using the default Linux shell.

    --
        Pass the remaining command line as is.

Options:
    --cd <Directory>
        Sets the specified directory as the current working directory.
        If ~ is used the Linux user's home path will be used. If the path begins
        with a / character, it will be interpreted as an absolute Linux path.
        Otherwise, the value must be an absolute Windows path.

    --distribution, -d <Distro>
        Run the specified distribution.

    --user, -u <UserName>
        Run as the specified user.

Arguments for managing Windows Subsystem for Linux:

    --help
        Display usage information.

    --install [Options]
        Install additional Windows Subsystem for Linux distributions.
        For a list of valid distributions, use 'wsl --list --online'.

        Options:
            --distribution, -d [Argument]
                Downloads and installs a distribution by name.

                Arguments:
                    A valid distribution name (not case sensitive).

                Examples:
                    wsl --install -d Ubuntu
                    wsl --install --distribution Debian

    --set-default-version <Version>
        Changes the default install version for new distributions.

    --shutdown
        Immediately terminates all running distributions and the WSL 2
        lightweight utility virtual machine.

    --status
        Show the status of Windows Subsystem for Linux.

    --update [Options]
        If no options are specified, the WSL 2 kernel will be updated
        to the latest version.

        Options:
            --rollback
                Revert to the previous version of the WSL 2 kernel.

Arguments for managing distributions in Windows Subsystem for Linux:

    --export <Distro> <FileName>
        Exports the distribution to a tar file.
        The filename can be - for standard output.

    --import <Distro> <InstallLocation> <FileName> [Options]
        Imports the specified tar file as a new distribution.
        The filename can be - for standard input.

        Options:
            --version <Version>
                Specifies the version to use for the new distribution.

    --list, -l [Options]
        Lists distributions.

        Options:
            --all
                List all distributions, including distributions that are
                currently being installed or uninstalled.

            --running
                List only distributions that are currently running.

            --quiet, -q
                Only show distribution names.

            --verbose, -v
                Show detailed information about all distributions.

            --online, -o
                Displays a list of available distributions for install with 'wsl --install'.

    --set-default, -s <Distro>
        Sets the distribution as the default.

    --set-version <Distro> <Version>
        Changes the version of the specified distribution.

    --terminate, -t <Distro>
        Terminates the specified distribution.

    --unregister <Distro>
        Unregisters the distribution and deletes the root filesystem.

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

Please try the dev installer from https://github.com/dorssel/usbipd-win/actions/runs/7836157578. Can you confirm it fixes your problem?

You also may want to read https://learn.microsoft.com/en-us/lifecycle/announcements/windows-10-21h2-end-of-servicing
Root cause is an older wsl.exe version, from a Windows version that is EOL and/or not switching to the recommended Store version of WSL. Nevertheless, we made it work! Thanks for hanging in there.

from usbipd-win.

Lotharyx avatar Lotharyx commented on July 17, 2024

Seems to have done the trick. On the Windows side, the error is gone, replaced with a status message about an IP address used to reach the host, and the device is now listed in WSL when I do lsusb.

Possibly unrelated, but I discovered this in the kernel log in WSL immediately preceding the enumeration of the USBIPD attachment:

[250601.540950] init: (18532) ERROR: CreateProcessEntryCommon:621: execvpe /bin/wslinfo failed
[250601.540958] 2
[250601.541033] init: (18532) ERROR: CreateProcessEntryCommon:631: Create process not expected to return

The only apparent connection is that it happened just over a second before the messages from vhci_hcd:

[250602.906541] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[250602.906569] vhci_hcd vhci_hcd.0: devid(851971) speed(3) speed_str(high-speed)
[250602.906651] vhci_hcd vhci_hcd.0: Device attached

Anyway, I report that only for informational purposes; I agree with the closure of this issue. Thank you for your rapid response!

from usbipd-win.

dorssel avatar dorssel commented on July 17, 2024

[250601.540950] init: (18532) ERROR: CreateProcessEntryCommon:621: execvpe /bin/wslinfo failed

That's benign. It is the detection whether "mirrored networking mode" is enabled, which exists only for Window 11. If the command fails (which it does on your older WSL), then it is simply interpreted as "not in mirrored mode" (which is correct).

from usbipd-win.

Related Issues (20)

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.