New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the proprietary NVIDIA driver #116
Comments
The reply further down #116 (comment) works perfectly. |
@Findarato You mean add something like |
So to have the NVIDIA stuff working inside the Toolbox I had to do this (inspired by https://github.com/thewtex/docker-opengl-nvidia):
#!/bin/sh
# Get your current host nvidia driver version, e.g. 340.24
nvidia_version=$(cat /proc/driver/nvidia/version | head -n 1 | awk '{ print $8 }')
# We must use the same driver in the image as on the host
if test ! -f nvidia-driver.run; then
nvidia_driver_uri=http://us.download.nvidia.com/XFree86/Linux-x86_64/${nvidia_version}/NVIDIA-Linux-x86_64-${nvidia_version}.run
wget -O ~/nvidia-driver.run $nvidia_driver_uri
fi
#!/bin/sh
sudo dnf install -y glx-utils kmod libglvnd-devel || exit 1
sudo sh ~/nvidia-driver.run -a -N --ui=none --no-kernel-module || exit 1
glxinfo | grep "OpenGL version" |
@tpopela it worked. Thanks! |
I'm glad it worked! But there was a mistake that could lead to malfunctions after the host is restarted - you will need to apply tpopela@3db450a on top of the previous patch. |
Things like the proprietary NVIDIA driver need access to devices directly inside the /dev directory (eg., /dev/nvidia0 and /dev/nvidiactl), and since such devices can come and go at runtime they cannot be bind mounted individually. Instead, the entire directory needs to be made available. https://github.com/debarshiray/toolbox/issues/116
@tpopela We might be able to get away without bind mounting References: |
Ah ok @debarshiray! Thank you for clarification. I can confirm that not bind mounting the There is maybe a small change after we are bind mounting the whole |
With the merge of https://github.com/debarshiray/toolbox/pull/119 this issue may be closed, since Nvidia is working now with proprietary driver. It's just necessary to install nvidia driver once inside the toolbox container. @tpopela's scripts helps with driver installation. @tpopela you have to install CUDA Toolkit. To make it install I've passed the parameters |
Actually I would leave this open (but I will leave it on Rishi) as we were thinking with @debarshiray about leaking the NVIDIA host drivers to the container, so there will be no need to manually install the drivers in the container. We have a working WIP solution for it. |
That would be great! |
Yes, I agree that this will be the right thing to do. OpenGL drivers have a kernel module and some user-space components (eg., shared libraries) that talk to each other. In NVIDIA's case the interface between these two components isn't stable and hence the user-space bits inside the container must match the kernel module on the host. These two can go out of sync if your host is lagging behind the container or vice versa. The problem with leaking the files into the container is maintaining a list of those files somewhere because they vary from version to version. This would be vastly simpler if there was a well known nvidia directory somewhere on the host that could be bind mounted because then we wouldn't have to worry about the names and locations of the individual files themselves. Unfortunately that's not the case. Looking around, I found Flatpak's solution to be a reasonable compromise. In short, it invents and enforces this well known nvidia directory. It expects distributors of the host OS to put all the user-space files in With that done, we'd need to figure out where to place these files inside the container and how to point the container's runtime environment at them. |
Nvidia have their own solution for this
It may be better for toolbox to try and integrate with this existing tool rather then maintaining another implementation. |
Issue relating to the uidmap permission problem: |
I was trying to run steam in the toolbox bug #343 I didn't patch the toolbox, steam runs and opengl works but vulkan doesn't seem to work, tried vkmark and Rise of Tomb Raider on steam. Any ideas how to get it to work? |
I saw that Singularity ccontainer fix this problem without |
So what is the status of using Nvidia GPU drivers in container in 2021? |
The latest version of toolbox (0.0.99.3) exposes the host filesystem at /run/host. I believe it should be possible to create a Containerfile something like this:
To expose the host userspace driver to the container. I don't have an Nvidia machine to test at the moment, but I assume that would do it? The above example should hopefully work for Vulkan, I'm not exactly sure if some extra file would need to be linked for OpenGL |
Ok, so with the latest toolbox, I can install nvidia drivers fine. On running |
So do you mean reinstall the nvidia driver inside the container is to fix the ldconfig? I remember there is a step to rerun ldconfig |
Just adding this worked for me too. I hope with the OSS version of their driver it will just work out of the box like all the AMD cards do. |
@Ayush1325 I used the nvidia fedora 35 repo ( |
What needs to be done for this?
podman run --rm -it --privileged --security-opt=label=disable -e NVIDIA_VISIBLE_DEVICES=all -e NVIDIA_DRIVER_CAPABILITIES=all ubuntu
I personally feel option 1 is more sustainable, but it's pretty simple (two appended environmental variables and a host executable check for |
Did you see my comment above? Unless there's a problem with it, I still prefer the unmanaged Flatpak extension option. I finally got myself some NVIDIA hardware to play with this. I see that the Container Device Interface requires installing the NVIDIA Container Toolkit. As far as I can make out, the Is there anything else other than NVIDIA that uses the Container Device Interface? I would like to understand the situation a bit better. Ultimately I want to make it as smooth as possible for the user to enable the NVIDIA proprietary driver. That becomes a problem if one needs to enable multiple different unofficial repositories, at least on Fedora. I will start by reviving the pull request from @TingPing against negativo17's RPM for the proprietary NVIDIA driver, but against RPMFusion, because that's the implementation Fedora Workstation promotes these days. If nothing else, it will immediately help Flatpak because those containers will always have access to the driver. We can add the same plumbing to Toolbx and benefit similarly. |
First, great project!
If I'm using Nvidia proprietary driver, OpenGL softwares (like Blender) don't work inside toolbox container. I tried to install the proprietary driver inside the container, it installs but the OpenGL softwares don't work. Is it necessary to install more things? Or set some env variable?
Thanks!
The text was updated successfully, but these errors were encountered: