Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't attach since it keeps saying windows is using the device. can't use --force because it only allows 2 options in the command. #1036

Closed
kairin opened this issue Sep 23, 2024 · 3 comments

Comments

@kairin
Copy link

kairin commented Sep 23, 2024

After failure, what is the output of (in WSL):

ls -l /var/run/usbipd-win
╭─ ♥ 07:52 |    comfui
╰─ ls -l /var/run/usbipd-win
total 1204
-r--r--r-- 1 root root    1844 May 25 12:15 README.md
-r-xr-xr-x 1 root root    3271 Jan 17  2024 auto-attach.sh
-r-xr-xr-x 1 root root 1223552 May 25 12:15 usbip

 WSL at   bash MEM: 1.14% | 0/39GB   9ms                                               master ≡  ?1 -1 
╭─ ♥ 07:57 |    comfui
╰─

What is the output of the following commands (as root, so possibly prepend sudo):

mkdir -m 0000 "/var/run/usbipd-win"
mount -t drvfs -o "uid=0;gid=0;umask=222" "C:\Program Files\usbipd-win\WSL" "/var/run/usbipd-win"
 WSL at   bash MEM: 1.15% | 0/39GB   5ms                                               master ≡  ?1 -1 
╭─ ♥ 07:59 |    comfui
╰─ sudo mkdir -m 0000 "/var/run/usbipd-win"
[sudo] password for ks:
mkdir: cannot create directory ‘/var/run/usbipd-win’: File exists

 WSL at   bash MEM: 1.15% | 0/39GB   2s 572ms                                          master ≡  ?1 -1 
╭─ ♥ 08:00 |    comfui
╰─ sudo mount -t drvfs -o "uid=0;gid=0;umask=222" "C:\Program Files\usbipd-win\WSL" "/var/run/usbipd-win"
mount: /var/run/usbipd-win: failed to parse mount options 'rw,uid=0;gid=0;umask=222': Invalid argument.

Originally posted by @dorssel in #856 (comment)

image

my issue in powershell:

 usbipd attach --wsl --busid=1-2
usbipd: error: There is no WSL 2 distribution running; keep a command prompt to a WSL 2 distribution open to leave it running.
 usbipd attach --wsl --busid=1-2
usbipd: info: Using WSL distribution 'Ubuntu-24.04' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 192.168.0.1 to reach the host.
WSL usbip: error: Attach Request for 1-2 failed - Device busy (exported)
usbipd: warning: The device appears to be used by Windows; stop the software using the device, or bind the device using the '--force' option.
usbipd: error: Failed to attach device with busid '1-2'.

   pwsh MEM: 13% | 10/79GB   691ms 
╭─ ♥ 07:52 |   
╰─

and then when following the prompt to use --force

usbipd: warning: The device appears to be used by Windows; stop the software using the device, or bind the device using the '--force' option.
usbipd: error: Failed to attach device with busid '1-2'.
 usbipd attach --force --wsl --busid=1-2
Unrecognized command or argument '--force'. 

usbipd-win 4.3.0

Description:
  Attaches a USB device to a client.

  Currently, only WSL is supported. Other clients need to perform an attach using client-side tooling.

  Exactly one of the options '--busid' or '--hardware-id' is required.
@kairin kairin changed the title can't attach since it keeps saying windows is using the device. can use --force because it only allows 2 options in the command. can't attach since it keeps saying windows is using the device. can't use --force because it only allows 2 options in the command. Sep 24, 2024
@kairin
Copy link
Author

kairin commented Sep 24, 2024

#856 (comment)

image

 WSL at   bash MEM: 1.15% | 0/39GB   2s 572ms                                          master ≡  ?1 -1 
╭─ ♥ 08:00 |    comfui
╰─ sudo mount -t drvfs -o "uid=0;gid=0;umask=222" "C:\Program Files\usbipd-win\WSL" "/var/run/usbipd-win"
mount: /var/run/usbipd-win: failed to parse mount options 'rw,uid=0;gid=0;umask=222': Invalid argument.

 WSL at   bash MEM: 1.15% | 0/39GB   10ms                                              master ≡  ?1 -1 
╭─ ♥ 08:00 |    comfui
╰─ sudo mount -t drvfs -o "ro,umask=222" "C:\Program Files\usbipd-win\WSL" "/var/run/usbipd-win"

 WSL at   bash MEM: 1.15% | 0/39GB   24ms                                              master ≡  ?1 -1 
╭─ ♥ 08:09 |    comfui
╰─ ls -l /var/run/usbipd-win
total 1204
-r--r--r-- 1 root root    1844 May 25 12:15 README.md
-r-xr-xr-x 1 root root    3271 Jan 17  2024 auto-attach.sh
-r-xr-xr-x 1 root root 1223552 May 25 12:15 usbip

 WSL at   bash MEM: 1.15% | 0/39GB   9ms                                               master ≡  ?1 -1 
╭─ ♥ 08:09 |    comfui
╰─ sudo ls -l /var/run/usbipd-win
total 1204
-r--r--r-- 1 root root    1844 May 25 12:15 README.md
-r-xr-xr-x 1 root root    3271 Jan 17  2024 auto-attach.sh
-r-xr-xr-x 1 root root 1223552 May 25 12:15 usbip

 WSL at   bash MEM: 1.14% | 0/39GB   14ms                                              master ≡  ?1 -1 
╭─ ♥ 08:10 |    comfui
╰─

@dorssel
Copy link
Owner

dorssel commented Sep 24, 2024

The --force option is for the usbipd bind command, not for usbipd attach.

@kairin
Copy link
Author

kairin commented Sep 24, 2024

oh. thank you. should have read it more closely.

updated.

PowerShell 7.4.5
Loading personal and system profiles took 1034ms.
 usbipd attach --wsl --busid=1-2
usbipd: info: Using WSL distribution 'Ubuntu-24.04' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 192.168.0.1 to reach the host.
 usbipd list
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-2    1058:262e  USB Attached SCSI (UAS) Mass Storage Device                   Attached
1-9    13d3:3563  MediaTek Bluetooth Adapter                                    Not shared
1-10   0b05:1939  AURA LED Controller, USB Input Device                         Not shared
2-3    3434:0240  USB Input Device                                              Not shared
2-4    1532:008a  USB Input Device, Razer Viper Mini                            Not shared

Persisted:
GUID                                  DEVICE

 lsusb
lsusb: The term 'lsusb' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

   pwsh MEM: 13% | 10/79GB   122ms 
╭─ ♥ 21:06 |   
╰─

and then checked in WSL bash


 WSL at   bash MEM: 1.11% | 0/39GB   0ms                                              master ≡  ?1  1 
╭─ ♥ 21:08 |    comfui
╰─ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 1058:262e Western Digital Technologies, Inc. My Passport 262E

 WSL at   bash MEM: 1.1% | 0/39GB   6ms                                               master ≡  ?1  1 
╭─ ♥ 21:08 |    comfui
╰─

@kairin kairin closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants