Hi, I am going round in circles need someone help with issue that Coral TPU not being available to HAOS Supervised from Frigate in docker. However Coral TPU is being passed through to Frigate in docker locally but not remotely to HAOS:
Setup:
HP Elitebook 800 G4 Mini i7 8700T processor with 16gb ram and 512GB M2 storage.
Google Coral TPU Usb
Proxmox 7.2 bare metal on HP Elitebook (Node 100) - IP 192.168.0.1
Promox VM (101) - IP 192.168.0.2 + Home Assistant OS (Supervised) Proxmox Version qcow2 + Mosquitto mqtt broker + Frigate (Full Access) connected to IP 192.168.0.3:5000
LCX container - IP 192.168.0.3 (“unprivileged container” unchecked, to make it privileged, with nesting) + Docker install with Portainer Stack install of Frigate (with Coral TPU passthrough working okay if accessed locally 192.168.0.3:5000)
When I access Frigate directly 192.168.0.3:5000 that is the Coral TPU USB passthrough from the Node to Frigate Docker, it works fine.
[2022-11-12 10:46:40] detector.coral INFO : Starting detection process: 217
[2022-11-12 10:46:40] frigate.edgetpu INFO : Attempting to load TPU as usb
[2022-11-12 10:46:42] frigate.edgetpu INFO : TPU found
The issue arises when I set Home Assistant frigate.yml to use TPU instead of CPU it cannot find the Coral USB despite the LXC container being “privileged” Frigate container.
[2022-11-12 23:53:56] detector.coral INFO : Starting detection process: 216
Process detector:coral:
[2022-11-12 23:53:56] frigate.edgetpu INFO : Attempting to load TPU as usb
[2022-11-12 23:53:56] frigate.edgetpu ERROR : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
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 “/usr/lib/python3.9/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/usr/lib/python3.9/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/opt/frigate/frigate/edgetpu.py”, line 135, in run_detector
object_detector = LocalObjectDetector(
File “/opt/frigate/frigate/edgetpu.py”, line 43, in init
edge_tpu_delegate = load_delegate(“libedgetpu.so.1.0”, device_config)
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.0
Is it that the LXC Frigate Container has access to the TPU and will not share it with the HAOS supervised Frigate (Full Access) at the same time? I am completely lost.
I want to use Home Assistant UI with Frigate at is works and recordings and clips playback in H265 as Frigate docker direct 192.168.0.3:5000 only plays back h264 which I do not want.
You only have to run Frigate in your LXC container and then, in your HAOS VM, you don’t have to install the full Frigate add-on, only the Frigate integration. When you add the Frigate integration, you’ll be able to enter your Frigate LXC IP.
Thanks for creating this convenience script
This is what is does on my side:
## Docker LXC
#### https%3A//tteck.github.io/Proxmox/
#<a href='https%3A//ko-fi.com/D1D7EP4GF'><img src='https%3A//img.shields.io/badge/%E2%98%95-Buy me a coffee-red' /></a>
arch: amd64
cores: 2
features: nesting=1,keyctl=1
hostname: frigate
memory: 4096
net0: name=eth0,bridge=vmbr0,hwaddr=96:84:5B:EE:EF:3B,ip=dhcp,tag=1003,type=veth
onboot: 1
ostype: debian
rootfs: local:101/vm-101-disk-0.raw,size=8G
swap: 512
unprivileged: 1
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for char_dev in $(find /sys/dev/char -regextype sed -regex ".*/1:1" -o -regex ".*/29:0" -o -regex ".*/188:.*" -o -regex ".*/189:.*" -o -regex ".*/226:0" -o -regex ".*/226:128"); do dev="/dev/$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" ${char_dev}/uevent)"; mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dpR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dpR $dev ${LXC_ROOTFS_MOUNT}${dev};done;'
()
run_buffer: 321 Script exited with status 1
lxc_setup: 4408 Failed to run autodev hooks
do_start: 1275 Failed to setup container "101"
sync_wait: 34 An error occurred in another process (expected sequence number 4)
__lxc_start: 2074 Failed to spawn container "101"
TASK ERROR: startup for container '101' failed
Commenting the lxc.hook.autodev makes the ct start again.
but after some minutes it return a veeeery long error that ends like this "ror response from daemon: error gathering device information while adding custom device “/dev/bus/usb”: no such file or directory ".
@importfanatik So I got it working but I have a question.
So do I still use the blueiris integration to display the camera feed inside the UI lovelace minimalist dashboard? or do I pass the feed from frigate to the dashboard? How do I integrate frigate feed on the lovelace UI using yaml?
I would recommend passing the camera straight through to home assistant. Bouncing through frigate will add a little lag from what I have seen. (See appendix A at the beginning of this thead)
I have worked Frigate but not the Coral. The LXC recognize the USB Coral but frigate say there is no Coral. On Homeassistant the Coral works with frigate but I had sometimes problems with it.
root@frigate ~# lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 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 003: ID 10c4:ea60 Silicon Labs CP210x UART Bridge Bus 001 Device 004: ID 8087:0026 Intel Corp. Bus 001 Device 002: ID 1a86:7523 QinHeng Electronics CH340 serial converter Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1a6e:089a Global Unichip Corp.
I just realize that the LXC created will have userID and groupID 100000:100000
This way I cant ssh to LXC with root. What is the best way to change it so it will work?