Skip to content

Commit

Permalink
fix: nvidia-docker + cgroups v2 disable unified hierarchy asdfasdfasdf
Browse files Browse the repository at this point in the history
Took an entire day to find the linked comment [1] by @biggs, which says:

> Fix on NixOS (where cgroup v2 is also now default): add
> `systemd.enableUnifiedCgroupHierarchy = false;`
> and restart.

Indeed, after applying this commit and then running
`sudo systemctl restart docker`, any of the following commands works:

```bash
sudo docker run --gpus=all nvidia/cuda:10.0-runtime nvidia-smi
sudo docker run --runtime=nvidia nvidia/cuda:10.0-runtime nvidia-smi
sudo nvidia-docker run nvidia/cuda:10.0-runtime nvidia-smi
```

ARGH!!!1

Links:
[1] NVIDIA/nvidia-docker#1447 (comment)
[2] NixOS/nixpkgs#127146
[3] NixOS/nixpkgs#73800
[4] https://blog.zentria.company/posts/nixos-cgroupsv2/

P.S.
I use Colemak, but typing arstarstarst doesn't have the same ring to it.
  • Loading branch information
YodaEmbedding committed Mar 24, 2022
1 parent e2b282f commit a2b3596
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@
'';
};

virtualisation.docker.enable = true;
systemd.enableUnifiedCgroupHierarchy = false;

virtualisation.docker = {
enable = true;
enableNvidia = true;
};

virtualisation.virtualbox.host = {
enable = true;
Expand Down

0 comments on commit a2b3596

Please sign in to comment.