meta data for this page
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vm:proxmox:lxc:google_coral [2024/12/07 20:07] – created niziak | vm:proxmox:lxc:google_coral [2024/12/08 16:06] (current) – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Google Coral passthrough | + | ====== Google Coral USB in LXC ====== |
to Frigate container | to Frigate container | ||
+ | ===== Google Coral ===== | ||
+ | |||
+ | After power-up Google Coral is in boot mode: | ||
<code bash> | <code bash> | ||
- | # lsusb | ||
Bus 002 Device 005: ID 1a6e:089a Global Unichip Corp. | Bus 002 Device 005: ID 1a6e:089a Global Unichip Corp. | ||
</ | </ | ||
+ | It needs software to run. So Proxmox host or LXC must upload firmware. | ||
+ | After successful init Google Coral changes its USB id to: | ||
+ | <code bash> | ||
+ | Bus 002 Device 006: ID 18d1:9302 Google Inc. | ||
+ | </ | ||
+ | |||
+ | Frigate contains Coral firmware and can init it. | ||
+ | |||
+ | ===== Issues to solve ===== | ||
+ | |||
+ | Coral: | ||
+ | * Frigate needs access to e.g.: ''/ | ||
+ | * Most solution on Internet provides workarounds: | ||
+ | * ugly and unsafe solution like:'' | ||
+ | * still unsafe using '' | ||
+ | * one time solution - like '' | ||
+ | * this solution cannot survive lots of scenarios (udev reload, usb reset, usb cable reconnect) | ||
+ | |||
+ | iGPU acceleration: | ||
+ | * Frigate needs access to ''/ | ||
+ | |||
+ | iGPU performance monitors: | ||
+ | |||
+ | |||
+ | ===== Setup ===== | ||
+ | |||
+ | ==== docker-compose ==== | ||
+ | |||
+ | <file yaml docker-compose.yml> | ||
+ | services: | ||
+ | frigate: | ||
+ | privileged: true # still in unpriv LXC so don't care | ||
+ | devices: | ||
+ | - / | ||
+ | - / | ||
+ | </ | ||
+ | |||
+ | ==== LXC ==== | ||
<file ini / | <file ini / | ||
- | features: nesting=1 | + | features: |
unprivileged: | unprivileged: | ||
lxc.cgroup2.devices.allow: | lxc.cgroup2.devices.allow: | ||
Line 17: | Line 57: | ||
lxc.mount.entry: | lxc.mount.entry: | ||
lxc.mount.entry: | lxc.mount.entry: | ||
- | lxc.hook.pre-start: | + | </file> |
- | lxc.hook.pre-start: | + | |
+ | In Frigate' | ||
+ | <code bash> | ||
+ | groupadd -g 11000 lxc_gpu_shares | ||
+ | groupadd -g 11002 lxc_usb2_shares | ||
+ | usermod -aG lxc_gpu_shares, | ||
+ | </ | ||
+ | |||
+ | ==== Host ==== | ||
+ | |||
+ | On Proxmox host: | ||
+ | |||
+ | <file ini / | ||
+ | SUBSYSTEMS==" | ||
+ | SUBSYSTEMS==" | ||
</ | </ | ||
+ | |||
+ | <file ini / | ||
+ | KERNEL==" | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | udevadm control --reload-rules && udevadm trigger | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== ERROR: Unable to poll intel GPU stats: Failed to initialize PMU! (Permission denied) ===== | ||
+ | |||
+ | This error is " | ||
+ | Rendering on ''/ | ||
+ | Frigate wants this to show GPU usage statistics. | ||
+ | |||
+ | Reproduce in LXC: | ||
+ | <code bash> | ||
+ | # apt install intel-gpu-tools | ||
+ | # intel_gpu_top | ||
+ | Failed to initialize PMU! (Permission denied) | ||
+ | </ | ||
+ | |||
+ | Host Kernel prevents access to performance events subsystem for unprivileged users. Security level is controller by sysctl: | ||
+ | <code bash> | ||
+ | # sysctl kernel.perf_event_paranoid | ||
+ | kernel.perf_event_paranoid = 4 | ||
+ | </ | ||
+ | |||
+ | where values: | ||
+ | * '' | ||
+ | * ''> | ||
+ | * ''> | ||
+ | * ''> | ||
+ | |||
+ | <code bash> | ||
+ | sysctl --write kernel.perf_event_paranoid=NEWVALUE | ||
+ | </ | ||
+ | |||
+ | I suppose this is not possible to use unpriv LXC and enable '' | ||
+ | It works when <code bash> | ||
+ | |||
+ | When Frigate is running and performance events are accessible in LXC, command <code bash> | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== references ===== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | #536]] | ||
+ | |||
+ | |||
+ | |||