• DepthAIROS
  • X_LINK_DEVICE_NOT_FOUND inside depthai-ros container

On what kind of host system are you? It seems to work fine with your 'docker …' line for me on Ubuntu 22.04;-)

Backend started successfully.
[2024-09-28T19:20:45Z INFO  ewebsock::native_tungstenite] WebSocket handshake has been successfully completed
[2024-09-28T19:20:45Z INFO  re_viewer::depthai::ws] Websocket opened
Selecting device:  19443010E13A7A2700
Connecting to viewer at 127.0.0.1:9876
Oak cam:  <depthai_sdk.oak_camera.OakCamera object at 0x778b50b0fb20>
Default stereo pair:  (<CameraBoardSocket.CAM_B: 1>, <CameraBoardSocket.CAM_C: 2>)
Selecting device:  19443010E13A7A2700
Resetting...
Closing device...
Done
Connecting to viewer at 127.0.0.1:9876
Oak cam:  <depthai_sdk.oak_camera.OakCamera object at 0x778b4e1de980>
Default stereo pair:  (<CameraBoardSocket.CAM_B: 1>, <CameraBoardSocket.CAM_C: 2>)
Pipeline config:  auto=True cameras=[CameraConfiguration(fps=30, resolution=<CameraSensorResolution.THE_1080_P: 'THE_1080_P'>, kind=<CameraS
ensorType.COLOR: 0>, board_socket=<CameraBoardSocket.CAM_A: 0>, stream_enabled=True, name='Color', tof_align=None), CameraConfiguration(fps=
30, resolution=<CameraSensorResolution.THE_400_P: 'THE_400_P'>, kind=<CameraSensorType.MONO: 1>, board_socket=<CameraBoardSocket.CAM_B: 1>,
stream_enabled=False, name='Left', tof_align=None), CameraConfiguration(fps=30, resolution=<CameraSensorResolution.THE_400_P: 'THE_400_P'>,
kind=<CameraSensorType.MONO: 1>, board_socket=<CameraBoardSocket.CAM_C: 2>, stream_enabled=False, name='Right', tof_align=None)] stereo=Ster
eoDepthConfiguration(median=<MedianFilter.KERNEL_7x7: 7>, lr_check=True, lrc_threshold=5, extended_disparity=False, subpixel_disparity=True,
align=<CameraBoardSocket.CAM_A: 0>, sigma=0, confidence=230, stereo_pair=(<CameraBoardSocket.CAM_B: 1>, <CameraBoardSocket.CAM_C: 2>)) ai_m
odel=AiModelConfiguration(display_name='Yolo V6', path='yolov6nr3_coco_640x352', camera=<CameraBoardSocket.CAM_A: 0>) imu=ImuConfiguration(r
eport_rate=100, batch_report_threshold=5)
Updating pipeline...
Usb speed:  UsbSpeed.SUPER
Creating camera:  fps=15 resolution=<CameraSensorResolution.THE_1080_P: 'THE_1080_P'> kind=<CameraSensorType.COLOR: 0> board_socket=<CameraB
oardSocket.CAM_A: 0> stream_enabled=True name='Color' tof_align=None
Creating camera:  fps=15 resolution=<CameraSensorResolution.THE_480_P: 'THE_480_P'> kind=<CameraSensorType.COLOR: 0> board_socket=<CameraBoa
rdSocket.CAM_B: 1> stream_enabled=True name='Left' tof_align=None
Creating camera:  fps=15 resolution=<CameraSensorResolution.THE_480_P: 'THE_480_P'> kind=<CameraSensorType.COLOR: 0> board_socket=<CameraBoa
rdSocket.CAM_C: 2> stream_enabled=True name='Right' tof_align=None
Creating depth
Getting cam by socket:  CameraBoardSocket.CAM_A  Cameras:  [CameraConfiguration(fps=15, resolution=<CameraSensorResolution.THE_1080_P: 'THE_
1080_P'>, kind=<CameraSensorType.COLOR: 0>, board_socket=<CameraBoardSocket.CAM_A: 0>, stream_enabled=True, name='Color', tof_align=None), C
ameraConfiguration(fps=15, resolution=<CameraSensorResolution.THE_480_P: 'THE_480_P'>, kind=<CameraSensorType.COLOR: 0>, board_socket=<Camer
aBoardSocket.CAM_B: 1>, stream_enabled=True, name='Left', tof_align=None), CameraConfiguration(fps=15, resolution=<CameraSensorResolution.TH
E_480_P: 'THE_480_P'>, kind=<CameraSensorType.COLOR: 0>, board_socket=<CameraBoardSocket.CAM_C: 2>, stream_enabled=True, name='Right', tof_a
lign=None)]
Creating IMU, connected IMU:  BMI270
Starting pipeline
[19443010E13A7A2700] [1.7] [3.089] [DetectionNetwork(9)] [warning] Network compiled for 6 shaves, maximum available 10, compiling for 5 shav
es likely will yield in better performance
----------------------------------------

I am on Ubuntu 22.04 as well :/

This is my latest docker run command:

docker run -it --privileged --security-opt seccomp=unconfined --security-opt apparmor=unconfined -v /dev:/dev -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix luxonis/depthai-ros:humble-latest /bin/bash

Also, I am still able to access my device outside docker but when I run this docker command, I get the following logs:

docker pull luxonis/depthai-library
docker run --rm \
    --privileged \
    -v /dev/bus/usb:/dev/bus/usb \
    --device-cgroup-rule='c 189:* rmw' \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    luxonis/depthai-library:latest \
    python3 /depthai-python/examples/ColorCamera/rgb_preview.py
Using default tag: latest
latest: Pulling from luxonis/depthai-library
Digest: sha256:12d0ddd4abacc82dd0239415bd25e6ef0c37193672f86aca6db7b9ea870b1149
Status: Image is up to date for luxonis/depthai-library:latest
docker.io/luxonis/depthai-library:latest
Traceback (most recent call last):
  File "/depthai-python/examples/ColorCamera/rgb_preview.py", line 24, in <module>
    with dai.Device(pipeline) as device:
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

    AadiKothari
    Check the power please. The error log could indicate the device browns out upon booting because it does not get enough power.

    Try different USB cable or port, or a powered hub

    Thanks,
    Jaka

      Works just fine;-) Sorry for the boring view;-)

      jakaskerl not sure if it is a power issue since it works on the same computer with the same cables outside the docker container.

      I also specifically tried giving access to the device (Intel Movidus MyriadX) but no luck:
      docker run --rm --privileged -v /dev/bus/usb/001/039:/dev/bus/usb/001/039 --device-cgroup-rule='c 189:* rmw' -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix luxonis/depthai-library:latest python3 /depthai-python/examples/ColorCamera/rgb_preview.py

      Output:
      Traceback (most recent call last):

      File "/depthai-python/examples/ColorCamera/rgb_preview.py", line 24, in <module>

      with dai.Device(pipeline) as device:

      RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

      @jakaskerl or @Luxonis-Adam will it be possible to schedule a quick call to see what might be off? I am out of options at this point. I tried it on 2 different PCs (one running Ubuntu 20 and one running Ubuntu 22) but no luck.

        can you just do an 'lsusb' inside the container? Does the device show up there?

        marcow@feather7:~$ xhost +; docker pull luxonis/depthai-library && docker run --rm     --privileged     -v /dev/bus/usb:/dev/bus/usb     --device-cgroup-rule='c 189:* rmw'     -e DISPLAY=$DISPLAY     -v /tmp/.X11-unix:/tmp/.X11-unix  luxonis/depthai-library:latest  bash -c "apt-get install usbutils && lsusb"    
        access control disabled, clients can connect from any host
        Using default tag: latest
        latest: Pulling from luxonis/depthai-library
        Digest: sha256:12d0ddd4abacc82dd0239415bd25e6ef0c37193672f86aca6db7b9ea870b1149
        Status: Image is up to date for luxonis/depthai-library:latest
        docker.io/luxonis/depthai-library:latest
        Reading package lists...
        Building dependency tree...
        Reading state information...
        The following NEW packages will be installed:
         usbutils
        0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
        Need to get 79.3 kB of archives.
        After this operation, 333 kB of additional disk space will be used.
        Get:1 http://deb.debian.org/debian bullseye/main amd64 usbutils amd64 1:013-3 [79.3 kB]
        debconf: delaying package configuration, since apt-utils is not installed
        Fetched 79.3 kB in 0s (543 kB/s)
        Selecting previously unselected package usbutils.
        (Reading database ... 45067 files and directories currently installed.)
        Preparing to unpack .../usbutils_1%3a013-3_amd64.deb ...
        Unpacking usbutils (1:013-3) ...
        Setting up usbutils (1:013-3) ...
        Processing triggers for man-db (2.9.4-2) ...
        Bus 004 Device 001: ID 1d6b:0003 Linux 6.8.0-45-generic xhci-hcd xHCI Host Controller
        Bus 003 Device 001: ID 1d6b:0002 Linux 6.8.0-45-generic xhci-hcd xHCI Host Controller
        Bus 002 Device 001: ID 1d6b:0003 Linux 6.8.0-45-generic xhci-hcd xHCI Host Controller
        Bus 001 Device 041: ID 03e7:2485 Movidius Ltd. Movidius MyriadX
        Bus 001 Device 003: ID 174f:1812   Integrated Camera
        Bus 001 Device 002: ID 06cb:0126   
        Bus 001 Device 005: ID 8087:0033   
        Bus 001 Device 001: ID 1d6b:0002 Linux 6.8.0-45-generic xhci-hcd xHCI Host Controller
        marcow@feather7:~$

        AadiKothari
        If what @mw46d said works, check the logs with dmesg.

        The device works in one mode -03e7:2485 Movidius Ltd. Movidius MyriadX when ready to accept connections, then 03e7:f63b 03e7 Luxonis Device when it is working (booted, running an app). It reconnects between these two states which could cause it not to be found again.

        Thanks,
        Jaka

        So I was able to see `Movidius Ltd. Movidius MyriadXinside the container.
        dmesg logs when running docker command:

        [11458.646754] usb 1-11.4.2: USB disconnect, device number 15
        [11459.465117] usb 4-1.4.2: new SuperSpeed USB device number 13 using xhci_hcd
        [11459.485888] usb 4-1.4.2: New USB device found, idVendor=03e7, idProduct=f63b, bcdDevice= 1.00
        [11459.485892] usb 4-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
        [11459.485893] usb 4-1.4.2: Product: Luxonis Device
        [11459.485893] usb 4-1.4.2: Manufacturer: Intel Corporation
        [11459.485894] usb 4-1.4.2: SerialNumber: 18443010E1C3341300

        dmesg logs after the docker command errored out:

        
        [11397.176981] usb 1-11.4.2: new high-speed USB device number 15 using xhci_hcd
        [11397.277553] usb 1-11.4.2: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
        [11397.277561] usb 1-11.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
        [11397.277564] usb 1-11.4.2: Product: Movidius MyriadX
        [11397.277565] usb 1-11.4.2: Manufacturer: Movidius Ltd.
        [11397.277567] usb 1-11.4.2: SerialNumber: 03e72485
        [11397.429049] usb 4-1.4.2: USB disconnect, device number 12
        [11402.614106] docker0: port 1(veth4311fef) entered disabled state
        [11402.614229] veth2920233: renamed from eth0
        [11402.683207] docker0: port 1(veth4311fef) entered disabled state
        [11402.684122] device veth4311fef left promiscuous mode
        [11402.684130] docker0: port 1(veth4311fef) entered disabled state

        One more things I tried (and it WORKED!?) is using docker command in root mode instead of rootless (I have docker setup in rootless on ubuntu). Tried docker command that worked:

        sudo docker run --rm     --privileged     -v /dev/bus/usb:/dev/bus/usb     --device-cgroup-rule='c 189:* rmw'     -e DISPLAY=$DISPLAY     -v /tmp/.X11-unix:/tmp/.X11-unix     luxonis/depthai-library:latest     python3 /depthai-python/examples/ColorCamera/rgb_preview.py

        dmesg log for the same:

        [11690.583268] usb 1-11.4.2: USB disconnect, device number 17
        [11691.356733] usb 4-1.4.2: new SuperSpeed USB device number 15 using xhci_hcd
        [11691.377736] usb 4-1.4.2: New USB device found, idVendor=03e7, idProduct=f63b, bcdDevice= 1.00
        [11691.377744] usb 4-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
        [11691.377747] usb 4-1.4.2: Product: Luxonis Device
        [11691.377749] usb 4-1.4.2: Manufacturer: Intel Corporation
        [11691.377750] usb 4-1.4.2: SerialNumber: 18443010E1C3341300

        I guess now the question comes down to how to make the same work in rootless mode?

        What does the id command tell you about your normal user? Is that user a member of the docker group?

        marcow@feather7:~$ id
        uid=80288(marcow) gid=10(uucp) groups=10(uucp),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),133(lxd),134(sambashare),136(vboxusers),999(docker)

        Yes:
        id

        uid=1000(aadi) gid=1000(aadi) groups=1000(aadi),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),108(kvm),120(lpadmin),133(lxd),134(sambashare),998(docker)

          AadiKothari
          Try adding this command either inside docker or outside in the OS:

          echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
          sudo udevadm control --reload-rules && sudo udevadm trigger

          Thanks,
          Jaka

          AadiKothari
          And inside the container? The passthrough clearly works, just seems to be an issue of permissions.

          Thanks,
          Jaka

          This fails inside the container since I do not have access to the host's device management system:

          udevadm control --reload-rules

          Failed to send reload request: No such file or directory

            AadiKothari
            I reran your exact setup and command and I am getting no issues.

            Does docker have RW perms?
            ls -l /var/run/docker.sock

            It works on sudo? Otherwise the error could just be power related.

            I know it sounds stupid, but generally when setting docker perms, it is best to either logout or restart the device to get the settings to apply.

            Thanks,
            Jaka