Google Coral USB + Frigate + PROXMOX

I cant make to work with the coral. The coral is recognized and passedtrough the LXC (i can run the test from coral, and when doing lsusb it appears as “Google Inc”). If I put in the config.yml the detector using cpu it works fine, but when changing to the edgetpu the the container doesnt start well and portainer show some errors (and cant see the logs):

This is my working config without coral. It works ok.

mqtt:
  host: 192.168.86.80
  port: 1883
  user: user
  password: mqttpass

birdseye:
  enabled: True
snapshots:
  enabled: True
cameras:
  timbre:
    ffmpeg:
      inputs:
        - path: rtsp://user:[email protected]:554
          roles:
            - detect
            - rtmp

But when i change the config to this it doesnt work, even if i can use the coral in the docker…

mqtt:
  host: 192.168.86.80
  port: 1883
  user: user
  password: mqttpass
detectors:
  coral:
    type: edgetpu
    device: usb
birdseye:
  enabled: True
snapshots:
  enabled: True
cameras:
  timbre:
    ffmpeg:
      inputs:
        - path: rtsp://user:[email protected]:554
          roles:
            - detect
            - rtmp

Proof that the coral is passed trough the lxc:

root@docker ~/frigate# lsusb
Bus 002 Device 005: ID 18d1:9302 Google Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0a2b Intel Corp. Bluetooth wireless interface
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I dont know what else i can do

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.

1 Like

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.

Hello tteck,

Thanks for creating this convenience script :slight_smile:
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.

Will only work with privileged (unprivileged: 0) containers.

Oups sorry, thanks :blush:

Hello, please help me, it is hours i am looking for a solution:

I am trying to compile the stack inside portainer with this code:

#######################FRIGATE
version: '1.0'
services:
  frigate:
   container_name: frigate
   image: blakeblackshear/frigate:stable-amd64
   restart: always
   devices:
    - /dev/bus/usb:/dev/bus/usb
   volumes:
    - /etc/localtime:/etc/localtime
    - /home/frigate/config.yml:/config/config.yml:ro
   ports:
    - 5000:5000
    - 1935:1935
   environment:
    FRIGATE RTSP PASSWORD: "--------"

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 ".

Please, anyone has a solution?

Is your lxc privileged?

Why have you posted the same thing twice?

I unchecked the unpriviliged flag when i created the container in proxmox, maybe i should try to recreate it? Thanks

@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?

Thanks

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)

Show the config of stack from Portainer

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.

This is the Coral.

@tteck your script worked like a charm - many thanks buddy.
What exactly does this script do? Fixes udev rules or what?

1 Like

The coral usb changes id once it has been used by the software.

How can i update the frigate version in portainer?

I’m not winning. Please help!

you need to add “services:” first:

services:
  frigate:
    container_name: frigate


I added it but no. still same error.