• DepthAIROS
  • X_LINK_DEVICE_NOT_FOUND inside depthai-ros container

When running the depthai_viewer using python3 -m depthai_viewer inside deptha-ai ros container (ros humble), I keep getting

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

[2024-08-23T06:48:01Z ERROR re_viewer::depthai::depthai] Error: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND, Try to connect the device to a different port.

[2024-08-23 06:48:02.166] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.12.4.4"

What is weird to me is that my udev rules are set on the host, and I am mounting my /dev/usb folder.

Additionally the viewer works fine on my host and I am able to view my camera output, but isnide the container I am getting the above error Please help.

If curious, this was my docker run command:

docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix luxonis/depthai-ros:humble-latest /bin/bash

    AadiKothari
    It's usually a USB communication issue. Could you try running a simple example? Also add XLINK_LEVEL=DEBUG env variable before running the script. It might give some insight on what is happening.

    Thanks,
    Jaka

    I set that env variable but no luck; here are all my logs:

    python3 -m depthai_viewer

    [2024-08-24T21:58:06Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1

    error: XDG_RUNTIME_DIR not set in the environment.

    error: XDG_RUNTIME_DIR not set in the environment.

    error: XDG_RUNTIME_DIR not set in the environment.

    error: XDG_RUNTIME_DIR not set in the environment.

    Backend started successfully.

    [2024-08-24T21:58:09Z INFO ewebsock::native_tungstenite] WebSocket handshake has been successfully completed

    [2024-08-24T21:58:09Z INFO re_viewer::depthai::ws] Websocket opened

    Selecting device: 18443010E1C3341300

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

    [2024-08-24 21:58:27.488] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.12.4.4"

    [2024-08-24T21:58:27Z ERROR re_viewer::depthai::depthai] Error: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND, Try to connect the device to a different port.

    Selecting device:

    cc @Luxonis-Adam not necessarily a ROS issue, but seems to be a docker one(?). Since you have more experience running depthai from within docker environment.

    Thanks,
    Jaka

    Hi, does the output change if you mount /dev/ instead of /dev/bus/usb?

    a month later

    No luck same output:

    [2024-09-28T18:36:25Z INFO  winit::platform_impl::platform::x11::window] Guessed window scale factor: 1
    error: XDG_RUNTIME_DIR not set in the environment.
    error: XDG_RUNTIME_DIR not set in the environment.
    error: XDG_RUNTIME_DIR not set in the environment.
    error: XDG_RUNTIME_DIR not set in the environment.
    Backend started successfully.
    [2024-09-28T18:36:28Z INFO  ewebsock::native_tungstenite] WebSocket handshake has been successfully completed
    [2024-09-28T18:36:28Z INFO  re_viewer::depthai::ws] Websocket opened
    Selecting device:  18443010E1C3341300
    Failed to select device: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
    [2024-09-28 18:36:46.222] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.12"
    [2024-09-28T18:36:46Z ERROR re_viewer::depthai::depthai] Error: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND, Try to connect the device to a different port.
    Selecting device:  

    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