商店直接安装ollama启用GPU加速无法运行,显示:
2025/06/28 01:21:08 安装应用 [ollama] 任务开始 [START]2025/06/28 01:21:09 开始拉取镜像 ollama/ollama:0.9.22025/06/28 01:21:13 镜像拉取成功2025/06/28 01:21:13 启动 应用2025/06/28 01:21:21 启动 应用 失败 : stderr: Container ollama CreatingContainer ollama CreatedContainer ollama StartingError response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running prestart hook #0: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'nvidia-container-cli: mount error: failed to add device rules: unable to find any existing device filters attached to the cgroup: bpf_prog_query(BPF_CGROUP_DEVICE) failed: operation not permitted: unknown2025/06/28 01:21:21 安装应用 [ollama] 失败: stderr: Container ollama CreatingContainer ollama CreatedContainer ollama StartingError response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running prestart hook #0: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'nvidia-container-cli: mount error: failed to add device rules: unable to find any existing device filters attached to the cgroup: bpf_prog_query(BPF_CGROUP_DEVICE) failed: operation not permitted: unknown2025/06/28 01:21:22 [TASK-END]
面板版本:社区版v2.0.2
系统信息为:
root@Debian-Server:~# sudo docker info | grep -i runtime
Runtimes: io.containerd.runc.v2 nvidia runc
Default Runtime: runc
root@Debian-Server:~# lsmod | grep -E 'nvidia|bpf'
nvidia_uvm 1982464 0
nvidia 104943616 6 nvidia_uvm
root@Debian-Server:~# nvidia-container-cli -V
cli-version: 1.17.8
lib-version: 1.17.8
build date: 2025-05-30T13:47+00:00
build revision: 6eda4d76c8c5f8fc174e4abca83e513fb4dd63b0
build compiler: x86_64-linux-gnu-gcc-7 7.5.0
build platform: x86_64
build flags: -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DNDEBUG -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fplan9-extensions -fstack-protector -fno-strict-aliasing -fvisibility=hidden -Wall -Wextra -Wcast-align -Wpointer-arith -Wmissing-prototypes -Wnonnull -Wwrite-strings -Wlogical-op -Wformat=2 -Wmissing-format-attribute -Winit-self -Wshadow -Wstrict-prototypes -Wunreachable-code -Wconversion -Wsign-conversion -Wno-unknown-warning-option -Wno-format-extra-args -Wno-gnu-alignof-expression -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--gc-sections
root@Debian-Server:~# sudo nvidia-ctk runtime configure --runtime=docker
INFO[0000] Loading config from /etc/docker/daemon.json
INFO[0000] Wrote updated config to /etc/docker/daemon.json
INFO[0000] It is recommended that docker daemon be restarted.
root@Debian-Server:~# sudo systemctl restart docker
root@Debian-Server:~# sudo grep devices /proc/cgroups
devices 0 263 1
root@Debian-Server:~# stat -fc %T /sys/fs/cgroup/
cgroup2fs
root@Debian-Server:~# docker run -it --rm --gpus=all ollama/ollama:0.9.2
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running prestart hook #0: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: mount error: failed to add device rules: unable to find any existing device filters attached to the cgroup: bpf_prog_query(BPF_CGROUP_DEVICE) failed: operation not permitted: unknown
Run 'docker run --help' for more information
请问如何在ollama内正常调用GPU?