distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Error] Nvidia integration fails on WSL2 ubuntu 22.04 host

Open ozzdemir opened this issue 1 year ago • 0 comments

Describe the bug

Nvidia integrations on WSL2 ubuntu Host fails, with error message filesystem was mounted, but any subsequent operation failed: Unknown error 5005. But I am not sure about whether it is related to WSL2 or not, since I did not use --nvidia in my previous uses of distrobox. The problem seems to be related to ro mount of the libraries (https://github.com/containers/toolbox/issues/1084#issuecomment-1614954387 has the same error message).

To Reproduce Steps to reproduce the behavior:

In a WSL2 ubuntu, install distrobox and create a image with --nvidia flag

$ distrobox create --name test --image ubuntu:22.04 --init --nvidia
Creating 'test' using image ubuntu:22.04         [ OK ]
Distrobox 'test' successfully created.
To enter, run:

distrobox enter test

$ distrobox enter test
Starting container...                            [ OK ]
printf distrobox: Installing basic packages...
Installing basic packages...     [ OK ]
Setting up devpts mounts...                      [ OK ]
printfdistrobox: Setting up read-only mounts...  [ OK ]
distrobox: Setting up read-write mounts...       [ OK ]
Setting up host's sockets integration...         [ OK ]
Setting up host's nvidia integration...
 Warning: failed to bind mount /run/host/usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1 to /usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1 Error: An error occurred

Expected behavior Nvidia integration to succeed without any problem

Logs Run the commands with --verbose and post the log here as a file upload distrobox_enter_verbose.txt

Desktop (please complete the following information):

  • Are you using podman, docker or lilipod?
    • podman
  • Which version or podman, docker or lilipod?
    • 3.4.4
  • Which version of distrobox?
    • 1.6.0.1
  • Which host distribution?
    • ubuntu 22.04
  • How did you install distrobox?
    • With apt from the following ppa:
    • sudo add-apt-repository ppa:michel-slm/distrobox

Additional context

  • In the host, nvidia-smi works as expected; so, most probably there is no windows 10 -> WSL2 integration problem
  • If I were to omit --nvidia flag, then entering to the container succeeds.
  • The mentioned libnvidia-encode.so.1 has the following permissions string -r-xr-xr-x,
  • Using the verbose log, found the following related issues, where the issue seems to be ro mount flag.
    • https://github.com/containers/toolbox/issues/1084
    • https://github.com/89luca89/distrobox/issues/1029
  • distrobox enter test --verbose has the following additional information

+ mount --rbind -o ro /run/host/usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1 /usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1 mount: /usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1: filesystem was mounted, but any subsequent operation failed: Unknown error 5005. Warning: failed to bind mount /run/host/usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1 to /usr/lib/wsl/drivers/nvhm.inf_amd64_ef9786a6f396f598/libnvidia-encode.so.1

ozzdemir avatar Dec 29 '23 11:12 ozzdemir