|
4 | 4 | set -eu
|
5 | 5 |
|
6 | 6 | KERNEL_VERSION=$(uname -r)
|
| 7 | +OPEN_KERNEL_MODULES_ENABLED="${OPEN_KERNEL_MODULES_ENABLED:-false}" |
7 | 8 | RUN_DIR=/run/nvidia
|
8 | 9 | PID_FILE=${RUN_DIR}/${0##*/}.pid
|
9 | 10 | DRIVER_BRANCH=${DRIVER_BRANCH:?"Missing driver version"}
|
@@ -210,10 +211,25 @@ _unload_driver() {
|
210 | 211 |
|
211 | 212 | # Link and install the kernel modules from a precompiled packages
|
212 | 213 | _install_driver() {
|
213 |
| - echo "Installing NVIDIA driver kernel modules..." |
214 |
| - apt-get install --no-install-recommends -y linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \ |
215 |
| - linux-signatures-nvidia-${KERNEL_VERSION} \ |
216 |
| - linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} |
| 214 | + if [ "$OPEN_KERNEL_MODULES_ENABLED" = true ]; then |
| 215 | + echo "Installing Open NVIDIA driver kernel modules..." |
| 216 | + apt-get install -y linux-signatures-nvidia-${KERNEL_VERSION} |
| 217 | + # installing closed linux-modules-${KERNEL_VERSION} , as linux-objects-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION} |
| 218 | + # has dependency on it and it is auto installing it and has conflict with linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION} |
| 219 | + # https://forums.developer.nvidia.com/t/ubuntu-and-nvidia-provided-packages-conflict-breaking-installation/259150 |
| 220 | + apt-get install --download-only --no-install-recommends -y linux-objects-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION} && \ |
| 221 | + dpkg -i --force-overwrite $(find /var/cache/apt/archives/ -name "linux-objects-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}_*.deb") |
| 222 | + apt-get install --download-only --no-install-recommends -y linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION} && \ |
| 223 | + dpkg -i --force-overwrite $(find /var/cache/apt/archives/ -name "linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}_*.deb") |
| 224 | + # Ensure modules are correctly loaded |
| 225 | + depmod -a ${KERNEL_VERSION} |
| 226 | + else |
| 227 | + echo "Installing Closed NVIDIA driver kernel modules..." |
| 228 | + apt-get install --no-install-recommends -y \ |
| 229 | + linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \ |
| 230 | + linux-signatures-nvidia-${KERNEL_VERSION} \ |
| 231 | + linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} |
| 232 | + fi |
217 | 233 | }
|
218 | 234 |
|
219 | 235 | # Mount the driver rootfs into the run directory with the exception of sysfs.
|
|
0 commit comments