Another hint about installing a Google Coral TPU M.2 in a Docker container running on a Debian Proxmox VM (and probably similar for an LXC container too) to run Frigate object detection. Maybe this helps, I typed them up as notes-to-self, and I am far from an expert so please correct me as necessary. This whole saga started as the
USB Coral gets stuck and there seems to be no solution for this.
The Proxmox host used is a fully updated 8.2.4 installation running on an Intel NUC
NUC6i5SYH. I have been following instructions above and
here, which are versions of the Google docs
here.
The key points to remember are -
- Configure the Proxmox host by installing the drivers & setting permissions as described above. As below, my Proxmox host shows no
/dev/apex_0
device and this does not seem to matter.
- Pass through the PCI device from the host to the VM.
- Configure the VM if you are using one to host the Docker container by following these instructions to install the drivers & set permissions again
- LXC containers are different here but still pay attention to passing through the right devices and setting permissions
- If using a VM you must pass-through the
/dev/apex_0
into the Docker container. This was the final sprinkle that got everything working for me.
Check the TPU is visible in the Proxmox host -
Code:
root@pmox02:/home#
root@pmox02:/home# lspci -vv |grep Coral
01:00.0 System peripheral: Global Unichip Corp. Coral Edge TPU (prog-if ff)
Subsystem: Global Unichip Corp. Coral Edge TPU
root@pmox02:/home# lspci -nn | grep 089a
01:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
root@pmox02:/home# dmesg |grep apex
[ 66.498629] apex 0000:01:00.0: enabling device (0000 -> 0002)
[ 71.778691] apex 0000:01:00.0: Apex performance not throttled due to temperature
root@pmox02:/home# lsmod |grep apex
apex 28672 0
gasket 126976 1 apex
root@pmox02:/home# ls /dev/apex*
ls: cannot access '/dev/apex*': No such file or directory
The TPU is visible in the hardware configuration for the Debian VM and can be passed through
View attachment 71211
In the Debian VM things look good -
Code:
root@frigate01:/home# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
root@frigate01:/home# uname -r
6.1.0-22-amd64
root@frigate01:/home# lspci -vv |grep Coral
00:10.0 System peripheral: Global Unichip Corp. Coral Edge TPU (prog-if ff)
Subsystem: Global Unichip Corp. Coral Edge TPU
root@frigate01:/home# ls /dev/apex*
/dev/apex_0
root@frigate01:/home# lspci -nn | grep 089a
00:10.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
And docker-compose.yaml -
Code:
services:
frigate:
container_name: frigate
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:stable
volumes:
- ./config:/config
- ./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
environment:
LIBVA_DRIVER_NAME: "i965"
FRIGATE_CAMERA_PASSWORD: "supersecret"
devices:
# - /dev/bus/usb:/dev/bus/usb # for USB Coral
- /dev/apex_0:/dev/apex_0
The Frigate configuration:
Code:
detectors:
coral1:
type: edgetpu
device: pci:0
Several instructions mentioned the following points which I never figured out -
- MSI-X - From Googling this it is the stuff of nightmares but seems to be fine with the out-of-box configuration
- Disable Secure Boot - again, this seems to be different in Proxmox 8 and I never found out how to do this for Debian VM with SeaBIOS.
Hope that helps someone.