Google Coral USB + Frigate + PROXMOX

Yes i solved it. I dont remember exactly how i fixed it but if you post your portainer stack config and your yaml maybe i can help you.

@sewershagger what kernel version are you running on a Linux? I run my entire stack in Proxmox. If my kernel is 6.2.11, the m.2 TPU is seen by the OS and everywhere but not by Frigate. Frigate crashes and logs show it can see the TPU but cannot utilise it. If I Run kernel 6.0.1 it all works fine

This script is wonderfull! Thanks to @tteck !!!

To check what is going on ā†’ You can download the script in you browser with URL:
https://github.com/tteck/Proxmox/raw/main/misc/frigate-support.sh

2 Likes

had the same problem today. try this:


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: "64mb" # 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
      #- /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
      #- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/frigate/config.yml:/config/config.yml:ro
      #- /media/frigateUSBSSD:/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
      - "8554:8554" # Birdseye In v 0.12
    environment:
      FRIGATE_RTSP_PASSWORD: password

@huntj06 this was what i needed. thank you thank you thank you. @importfanatik could you add this please?

Under part 4 the docker commands changed. but the link to docker docs did it

Hello Guys,

I just try to make this whole process, but Iā€™m stucked at almost the end.
The portainer.io is ready and works, but Frigate stops with error. I followed the written instructions and the videos also, as well as the comments here, but without success.
I attach the content of config.yml, frigate stack and the log of docker, so I hope you have idea what I made wrong.
I have Coral, but first I would see it work then I step forward.

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:
      - /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
      #- /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
      #- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /config/config.yml:/config/config.yml:ro
      #- /path/to/your/storage:/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
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "pass"

2023-06-28 19:46:46.026998931  [INFO] Preparing go2rtc config...
s6-rc: info: service frigate successfully started
2023-06-28 19:46:46.033607177  [INFO] Starting Frigate...
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
2023-06-28 19:46:46.097439259  [INFO] Starting NGINX...
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
  File "/usr/local/go2rtc/create_config.py", line 23, in <module>
    with open(config_file) as f:
IsADirectoryError: [Errno 21] Is a directory: '/config/config.yml'
2023-06-28 19:46:46.252541027  [INFO] The go2rtc service exited with code 1 (by signal 0)
2023-06-28 19:46:47.094979077  *************************************************************
2023-06-28 19:46:47.094983089  *************************************************************
2023-06-28 19:46:47.094985442  ***    Your config file is not valid!                     ***
2023-06-28 19:46:47.094987633  ***    Please check the docs at                           ***
2023-06-28 19:46:47.094989368  ***    https://docs.frigate.video/configuration/index     ***
2023-06-28 19:46:47.094991424  *************************************************************
2023-06-28 19:46:47.095006060  *************************************************************
2023-06-28 19:46:47.095016273  ***    Config Validation Errors                           ***
2023-06-28 19:46:47.095017750  *************************************************************
2023-06-28 19:46:47.095018887  [Errno 21] Is a directory: '/config/config.yml'
2023-06-28 19:46:47.095031480  Traceback (most recent call last):
2023-06-28 19:46:47.095032832    File "/opt/frigate/frigate/app.py", line 351, in start
2023-06-28 19:46:47.095034115      self.init_config()
2023-06-28 19:46:47.095035348    File "/opt/frigate/frigate/app.py", line 80, in init_config
2023-06-28 19:46:47.095044734      user_config = FrigateConfig.parse_file(config_file)
2023-06-28 19:46:47.095046039    File "/opt/frigate/frigate/config.py", line 1070, in parse_file
2023-06-28 19:46:47.095047247      with open(config_file) as f:
2023-06-28 19:46:47.095048446  IsADirectoryError: [Errno 21] Is a directory: '/config/config.yml'
2023-06-28 19:46:47.095049397  
2023-06-28 19:46:47.095065386  *************************************************************
2023-06-28 19:46:47.095066697  ***    End Config Validation Errors                       ***
2023-06-28 19:46:47.095067893  *************************************************************
2023-06-28 19:46:47.095839606  [2023-06-28 19:46:47] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2023-06-28 19:46:47.257099090  [INFO] Preparing go2rtc config...
Traceback (most recent call last):
  File "/usr/local/go2rtc/create_config.py", line 23, in <module>
    with open(config_file) as f:
IsADirectoryError: [Errno 21] Is a directory: '/config/config.yml'
2023-06-28 19:46:47.445974687  [INFO] The go2rtc service exited with code 1 (by signal 0)
2023-06-28 19:46:48.254708692  [INFO] Service Frigate exited with code 1 (by signal 0)

You created a folder not a file.

Create a new config.yml file and pay attention that itā€™s a file and not a folder. In the console the folders can be identified by a different color in text
@Wikktor

