Can't access GPU in container

Hello. I have various containers using my only NVIDIA GPU without problem.

Now I want to create a new container, but I’m unable to access the gpu.

I did

lxc launch images:ubuntu/lunar u-test -c nvidia.runtime=true
lxc config device add u-test gpu gpu -or-  lxc config device add u-test gpu gpu gputype=physical
lxc restart u-test

then lxc exec u-test bash

but when I try nvidia-smi command I’m getting “no device found”.

I’m using version 5.13.

In the other containers nvidia-smi shows my gpu.

What am I missing?

systemctl restart lxd

fixed it. Strange.

I observed one needs to have all of the gpu drivers loaded prior to starting LXD. This may be why your restart of lxd fixed it.

1 Like

Hummm. Not really. It was working in the other containers… or maybe yes, if I updated drivers in between…