Description:

Recently I bought two Google Coral Edge TPU (USB accelerator) and got this error when I tried to run provided examples in a container: ValueError: Failed to load delegate from libedgetpu.so.1 . Fast googling showed some absurd advices like mount /dev/bus/usb in addition to --privileged option, reboot system etc. What's in reality:

libedgetpu1-std package contains udev rules which add plugdev group for google coral usb devices:

# cat /lib/udev/rules.d/60-libedgetpu1-std.rules
SUBSYSTEM=="usb",ATTRS{idVendor}=="1a6e",ATTRS{idProduct}=="089a",GROUP="plugdev"
SUBSYSTEM=="usb",ATTRS{idVendor}=="18d1",ATTRS{idProduct}=="9302",GROUP="plugdev"

These rules work just fine on a host system, but not in a container (at least in a single app scenario). So, when you start container with --privileged option it doesn't automatically mean that your uig/gid are the same as on a host because of subuid/subgid approach.

Well, when you run edgetpu examples inside container, an app just cannot write to host USB device files and the error appears. Quick fix for this is replacing udev rules to:

# cat /lib/udev/rules.d/60-libedgetpu1-std.rules
SUBSYSTEM=="usb",ATTRS{idVendor}=="1a6e",ATTRS{idProduct}=="089a",MODE="0666"
SUBSYSTEM=="usb",ATTRS{idVendor}=="18d1",ATTRS{idProduct}=="9302",MODE="0666"

One more thing. I saw different messages about "initializing" google coral devices and didn't understand what it is (online registration? some special actions?).

What that means:

  • By default, google coral device is showed in system as: 1a6e:089a Global Unichip Corp.
  • After running provided examples the work mode changes (it can be considered as USB composite device) and device is showed as: 18d1:9302 Google Inc. During mode switching new character device is created, thus this new device should be properly shared with a container through rshared/biderectional options (especially in nested containers environments).