Skip to content

Instantly share code, notes, and snippets.

@rwohleb
Last active December 29, 2023 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwohleb/a50d66c38b230ca174d1d40003586d16 to your computer and use it in GitHub Desktop.
Save rwohleb/a50d66c38b230ca174d1d40003586d16 to your computer and use it in GitHub Desktop.
Coral PCIe in Proxmox LXC

Coral PCIe in Proxmox LXC

Check Coral PCIe device exists

lspci -nn | grep 089a

Install Coral drivers

Normally you'd just install them via apt:

echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
apt-get update
apt install pve-headers-$(uname -r)
apt-get install gasket-dkms libedgetpu1-std

But this fails in the current version of Proxmox. Instead we need to build it from source:

apt remove gasket-dkms
apt install git
apt install devscripts
apt install dh-dkms
cd /home
git clone https://github.com/google/gasket-driver.git
cd gasket-driver/
debuild -us -uc -tc -b
cd..
dpkg -i gasket-dkms_1.0-18_all.deb
apt update && apt upgrade

Once you reboot then /dev/apex_0 should exist.

Modify LXC container

Edit the appropriate container config in the host:

nano /etc/pve/nodes/(NODE-NAME)/lxc/(CONTAINER-ID ex. "100").conf

Add in:

features: nesting=1
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/apex_0 dev/apex_0 none bind,optional,create=file 0, 0
lxc.cap.drop:
lxc.mount.auto: cgroup:rw

This examplee includes support for both the Coral and iGPU.

If using Frigate

Adjust the frigate config file to use the Coral PCIe device:

detectors:
  coral:
    type: edgetpu
    device: pci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment