[Error] Startup fails with "error executing hook" when GPU support is enabled
- Langage dominant
- Go
- Étoiles
- 13k
- Forks
- 541
- Merge moyen
- 20 h 47 min
- PR mergées (30 j)
- 4
Description
**Describe the bug**
I'm unable to start any distrobox containers with GPU passthrough on a new machine. Using `podman` directly, the GPUs are visible as expected: `podman run --rm --device nvidia.com/gpu=all docker.io/library/ubuntu:24.04 nvidia-smi`.
At a guess, it could be related to using `hardware.nvidia-container-toolkit.device-name-strategy = "uuid";` in the machine config (individual GPUs are assigned to containers by UUID, and index-based assignment is no longer an option). I wouldn't have expected it to be relevant when using the `all` keyword, but it's the main difference I can think of in this machine's GPU setup.
**To Reproduce**
Using the following command to create the container, which has worked as expected on other similar machines I've used it on:
```
distrobox create --image docker.io/library/ubuntu:24.04 --name ubuntu-nvidia --additional-flags "--device nvidia.com/gpu=all"
```
The container is created as normal, but `distrobox enter ubuntu-nvidia` fails with:
```
Error: OCI runtime error: unable to start container "94985c2a6bc31c31a9d7caaa35ad0d33d5e149a02b53ec859481983500ede149": crun: error executing hook `/nix/store/72bp8mb7zzpjifcwasj5wh45ixasmck7-nvidia-container-toolkit-1.17.6-tools/bin/nvidia-cdi-hook` (exit code: 1)
{"msg":"error executing hook `/nix/store/72bp8mb7zzpjifcwasj5wh45ixasmck7-nvidia-container-toolkit-1.17.6-tools/bin/nvidia-cdi-hook` (exit code: 1)","level":"error","time":"2025-05-07T07:45:52.916362Z"}
```
I've also tried `--additional-flags "--gpus all"`, `--additional-flags "--gpus all --device=nvidia.com/gpu=all"` and `--additional-flags "--device nvidia.com/gpu="` with a specific GPU UUID, all with the same behaviour.
Using `distrobox create --nvidia --image docker.io/library/ubuntu:24.04 --name ubuntu-nvidia` does allow the container to start, but it isn't able to see any GPUs - although the docs mention this is for the NVIDIA proprietary drivers, and this machine is using the open source ones (blackwell and newer are only fully supported on the open releases), so that may be expected behaviour.
**Expected behavior**
Container starts as normal, and `nvidia-smi` run from inside the container shows info for all GPUs.
**Logs**
[`distrobox enter ubuntu-nvidia --verbose`](https://github.com/user-attachments/files/20079241/distrobox_verbose.txt)
**Desktop (please complete the following information):**
- `podman version 5.4.1`
- `distrobox: 1.8.1.2`
- NixOS unstable
- Installed via `nixpkgs`
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.