Forum / NoMachine for Linux / Connect USB Devices to a Docker container?
Tagged: docker, ubuntu, usb devices
- This topic has 2 replies, 2 voices, and was last updated 3 months ago by Giorgi-G..
-
AuthorPosts
-
August 2, 2024 at 04:16 #49006kimberliParticipant
I run NoMachine server on Ubuntu 22.04 Docker container (on Ubuntu 18.04 Host) and try to connect a peripheral device – USB from the client, which is also Ubuntu 22.04.
Because the Docker container image is built from a Dockerfile, it is not properly compiled, and loaded with kernel drivers during build time.
So, I manually compiled nxusb.ko following the instructions from here [1], manually loaded the module into the kernel with “sudo insmod nxusb.ko” from the Ubuntu 22.04 container’s terminal, and when checking from the NoMachine menu, the USB devices from the client appeared.
Try connecting to them – green tick succeeds, but can’t use any of them.
Tried with Keyboard, Mouse or Thumb disk,.. from NoMachine Docker container all succeeded, but keyboard and mouse cannot used; thumb disk does not appear in file manager.
➜ ~ lsmod | grep nxusb
nxusb 36864 0
➜ ~
I’m not sure if I’m missing any libraries in the container or I didn’t load necessary kernel modules on the Ubuntu 18.04 host so the other functions don’t work.Searching Google has not found anyone mentioning this use case.
Can you give me suggestions on what to do?[1] [NoMachine – What To Do If USB Support Is Disabled On Linux With NoMachine 6 Or Later Installed – Knowledge Base](https://kb.nomachine.com/AR12J00658)
[2] The Dockerfile I was used to build the container.
[3] Docker run command I was used to start it:
docker run –rm -v /dev:/dev -d –network host –privileged –name nomachine-jammy –cap-add=SYS_PTRACE –shm-size=1g nomachine-jammy /sbin/init splash #/lib/systemd/systemd #/nxserver.sh
[4] The logs file attachment is attached below.Attachments:
August 5, 2024 at 07:51 #49023kimberliParticipantStrangely, these devices still appear in dmesg logs, but don’t work.
———————————————————————————-
[Aug 3 08:16] nxusb: loading out-of-tree module taints kernel.
[ +0.000101] nxusb: module verification failed: signature and/or required key missing – tainting kernel
[ +0.000691] nxusb_vhci_hcd: NXUSB Virtual Host Controller Interface — Version 1.1 (2020-06-02)
[ +0.000100] nxusb_vhci_iocifc: User-mode IOCTL-interface for NXUSB VHCI — Version 1.1 (2020-06-02)
[ +0.000021] nxusb_vhci_iocifc: Successfully registered the character device.
[ +0.000001] nxusb_vhci_iocifc: The major device number is 244.[ +11.159893] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface — Version 1.1 (2020-06-02)
[ +0.000002] nxusb_vhci_hcd nxusb_vhci_hcd.0: –> Backend: USB VHCI user-mode IOCTL-interface
[ +0.000003] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface
[ +0.000005] nxusb_vhci_hcd nxusb_vhci_hcd.0: new USB bus registered, assigned bus number 1[ +0.000005] usb usb1: Product: NXUSB Virtual Host Controller Interface
[ +0.000001] usb usb1: Manufacturer: Linux 4.15.0-213-generic nxusb_vhci_hcd
[ +0.000001] usb usb1: SerialNumber: nxusb_vhci_hcd.0[ +0.000255] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface
[ +0.000001] nxusb_vhci_hcd nxusb_vhci_hcd.0: new USB bus registered, assigned bus number 2
[ +0.000010] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ +0.000015] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[ +0.000001] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ +0.000001] usb usb2: Product: NXUSB Virtual Host Controller Interface
[ +0.000001] usb usb2: Manufacturer: Linux 4.15.0-213-generic nxusb_vhci_hcd
[ +0.000000] usb usb2: SerialNumber: nxusb_vhci_hcd.0
[ +0.000280] hub 2-0:1.0: USB hub found
[ +0.000004] hub 2-0:1.0: 15 ports detected
[ +0.000402] nxusb_vhci_iocifc: Usb HS bus #1
[ +0.000000] nxusb_vhci_iocifc: Usb SS bus #2
[Aug 3 08:19] usb 1-1: new low-speed USB device number 2 using nxusb_vhci_hcd[Aug 4 16:33] nxusb_vhci_hcd: NXUSB Virtual Host Controller Interface — Version 1.1 (2020-06-02)
[ +0.000063] nxusb_vhci_iocifc: User-mode IOCTL-interface for NXUSB VHCI — Version 1.1 (2020-06-02)
[ +0.000018] nxusb_vhci_iocifc: Successfully registered the character device.
[ +0.000000] nxusb_vhci_iocifc: The major device number is 244.
[ +0.072352] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface — Version 1.1 (2020-06-02)
[ +0.000014] nxusb_vhci_hcd nxusb_vhci_hcd.0: –> Backend: USB VHCI user-mode IOCTL-interface
[ +0.000002] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface
[ +0.000003] nxusb_vhci_hcd nxusb_vhci_hcd.0: new USB bus registered, assigned bus number 1
[ +0.000054] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ +0.000001] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ +0.000001] usb usb1: Product: NXUSB Virtual Host Controller Interface
[ +0.000001] usb usb1: Manufacturer: Linux 4.15.0-213-generic nxusb_vhci_hcd
[ +0.000000] usb usb1: SerialNumber: nxusb_vhci_hcd.0
[ +0.000106] hub 1-0:1.0: USB hub found
[ +0.000004] hub 1-0:1.0: 15 ports detected
[ +0.000770] nxusb_vhci_hcd nxusb_vhci_hcd.0: NXUSB Virtual Host Controller Interface
[ +0.000002] nxusb_vhci_hcd nxusb_vhci_hcd.0: new USB bus registered, assigned bus number 2
[ +0.000016] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ +0.000016] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[ +0.000001] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ +0.000001] usb usb2: Product: NXUSB Virtual Host Controller Interface
[ +0.000001] usb usb2: Manufacturer: Linux 4.15.0-213-generic nxusb_vhci_hcd
[ +0.000001] usb usb2: SerialNumber: nxusb_vhci_hcd.0
[ +0.000102] hub 2-0:1.0: USB hub found
[ +0.000004] hub 2-0:1.0: 15 ports detected
[ +0.000255] nxusb_vhci_iocifc: Usb HS bus #1
[ +0.000001] nxusb_vhci_iocifc: Usb SS bus #2
[ +15.857440] usb 1-1: new high-speed USB device number 2 using nxusb_vhci_hcd
[ +0.714968] usb 1-1: New USB device found, idVendor=5986, idProduct=02d2
[ +0.000002] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ +0.000001] usb 1-1: Product: Integrated Camera
[ +0.000001] usb 1-1: Manufacturer: Ricoh Company Ltd.
[ +0.291008] uvcvideo: Found UVC 1.00 device Integrated Camera (5986:02d2)
[ +0.306120] input: Integrated Camera: Integrated C as /devices/platform/nxusb_vhci_hcd.0/usb1/1-1/1-1:1.0/input/input23
[Aug 4 16:42] usb 1-1: USB disconnect, device number 2
[Aug 4 16:46] usb 1-1: new low-speed USB device number 3 using nxusb_vhci_hcd
[ +0.682286] usb 1-1: New USB device found, idVendor=046d, idProduct=c077
[ +0.000002] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ +0.000009] usb 1-1: Product: USB Optical Mouse
[ +0.000001] usb 1-1: Manufacturer: Logitech
[ +0.276806] input: Logitech USB Optical Mouse as /devices/platform/nxusb_vhci_hcd.0/usb1/1-1/1-1:1.0/0003:046D:C077.000E/input/input24
[ +0.000439] hid-generic 0003:046D:C077.000E: input,hidraw0: USB HID v1.11 Mouse [Logitech USB Optical Mouse] on usb-nxusb_vhci_hcd.0-1/input0
[Aug 4 16:51] usb 1-1: USB disconnect, device number 3August 5, 2024 at 17:28 #49047Giorgi-G.ContributorHi,
Docker containers are intentionally built to isolate the host and container. Therefore, using the NoMachine to forward a device from/to an instance running in a docker container will not be possible.
You could try connecting from your Client NoMachine to your remote Host Nomachine (installed on the host, not inside the container), forwarding a USB device, and then starting the docker container with a USB device passthrough (need to explicitly pass devices through). This might work.
-
AuthorPosts
This topic was marked as solved, you can't post.