Enable Coral TPU in an LXC

This guide explains how to configure Google Coral TPU support for LXC containers in Proxmox VE using ProxMenux. Coral TPU provides dedicated AI acceleration, improving inference performance for machine learning applications. It is particularly useful for video surveillance applications with real-time video analysis, such as Frigate or Agent DVR or Blue Iris using CodeProject.AI.

Overview

The script automates the complete configuration of Coral TPU support in LXC containers, including USB and M.2 variants. It applies Proxmox-specific container settings, manages device passthrough permissions, and installs required drivers both on the host and inside the container.

The USB variant uses a persistent mapping based on /dev/coral via udev rules, avoiding reliance on dynamic USB paths like /dev/bus/usb/*. This ensures consistent device assignment across reboots and hardware reordering.

The M.2 version is detected automatically and configured only if present.

Implementation Steps

1

Select an LXC Container

The script lists available LXC containers and prompts for selection.

2

Modify Container Configuration

The script applies necessary changes to enable Coral TPU:

  • Switches the container to privileged mode if required.
  • Enables nesting to allow GPU and TPU usage.
  • Sets device permissions for TPU and iGPU.
  • Configures proper device mounts.
# Coral USB persistent passthrough example:
/etc/udev/rules.d/99-coral-usb.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", SYMLINK+="coral", MODE="0666"

# LXC config:
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/coral dev/coral none bind,optional,create=file
# Coral M.2 passthrough example (automatically added if detected):
lxc.cgroup2.devices.allow: c 245:0 rwm
lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file
3

Install Required Drivers

The script installs the necessary components inside the container:

  • GPU drivers:
    • va-driver-all
    • ocl-icd-libopencl1
    • intel-opencl-icd
    • vainfo
    • intel-gpu-tools
  • Coral TPU dependencies:
    • python3
    • python3-pip
    • python3-venv
    • gnupg
    • curl
  • Coral TPU drivers:
    • libedgetpu1-std (standard performance)
    • libedgetpu1-max (maximum performance, optional)
4

Select Coral TPU Driver Version

If a Coral M.2 device is detected, the script prompts the user to select:

  • Standard mode - balanced performance.
  • Maximum performance mode - higher speed, increased power usage.

Expected Results

  • The selected container is correctly configured for TPU and iGPU usage.
  • Required drivers and dependencies are installed inside the container.
  • The container will restart as needed during the process.
  • After completion, applications inside the container can utilize Coral TPU acceleration.

Important Considerations

  • The script supports both USB and M.2 Coral TPU devices.
  • The Proxmox host must have the required Coral TPU and Intel GPU drivers installed.
  • Additional application-specific configurations may be required inside the container.
  • Coral USB passthrough uses a persistent device alias /dev/coral created by a udev rule. This improves stability and avoids issues with changing USB port identifiers.
  • Coral M.2 devices are detected dynamically using lspci and configured only if present.