Google Coral USB + Frigate + PROXMOX

paste your code here. It seems your spacing is wrong. “restart” and the other lines should be at the same level as “container_name” and not “services”

Hi all,

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?

TIA

Generally speaking ssh as root is not typically a good idea
Create a user inside the LXC
as root
adduser <username>
answer questions
Debian doesn’t have sudo installed
apt install sudo
Add your new user to the sudo group
usermod -aG sudo <username>
Now you can ssh in as your user and use sudo to do the things you need to do.
Also you should run your docker container under your user and not under root. You can run under root if you really want to but there is really no reason to do so.

2 Likes

So I just moved my Frigate from HA running on the same proxmox host over to its own LXC and the results are amazing compared to what I was getting.
Problem I have now though is that I cannot for the life of me get it to run at USB3 speeds. My NUC HPT610 has 2 USB3 ports and I’m plugged into one of them with what I thought was a good decent cable. I ordered another cable from AMZ but with where I live out in the country I won’t get it in until next week.

user@frigate ~/docker/frigate$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M
    |__ Port 1: Dev 2, If 0, Class=Communications, Driver=usbfs, 12M
    |__ Port 1: Dev 2, If 1, Class=CDC Data, Driver=usbfs, 12M
    |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
    |__ Port 2: Dev 3, If 1, Class=Vendor Specific Class, Driver=usbfs, 12M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/4p, 480M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/4p, 480M
user@frigate ~/docker/frigate$ lsusb
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 10c4:8a2a Silicon Labs HubZ Smart Home Controller
Bus 005 Device 002: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 18d1:9302 Google Inc.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So you can see that the one port that is not currently in use is showing its port speed as 5000M but the other USB3 port is only showing 480M. I’ve tried moving it to the other port as well with the same results.
I don’t know if there is something misconfigured on this host that I need to install to enable the full power of the USB3 or if it is just because of the cable that I’m using. I’ve tried another cable with the same results as this and that cable wasn’t exactly in amazing condition.
If anyone knows of anything you need to do in proxmox/debian to unlock the full speed let me know and I’ll post back once I get the new cable in next week and see if that does anything. My inference speed is currently up in the 100-150ms range which is incredible compared to where it was at when it was at 1700+ms running as an addon to my HA instance.

a simple question, why do we need to have the Fridgate installed in its own container? why we cannot use the HA Adds on of the Fridgate in HA?
Having said that I still could not pass through the USB to HA, but still not sure why we cannot
take advantage of the HA’s Add-on.

Why do you say that? You can pass USB devices just fine to unprivileged containers.

With additional work.

Got it. So not “only” then :slight_smile:

I recommend reading the complete thread as the term “only” pertains specifically to the mentioned script.

Usually, people come here to ask questions etc, but let me be the one who says Thank you to all who contributed to this page.
After months of battling with WSL2 and trying to pass through the TPU via USBIP, decided to get things right, installed Proxmox, and followed this instruction and now look what I can see in the log file:

[2023-03-22 10:44:50] detector.coral                 INFO    : Starting detection process: 209
[2023-03-22 10:44:50] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2023-03-22 10:44:53] frigate.edgetpu                INFO    : TPU found

To that point, Thank you, Thank you, Thank you

2 Likes

Thank you so much for putting together the steps. I am a complete newbie when coming to setting proxmox, containers etc.

I do have some issues. I have unifi protect cameras and had to add the output arguments suggested by the documentation from frigate. However, it’s showing a still image instead of video played at 5 fps. If I refresh the frigate web interface, it will update to the next still image. When directly playing the stream on an RTSP player it’s working fine. I am not sure if it’s a container issue. I am going to try installing frigate in HA and see if it’s better.

There are few things that stumpled me when following your guide and needed to look through the videos and other reference.

  1. When setting up the LXC container, the video reference showed unprivileged and if you uncheck you cannot enable keyctl under the option menu. Maybe you can force it through the .conf file but I did not try
  2. Step 27.3 2.Step 2 is missing “|” between the two gpg
2 Likes

This did if for me! Thank you!

It was the only issue that helped me solve my problem with coral detection.

To find out which cgroup my proxmox minipc nuc belonged to I used the following command:

mount | grep cgroup

and it returned the following
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime)

then i followed your steps and now everything works fine, i love you bro! :heart_eyes: :kissing_heart:

3 Likes

I get all the way to adding a new stack.
when I add homeautomation I get failed to deploy stack additional property frigate is not allowed"
I did a copy of homeautomation stack from text.Any pointers?

This article helped at lot, thanks!

I’m using Turnkey Linux as the LXC container on the latest version of Proxmox and I ran into issues with Portainer with the container restarting. I also had issues with the Frigate container not detecting the Coral despite it being shown after running $ lsusb

To fix this:

I ran the example code from Set up a new device | Coral inside the LXC container first, the device was then detected and I passed the usb device to the Frigate container by using the privileged flag and the /dev/bus/usb volume mount. I’m not sure but I suspect without the Coral being initialised first it doesn’t report the correct USB device name.

docker run -d --privileged --restart=always -v /etc/localtime:/etc/localtime -v /frigate:/config -v /frigate/clips:/media/frigate/clips -v /frigate/recordings:/media/frigate/recordings -p 5000:5000 -p 1935:1935 -v /dev/bus/usb:/dev/bus/usb -e FRIGATE_RTSP_PASSWORD=<redacted> blakeblackshear/frigate:stable

I hope this helps.

1 Like

I am working through the same issue. It appears that the image has moved locations with the latest release, and portainer/docker compose has changed versions since this tutorial was written. I was able to modify the following from the frigate installation manual to get the stack to deploy.

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
      - /path/to/your/config.yml:/config/config.yml
      - /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"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "password"

I’ve tried everything as well, but did not have the same results. I loaded the example code and it runs within Proxmox successfully, but it will not run within the lxc. One bit of progress I have seen, which others also reported, is the usb device changed to 18d1:9302 Google Inc which I hoped would be the solution, but not yet.
If anyone has any other ideas, I’d love to hear them. I’ll keep searching until I figure something out.

As a side note, I actually had this configuration running on a different Proxmox host and it was working fine. I had to move it to a more robust server with more storage to add some additional cameras and that is where I ended up. The only difference between the two configs right now is the original device was a privileged LXC, where the new one is unprivileged.

Really seems like a security issue. I’m going to see if I can figure out what I’m doing wrong along those lines

I have the exact same symptoms. It is recognised as Google Inc, can be seen within the LXC console with Isusb command, and I have added it to the Frigate config file, but it can’t be found.

Also, mine is running better when changing to CPU.

Did you ever get this resolved? How did you fix it?

Frigate VM (not LXC) + Coral PCIe m.2 + Proxmox works flawless for me.