Docker + Frigate

Hi All,

I’m gettings errors when passing through my USB coral.
Seen a few posts that had the same problem but can’t get it solved, so i might be missing something.

On ProxMox i have an LXB container running docker > portainer > frigate. Edited the host with the following:

lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: a
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0
lxc.mount.entry: /dev/bus/usb/002 dev/bus/usb/002 none bind,optional,create=dir 0, 0
lxc.cap.drop:
lxc.mount.auto: cgroup:rw

The host has the Google Coral on bus 002

My portainer stack:

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable-amd64
    shm_size: "1g" # update for your cameras based on calculation above
    devices:
      - /dev/bus/usb/:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
    volumes:
      - /etc/localtime:/etc/localtime
      - /home/frigate/config.yml:/config/config.yml
      - /home/frigate/media:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "welkom"

The error i receive:

Alright. So i started from scratch…
I found a GitHub post were somebody posted it’s working config.

In ProxMox i created a freshly Debian 11 install with Docker.
For the visual part i’ve installed Portainer.

In portainer i used the following stack, which returns me with again an error:

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable-amd64
    devices:
      - /dev/bus/usb:/dev/bus/usb
      #You should not need to map through other devices for hardware acceleration when the Coral TPU is used.
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/frigate/config.yml:/config/config.yml:ro
      - /home/frigate/media:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "welkom"

On the Proxmox host i changed the container settings to:

arch: amd64
cores: 2
features: nesting=1
hostname: Frigate
memory: 1024
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=3A:BE:EF:69:53:F2,ip=dhcp,type=veth
ostype: debian
rootfs: local-lvm:vm-103-disk-0,size=10G
swap: 512
unprivileged: 1
#The USB device id's mentioned below might be different for you device.
#Run `lsusb` to see which USB devices are connected on your Proxmox host and adjust accordingly.

#Before the driver is loaded, the Coral TPU presents itself as a 'Unicorp' device.
usb0: host=1a6e:089a,usb3=1
#After the driver is loaded, the TPU presents itself as a 'Google' device.
usb1: host=18d1:9302,usb3=1

#The configuration below was copied from: https://github.com/blakeblackshear/frigate/issues/1065#issuecomment-835175872
#I'm not a PVE wizard; these configs might or might not be sane or useful - but they did the trick for me. 

lxc.cgroup.devices.allow: c 226:0 rwm
lxc.cgroup.devices.allow: c 226:128 rwm
lxc.cgroup.devices.allow: c 29:0 rwm
lxc.cgroup.devices.allow: c 189:* rwm
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

And finally; the error i receive:
image

Permission error maybe?
User cannot access device

I got this solved. Still when i deploy the stack and frigate starts, it says:

[2022-07-13 07:11:45] frigate.edgetpu                ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
Process detector:coral:
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.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/frigate/frigate/edgetpu.py", line 136, in run_detector
    object_detector = LocalObjectDetector(
  File "/opt/frigate/frigate/edgetpu.py", line 44, 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

I’ve change to LXC container to the following:

arch: amd64
cores: 2
features: nesting=1
hostname: Frigate
memory: 1024
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=3A:BE:EF:69:53:F2,ip=dhcp,type=veth
ostype: debian
rootfs: local-lvm:vm-103-disk-0,size=10G
swap: 512
unprivileged: 1
lxc.mount.entry: /dev/bus/usb/001/ dev/bus/usb/001/ none bind,optional,create=dir 0, 0
lxc.mount.entry: /dev/bus/usb/002/ dev/bus/usb/002/ none bind,optional,create=dir 0, 0
lxc.mount.entry: /dev/bus/usb/003/ dev/bus/usb/003/ none bind,optional,create=dir 0, 0
lxc.mount.entry: /dev/bus/usb/004/ dev/bus/usb/004/ none bind,optional,create=dir 0, 0
lxc.cgroup.devices.allow: c 226:0 rwm
lxc.cgroup.devices.allow: c 226:128 rwm
lxc.cgroup.devices.allow: c 29:0 rwm
lxc.cgroup.devices.allow: c 189:* rwm
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

The stack i deploy in Portainer is:

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable-amd64
    devices:
      - /dev/bus/usb:/dev/bus/usb
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/frigate/config.yml:/config/config.yml:ro
      - /home/frigate/media:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "welkom"

Still no luck on this one :frowning:

See comment on Jan 4 from Cruzzer in THIS GITHUB LINK. Looks like permission issue.

1 Like