@@ -14,9 +14,7 @@ In this guide we setup [Nvidia CUDA](https://docs.nvidia.com/cuda/) in a toolbox
1414- [ Creating a Fedora Toolbox Environment] ( #creating-a-fedora-toolbox-environment )
1515- [ Installing Essential Development Tools] ( #installing-essential-development-tools )
1616- [ Adding the CUDA Repository] ( #adding-the-cuda-repository )
17- - [ Installing ` nvidia-driver-libs ` ] ( #installing-nvidia-driver-libs )
18- - [ Manually Resolving Package Conflicts] ( #manually-resolving-package-conflicts )
19- - [ Finalizing the Installation of ` nvidia-driver-libs ` ] ( #finalizing-the-installation-of-nvidia-driver-libs )
17+ - [ Installing Nvidia Driver Libraries] ( #installing-nvidia-driver-libraries )
2018- [ Installing the CUDA Meta-Package] ( #installing-the-cuda-meta-package )
2119- [ Configuring the Environment] ( #configuring-the-environment )
2220- [ Verifying the Installation] ( #verifying-the-installation )
@@ -67,7 +65,7 @@ This guide focuses on Fedora hosts, but with small adjustments, it can work for
6765 sudo dnf distro-sync
6866 ```
6967
70- 2 . ** Install the Default Text Editor (Optional):**
68+ 2 . ** Install ** Vim ** the default text editor (Optional):**
7169
7270 ``` bash
7371 sudo dnf install vim-default-editor --allowerasing
@@ -97,60 +95,75 @@ After adding the repository, synchronize the package manager again:
9795sudo dnf distro-sync
9896```
9997
100- ## Installing ` nvidia-driver-libs ` and ` nvidia-driver-cuda-libs `
98+ ## Installing Nvidia Driver Libraries
10199
102- We need to detect if the host is supplying the [ NVIDIA driver libraries into the toolbox] ( https://github.com/containers/toolbox/blob/main/src/pkg/nvidia/nvidia.go ) .
100+ First, we need to detect if the host is supplying the [ NVIDIA driver libraries into the toolbox] ( https://github.com/containers/toolbox/blob/main/src/pkg/nvidia/nvidia.go ) :
103101
104102``` bash
105103ls -la /usr/lib64/libcuda.so.1
106104```
107105
108- ** Explanation:**
106+ ### If * ` libcuda.so.1 ` * is missing:
107+
108+ ```
109+ ls: cannot access '/usr/lib64/libcuda.so.1': No such file or directory
110+ ```
109111
110- - ` nvidia-driver-libs ` and ` nvidia-driver-cuda-libs ` contains necessary NVIDIA driver libraries required by CUDA,
111- on hosts with NVIDIA drivers installed the Fedora Container will supply the host libraries.
112+ ** Explanation: **
113+ The host dose not supply the CUDA drivers, ** install them now: **
112114
113- ### Install Nvidia Driver Libraries on Guest (if ` libcuda.so.1 ` was NOT found).
115+ #### Install the Nvidia Driver Libraries on Guest:
114116
115117``` bash
116- sudo dnf install nvidia-driver-libs nvidia-driver-cuda-libs
118+ sudo dnf install nvidia-driver-cuda nvidia-driver- libs nvidia-driver-cuda-libs nvidia-persistenced
117119```
118120
119- ### Manually Updating the RPM database for host-supplied NVIDIA drivers (if ` libcuda.so.1 ` was found).
121+ ### If * ` libcuda.so.1 ` * exists:
122+ ```
123+ lrwxrwxrwx. 1 root root 21 Mar 24 11:26 /usr/lib64/libcuda.so.1 -> libcuda.so.570.133.07
124+ ```
125+
126+ ** Explanation:**
127+ The host is supply the CUDA drivers, ** we need to update the guest RPM Database accordingly:**
120128
121- If the installation fails due to conflicts, we'll manually download and install the required packages, excluding conflicting files.
129+ #### Update the Toolbox RPM Database to include the Host-Supplied Libraries:
122130
123- #### 1. Download ` nvidia- ` parts that are supplied by the host RPM's (with dependencies)
131+ Note: we do not actually install the libraries, we just update the DB so that the guest system knows they are supplied by the host.
132+
133+ ##### 1. Download ` nvidia- ` parts that are supplied by the host RPM's (with dependencies)
124134
125135``` bash
126136sudo dnf download --destdir=/tmp/nvidia-driver-libs --resolve --arch x86_64 nvidia-driver-cuda nvidia-driver-libs nvidia-driver-cuda-libs nvidia-persistenced
127137```
128138
129- #### 2. Update the RPM database to assume the installation of these packages.
139+ ##### 2. Update the RPM database to assume the installation of these packages.
130140
131141``` bash
132142sudo rpm --install --verbose --hash --justdb /tmp/nvidia-driver-libs/*
133143```
134144
135145** Note:**
136146
137- - The ` --justdb ` option only updates the RPM database, without touching the filesystem.
147+ - The ` --justdb ` option only updates the RPM database, without touching the filesystem elsewhere.
148+
149+ ##### Check that the RPM Database has been correctly updated:
138150
139- #### Finalizing the Installation of ` nvidia-driver-libs ` and ` nvidia-driver-cuda-libs `
151+ ** Note: ** This is the same command as in the * "Install the Nvidia Driver Libraries on Guest" * for if * ` libcuda.so.1 ` * was missing.
140152
141- After manually installing the dependencies, run:
142153
143154``` bash
144- sudo dnf install nvidia-driver-libs nvidia-driver-cuda-libs
155+ sudo dnf install nvidia-driver-cuda nvidia-driver- libs nvidia-driver-cuda-libs nvidia-persistenced
145156```
146157
147- You should receive a message indicating the package is already installed:
158+ * (this time it will not install anything, as the database things that these packages are already installed) *
148159
149160```
150161Updating and loading repositories:
151162Repositories loaded.
152- Package "nvidia-driver-libs-3:570.86.10-1.fc41.x86_64" is already installed.
153- Package "nvidia-driver-cuda-libs-3:570.86.10-1.fc41.x86_64" is already installed.
163+ Package "nvidia-driver-cuda-3:570.124.06-1.fc41.x86_64" is already installed.
164+ Package "nvidia-driver-libs-3:570.124.06-1.fc41.x86_64" is already installed.
165+ Package "nvidia-driver-cuda-libs-3:570.124.06-1.fc41.x86_64" is already installed.
166+ Package "nvidia-persistenced-3:570.124.06-1.fc41.x86_64" is already installed.
154167
155168Nothing to do.
156169```
@@ -207,9 +220,9 @@ You should see output similar to:
207220```
208221nvcc: NVIDIA (R) Cuda compiler driver
209222Copyright (c) 2005-2025 NVIDIA Corporation
210- Built on Wed_Jan_15_19:20:09_PST_2025
211- Cuda compilation tools, release 12.8, V12.8.61
212- Build cuda_12.8.r12.8/compiler.35404655_0
223+ Built on Fri_Feb_21_20:23:50_PST_2025
224+ Cuda compilation tools, release 12.8, V12.8.93
225+ Build cuda_12.8.r12.8/compiler.35583870_0
213226```
214227
215228This output confirms that the CUDA compiler is accessible and indicates the installed version.
0 commit comments