Skip to content

Instantly share code, notes, and snippets.

@rwohleb
Last active March 16, 2025 12:27
Show Gist options
  • Select an option

  • Save rwohleb/a50d66c38b230ca174d1d40003586d16 to your computer and use it in GitHub Desktop.

Select an option

Save rwohleb/a50d66c38b230ca174d1d40003586d16 to your computer and use it in GitHub Desktop.

Revisions

  1. rwohleb revised this gist Dec 29, 2023. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions coral_pcie_in_proxmox_lxc.md
    Original file line number Diff line number Diff line change
    @@ -6,15 +6,15 @@ lspci -nn | grep 089a
    ```

    ## Install Coral drivers
    Normally you'd just install them via apt like so (1):
    Normally you'd just [install them via apt][1]:
    ```
    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 (2):
    But this fails in the current version of Proxmox. Instead we need to [build it from source][2]:
    ```
    apt remove gasket-dkms
    apt install git
    @@ -31,7 +31,7 @@ apt update && apt upgrade
    Once you reboot then `/dev/apex_0` should exist.

    ## Modify LXC container
    Edit the appropriate container config in the host (1):
    [Edit the appropriate container config][3] in the host:
    ```
    nano /etc/pve/nodes/(NODE-NAME)/lxc/(CONTAINER-ID ex. "100").conf
    ```
    @@ -60,6 +60,6 @@ detectors:
    device: pci
    ```

    ## References
    1. https://github.com/Bytelake/Coral-in-LXC
    2. https://forum.proxmox.com/threads/update-error-with-coral-tpu-drivers.136888/
    [1]: https://github.com/Bytelake/Coral-in-LXC#add-the-coral-drivers
    [2]: https://forum.proxmox.com/threads/update-error-with-coral-tpu-drivers.136888/#post-608975
    [3]: https://github.com/Bytelake/Coral-in-LXC#create-the-lxc
  2. rwohleb created this gist Dec 29, 2023.
    65 changes: 65 additions & 0 deletions coral_pcie_in_proxmox_lxc.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    # 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 like so (1):
    ```
    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 (2):
    ```
    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 (1):
    ```
    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
    ```

    ## References
    1. https://github.com/Bytelake/Coral-in-LXC
    2. https://forum.proxmox.com/threads/update-error-with-coral-tpu-drivers.136888/