Hi all, I got my Coral USB device working on a proxmox host (version 8.0.3), with Home Assistant OS 10.3 as virtual machine and with the Frigate addon (0.12 Full access) enabled in Home Assistant.

To make a long story short:

  • Install drivers on proxmox host and make sure that the USB device is recognized (as explained here: https://coral.ai/docs/accelerator/get-started/#runtime-on-linux).
  • add USB device to Home Assistant VM; Iā€™ve used the ā€œUse USB Vendor/Device IDā€
  • install the Portainer addon in Home Assistant
  • install the Frigate 0.12 Full Access addon
  • start portainer and edit/duplicate the Frigate container. Add an ENV variable:
    name: /dev/bus/usb
    value: /dev/bus/usb

add the following to your frigate.yml:

detectors:
  coral:
    type: edgetpu
    device: usb

That did the trick for me without using a separate LXC. :partying_face:

One issue though: Home Assistant keeps reporting that a restart is required:
Repair issue

The default configuration for add-ons and Home Assistant has changed. To update the configuration with the new defaults, a restart is required for the following:

  • Frigate (Full Access) Beta (0.12.0)

But even after a restart the USB is detected and used, but the message is still thereā€¦

2 Likes

Hi @pingme,

I spent my weekend to migrate my HA supervised on my RPI4 to my new Dell Optiflex with Proxmoxā€¦

Impossible to configure Frigate into LXC even by following tutorial. I finally use frigate addon and it works fine with simple configuration. But impossible to use my USB coral. The first problem is that, I canā€™t install the driver ā€œpython3-pycoralā€. I think that is the main problem. Any idea ? (I know that there is an alternative with ā€œpip installā€ but I donā€™t know how to doā€¦).

Thank you very much.

@urel

Anyone figure out how to get the coral from changing USB Buses or CGroups randomly?
I tried udev rules but no luckā€¦

1 Like

Iā€™ve found your scripts a while ago. thank you. Like all of them. I added feature request in GitHub though and have had no response. Could you check it out.

did you install the driver inside the docker container? than unplug and plug in again the coral

same problem here too. i used the script from tteck which configs the frigate container.

Thank you for this. Now I finally got my coral usb working with Proxmox. Took me a while to get it, but thatā€™s mainly due to my inexperience with portainer and docker in general.

Itā€™s running nicely now. CPU usage on my host went down from 90% to around 30% so Iā€™m happy.

As for remote storage, I managed to setup an NFS share on my NAS that I use for this. Youā€™re option with ZFS only seems to work on the lvm-local from proxmox and that has very limited storage in my case.

But like I said, I got it working now so thanks again.

wow, thank you, ā€¦ works like a champ nowā€¦ that issues is fixed now.

OMG you just saved me from losing my sanity!! Spent the last 8 hours trying every possible solution, on proxmox, on virtualbox, on windows with codeproject.
Waited about 2 yrs to get a coral and that last comment in the config did it!!
Before it just kept crashing and restarting.

:grinning: :grinning: :grinning:

Did u manage to update it? I cant figure it out lol

Does anyone know why I could be exiting with 400?
(Request failed with status code 400)

When I look at the container logs they seem to be empty

  • have tried restarting docker, the server, etc
  • my config.yml is very skinny (although after seeing the logs that isnt the issue)
  • I 755ed the config.yml

My setup is working flawless but i want to update my frigate version.
To my knowledge the process to update should be to stop the container in portainer and then recreate the container and re-pull the image but when i do that i get error 500.
why is that?
frigate

Good day
Iā€™ve been all over the places, including this thread, trying to get the correct setup for my use case.
Iā€™ve got a beefed-up NUC i9-13900H 32GB running Proxmox 8.0.4.
My HA instance is installed on a VM and running flawlessly.
As per most recommendations, Iā€™d setup frigate on LXC + Docker with a particular scenario where I have 2 USB Coral to pass-through. I know, it seems an overkill but I get Inference Speed of 7.67ms top each. I improved a lot in load balancing using 2 corals because Iā€™m running 10 Reolink RLC-522 cameras.
At first everything seem to work fine, the corals connected to Bus 002 but the Device ID change sometimes mostly on host reboot. When I connect via a USB3 hub the Bus number & Device ID change like crazy even without a reboot.

Here is my concern: in less that an hour while everything apparently working, I loose connectivity to the PVE web interface. The HA VM & frigate container are not accessible. It behaves like the host went into idling. Sometimes the host shutdown. Iā€™m newbie in Proxmox and I canā€™t help myself digging out of the hole.

PS: I suspect that the corals are to blame. When I disconnect them the connectivity issues disappear.

Thanks in advance.

1 Like