meta data for this page
  •  

This is an old revision of the document!


Google Coral USB in LXC

to Frigate container

Google Coral

After power-up Google Coral is in boot mode:

Bus 002 Device 005: ID 1a6e:089a Global Unichip Corp. 

It needs software to run. So host or LXC must upload firmware. After successfull init Google Coral changes its USB id to:

Bus 002 Device 006: ID 18d1:9302 Google Inc. 

Frigate contains Coral firmware and if access from LXC to USB dev is given it can init Google Coral upon startup.

LXC config

/etc/pve/lxc/307.conf
features: nesting=1
unprivileged: 1
lxc.cgroup2.devices.allow: c 226:128 rwm # iGPU
lxc.cgroup2.devices.allow: c 189:* rwm # USB Coral TPU
lxc.mount.entry: /dev/bus/usb/002 dev/bus/usb/002 none bind,optional,create=dir,mode=664 # USB Coral TPU
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0,0 # iGPU (u=root g=render)
lxc.hook.pre-start: sh -c "chown 100000:111000 /dev/dri/renderD128" # create a host gid for lxc_gpu_shares
lxc.hook.pre-start: sh -c "chown -R 100000:111002 /dev/bus/usb/002" # create a host gid for lxc_usb2_shares

Issues:

  • lxc.hook changes permission only once just before LXC starts. Any further host USB reconnects / udevadm reload cause USB permisions change. LXC must be restarted to trigger lxc.hook