Merge pull request #5286 from tse-jeff/fix/snap-wsl2-gpu-passthrough

fix(docker): detect snap+WSL2 GPU passthrough incompatibility
This commit is contained in:
Boody
2026-07-21 13:57:32 +03:00
committed by GitHub
2 changed files with 64 additions and 0 deletions
+28
View File
@@ -196,6 +196,34 @@ docker compose exec odysseus nvidia-smi -L
For first-time local model testing on 8 GB laptop GPUs, start with GGUF/Q4 models on llama.cpp before trying GPTQ/AWQ models on vLLM or SGLang. This keeps the first run simpler while confirming GPU passthrough works.
**WSL2 + snap Docker.** If the NVIDIA check fails with this error, Docker may be
installed via snap:
```text
failed to fulfil mount request: open /usr/lib/wsl/lib/libdxcore.so: no such file or directory
```
Check with `snap list docker` or:
```bash
docker info --format '{{.DockerRootDir}}'
```
A Docker root under `/var/snap/docker/` means snap confinement can prevent
Docker from seeing WSL2's `/usr/lib/wsl/lib` GPU libraries even when the files
exist on the host. Reinstalling or reconfiguring `nvidia-container-toolkit` will
not fix that. Remove snap Docker, install the official apt-based Docker Engine
([Docker docs](https://docs.docker.com/engine/install/ubuntu/)), then configure
the NVIDIA runtime again:
```bash
sudo snap remove docker
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
Then re-run `scripts/check-docker-gpu.sh`.
Safety notes:
- The app never installs host GPU runtime automatically.
- The app never edits `.env` automatically.
+36
View File
@@ -214,6 +214,22 @@ _check_nvidia_smi() {
echo
}
# WSL2 snap Docker cannot see /usr/lib/wsl/lib/libdxcore.so from its confined
# namespace, so NVIDIA passthrough fails until the user switches to non-snap
# Docker. DockerRootDir identifies snap installs more reliably than snap(8).
_is_wsl() {
grep -qi microsoft /proc/version 2>/dev/null && return 0
[ -d /usr/lib/wsl ] && return 0
return 1
}
_is_docker_snap() {
case "$(docker info --format '{{.DockerRootDir}}' 2>/dev/null)" in
*/snap/docker/*|*/snap.docker/*) return 0 ;;
esac
return 1
}
# Returns 1 if Docker is unavailable (callers should stop further GPU checks).
_check_docker() {
_info "Checking Docker..."
@@ -258,6 +274,26 @@ _check_gpu_passthrough() {
echo
_fail "GPU passthrough failed. Check these steps in order:"
echo
if _is_wsl && _is_docker_snap; then
_warn "Detected: Docker installed via snap, running on WSL2."
_warn "This is a known incompatibility, not a toolkit/config problem:"
_warn " snap confines Docker's mount namespace, so it cannot see the"
_warn " WSL2-injected GPU library at /usr/lib/wsl/lib/libdxcore.so even"
_warn " though the file exists on the host. Installing/reconfiguring"
_warn " nvidia-container-toolkit will NOT fix this — the numbered"
_warn " steps below will not help until Docker itself is replaced."
echo
_info "Fix: remove snap Docker and install the official apt-based Docker"
_info "Engine instead (unsandboxed, can see /usr/lib/wsl/lib):"
echo
echo " sudo snap remove docker"
echo " # then follow: https://docs.docker.com/engine/install/ubuntu/"
echo " sudo nvidia-ctk runtime configure --runtime=docker"
echo " sudo systemctl restart docker"
echo
_info "Re-run this script afterward to confirm passthrough works."
echo
fi
echo " 1. Install NVIDIA Container Toolkit (if not already installed):"
echo " Arch: sudo pacman -S nvidia-container-toolkit"
echo " Debian: sudo apt install nvidia-container-toolkit"