Incus / frigate / GPU-Load

Hey Folks,

i have frigate running als docker container inside incus.

The Intel-GPU and the TPU are both passed to my frigate container and everything is working fine.
But on the Systemmetrics of frigate I’m not able to display the GPU-Load:

container config:

  raw.idmap: |
    both 0 0
    gid 109 109
    gid 44 44
  raw.lxc: |
    lxc.cgroup.devices.allow = c 128:0
    lxc.cgroup.devices.allow = c 226:128
    lxc.cgroup.devices.allow = c 120:0
    lxc.mount.entry = /dev/apex_0 dev/apex_0 none bind,optional,create=file
    lxc.mount.entry = /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
    lxc.mount.entry = /dev/dri/card1 dev/dri/card1 none bind,optional,create=file

console output of intel_gpu_top:

root@frigate:~# intel_gpu_top
Failed to initialize PMU! (Permission denied)

I can’t figure out, what to do, that frigate is able to read the GPU load.
(it’s working on the incus host)

Doe any have managed to get it to work?

Looking forward to your feedback.

Best regards

Jan

I just tried to do something similar today. In my case, setting up Jellyfin with Podman inside an Incus container, but with Intel’s iGPU (12th gen).

I followed the guides to setup gpu passthrough and my config ended up like:

devices:
  gpu0:
    gputype: physical
    pci: "0000:00:02.0"
    type: gpu

The /dev/dri devices are there, however, Jellyfin was not picking up transcodings and just freezing. After installing intel-gpu-tools, I could notice the same Failed to initialize PMU! error you showed.

As in my case, this is all homelab stuff, I got around the issue by just making the container privileged and will probaly leave it be until there is another way to do this.

I’m pretty much new to LXC and Incus, so I haven’t tried any cgroups configuration at all.

Your post could be split into a new thread.

When I run Jellyfin inside Incus Ubuntu container, I always made sure that:

  1. GPU was passed through with GID of the video group inside the container, for Ububtu that’s 44 (I didn’t use gputype: physical).
devices:
  gpu:
    type: gpu
    gid: 44

Command ll /dev/dri/ should give you root video:

crw-rw---- 1 root video 226,   0 Nov 15 08:41 card0
crw-rw---- 1 root video 226, 128 Nov 15 08:41 renderD128
  1. When I installed Jellyfin from repo (not podman), this created jellyfin user inside the container. This user should be in video group:
groups jellyfin
sudo usermod -a -G video jellyfin
  1. I gave user jellyfin access to /home/ubuntu/ folder inside the container (if it’s Ubuntu of course) by adding it to ubuntu group:
sudo usermod -a -G ubuntu jellyfin
1 Like

I think running intel-gpu-top also requires CAP_PERFMON as well as a privileged container, if you haven’t provided that.

I tried to start the container with privileged set to true.

It runs a few seconds and shutdown then. I’ve not investigated why, due to a lack of time.