Closed dme11 closed 9 months ago
Hi,
I had the same issue, I created a udev rules
nano /etc/udev/rules.d/98-coral.rules
then add
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", OWNER="root", SYMLINK+="coral", MODE="0666", GROUP="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", OWNER="root", SYMLINK+="coral", MODE="0666", GROUP="plugdev"
then reload rules
udevadm control --reload-rules && udevadm trigger
Hi,
First of all thank you for your time trying to help me.
I've created suggested udev rules and reloaded rules. Now lsusb
command on the host and in the LXC shows:
Bus 002 Device 004: ID 18d1:9302 Google Inc. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
That's so even if I disconnect the USB Coral TPU from the host and connect it back. I'm no Linux expert but that the Coral TPU USB is recognized as Google and not Global Unichip without actually flashing the FW to it first doesn't solve the LXC USB permissions issue. As result, pycoral example within LXC unfortunately does not work. Error log reported after running parrot example is as follows:
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate delegate = Delegate(library, options) File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in init raise ValueError(capture.message) ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "examples/classify_image.py", line 121, in
main() File "examples/classify_image.py", line 71, in main interpreter = make_interpreter(*args.model.split('@')) File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter delegates = [load_edgetpu_delegate({'device': device} if device else {})] File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {}) File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate raise ValueError('Failed to load delegate from {}\n{}'.format( ValueError: Failed to load delegate from libedgetpu.so.1
I'm not able to flash the FW using webcoral example either. The error log after make reset
command shows:
dfu-util: Warning: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release dfu-util: No DFU capable USB device available
Also, when started Frigate the log shows "No EdgeTPU was detected".
Regards,
Dusan
from the lxc list the device permission withls -l /dev/dri/002/004
you should see something like
crw-rw-rw- 1 nobody nogroup
if the permission is set correctly.
if it's ok and still not working, you should execute this check from the container
Hi,
You probably meant ls -l /dev/bus/usb/002/004
?
If so, here are the outputs from Proxmox host:
crw-rw-r-- 1 root root 189, 131 Jan 30 22:31 /dev/bus/usb/002/004
and from within the LXC:
crw-rw-r-- 1 nobody nogroup 189, 131 Jan 30 21:31 /dev/bus/usb/002/004
BR, Dusan
I think it should rw for others chmod 666 /dev/bus/usb/002/004
and check your rules
It seems that I as a root user within LXC cannot change permissions:
root@frigate:/# chmod 666 /dev/bus/usb/002/004 chmod: changing permissions of '/dev/bus/usb/002/004': Operation not permitted
You should do it from the host
Le mer. 31 janv. 2024, 10:12, dme11 @.***> a écrit :
It seems that I as a root user within LXC cannot change permissions:
@.***:/# chmod 666 /dev/bus/usb/002/004 chmod: changing permissions of '/dev/bus/usb/002/004': Operation not permitted
— Reply to this email directly, view it on GitHub https://github.com/blakeblackshear/frigate/issues/9436#issuecomment-1918687309, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHEAHDTX37SVBFU4A2EM3DYRIDH7AVCNFSM6AAAAABCKEK642VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJYGY4DOMZQHE . You are receiving this because you commented.Message ID: @.***>
I used the chmod command in the host and now the parrot example works.
The USB port permissions command now reports both in host and LXC as follows :
crw-rw-rw- 1 root root 189, 131 Jan 31 11:07 /dev/bus/usb/002/004
Parrot example output from the LXC:
----INFERENCE TIME---- Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory. 13.3ms 4.4ms 4.4ms 4.5ms 4.4ms -------RESULTS-------- Ara macao (Scarlet Macaw): 0.75781
And finally Frigate reports:
Many thanks for your help. I've been banging my head for days combing different forums trying to find the solution.
One final question: is there a way to make the last chmod permission change permanent so it'll be applied automatically after host reboot/powerdown?
Check the udev rules, that should fix the reboot point.
Le mer. 31 janv. 2024, 11:25, dme11 @.***> a écrit :
I used the chmod command in the host and now the parrot example works.
The USB port permissions command now reports both in host and LXC as follows :
crw-rw-rw- 1 root root 189, 131 Jan 31 11:07 /dev/bus/usb/002/004
Parrot example output from the LXC:
----INFERENCE TIME---- Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory. 13.3ms 4.4ms 4.4ms 4.5ms 4.4ms -------RESULTS-------- Ara macao (Scarlet Macaw): 0.75781
And finally Frigate reports: image.png (view on web) https://github.com/blakeblackshear/frigate/assets/157683853/f2fc2911-1a3a-417b-8b72-a1f7a7006836
Many thanks for your help. I've been banging my head for days combing different forums trying to find the solution.
One final question: is there a way to make the last chmod permission change permanent so it'll be applied automatically after host reboot/powerdown?
— Reply to this email directly, view it on GitHub https://github.com/blakeblackshear/frigate/issues/9436#issuecomment-1918816648, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHEAHBBRX23CP5GFCDKTXTYRIL25AVCNFSM6AAAAABCKEK642VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJYHAYTMNRUHA . You are receiving this because you commented.Message ID: @.***>
I've modified udev rules a bit. Just in case I've put both possible vendor and product ID's (unflashed and flashed USB Coral TPU). The content of my 98-coral.rules
files is as follows:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", OWNER="root", MODE="0666", GROUP="plugdev" SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", OWNER="root", MODE="0666", GROUP="plugdev"
and reloaded the rules by
udevadm control --reload-rules && udevadm trigger
I'd like to thank you again for your help and patience with me.
Regards,
Dusan
Guess my issue is solved and I can close the ticket.
Describe the problem you are having
Hello, I've installed Frigate in unprivileged LXC container by following this instructions. Installation went well, Frigate starts but it doesn't detect Coral TPU. I've checked various forums related to TPU detection problem and nothing I've tried didn't work. Also, neither webcoral and parrot examples flash the FW to TPU from unprivileged container (Ubuntu v20.04 with default Python v3.8.10), so it' no surprise that Frigate can't detect and flash the FW to TPU.
I assume the issue is related to USB port permissions since I've managed to get Coral TPU detected in Frigate when installed in privileged LXC container.
I'd appreciate any guidance helping to solve this problem.
Regards,
Dusan
Version
0.12.1-367D724
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
No response
Operating system
Proxmox
Install method
Docker Compose
Coral version
USB
Network connection
Wired
Camera make and model
Dahua IPC-HFW1530S
Any other information that may be helpful
Below some more information about the current configuration.
Host info Operating System: Debian GNU/Linux 12 (bookworm) Kernel: Linux 6.5.11-7-pve Architecture: x86-64 Hardware Vendor: Protectli Hardware Model: FW6 Firmware Version: coreboot 4.12, Dasharo 1.0.14 Proxmox PVE version: pve-manager/8.1.4/ec5affc9e41f1d79 (running kernel: 6.5.11-7-pve)
Host USB info Bus 002 Device 002: ID 1a6e:089a Global Unichip Corp. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
LXC container USB info Bus 002 Device 002: ID 1a6e:089a Global Unichip Corp. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
LXC container config arch: amd64 cores: 2 features: nesting=1 hostname: frigate memory: 4096 mp0: /mnt/lxc_shares/frigate_network_storage/,mp=/opt/frigate/media net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:4A:28:D0,ip=dhcp,type=veth onboot: 1 ostype: ubuntu rootfs: local-lvm:vm-100-disk-0,size=20G swap: 512 unprivileged: 1 usb0: host=1a6e:089a,usb3=1 usb1: host=18d1:9302,usb3=1 lxc.cgroup2.devices.allow: c 189:* rwm lxc.mount.entry: /dev/bus/usb/002 dev/bus/usb/002 none bind,optional,create=dir lxc.cgroup2.devices.allow: c 226:0 rwm lxc.cgroup2.devices.allow: c 226:128 rwm lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0 lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
Docker compose file version: "3.9" services: frigate: container_name: frigate privileged: true # this may not be necessary for all setups restart: unless-stopped image: ghcr.io/blakeblackshear/frigate:stable shm_size: "128mb" # update for your cameras based on calculation above devices: