Skip to content

Commit 2be73a5

Browse files
committed
Set --skip-module-load flag when installings .ko's with nvidia-installer
Without this flag, a subtle bug can occur if the nvidia-installer fails to unload the NVIDIA kernel modules after the test load. The modules will remain loaded and any custom NVIDIA module parameters configured as input to the driver container will not be applied. Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent b577c14 commit 2be73a5

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

rhel8/nvidia-driver

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,23 @@ _install_driver() {
532532
if [ "${ACCEPT_LICENSE}" = "yes" ]; then
533533
install_args+=("--accept-license")
534534
fi
535+
536+
# Specify the --skip-module-load flag for versions of the nvidia-installer that
537+
# support it. From the nvidia-installer help output:
538+
#
539+
# --skip-module-load
540+
# Skip the test load of the NVIDIA kernel modules after the modules are built,
541+
# and skip loading them after installation is complete.
542+
#
543+
# Without this flag, a subtle bug can occur if the nvidia-installer fails to unload
544+
# the NVIDIA kernel modules after the test load. The modules will remain loaded and
545+
# any custom NVIDIA module parameters configured as input to the driver container
546+
# will not be applied.
547+
#
548+
if [ "${DRIVER_BRANCH}" -ge "570" ]; then
549+
install_args+=("--skip-module-load")
550+
fi
551+
535552
IGNORE_CC_MISMATCH=1 nvidia-installer --kernel-module-only --no-drm --ui=none --no-nouveau-check -m=${KERNEL_TYPE} ${install_args[@]+"${install_args[@]}"}
536553
# May need to add no-cc-check for Rhel, otherwise it complains about cc missing in path
537554
# /proc/version and lib/modules/KERNEL_VERSION/proc are different, by default installer looks at /proc/ so, added the proc-mount-point

rhel9/nvidia-driver

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,23 @@ _install_driver() {
551551
if [ "${ACCEPT_LICENSE}" = "yes" ]; then
552552
install_args+=("--accept-license")
553553
fi
554+
555+
# Specify the --skip-module-load flag for versions of the nvidia-installer that
556+
# support it. From the nvidia-installer help output:
557+
#
558+
# --skip-module-load
559+
# Skip the test load of the NVIDIA kernel modules after the modules are built,
560+
# and skip loading them after installation is complete.
561+
#
562+
# Without this flag, a subtle bug can occur if the nvidia-installer fails to unload
563+
# the NVIDIA kernel modules after the test load. The modules will remain loaded and
564+
# any custom NVIDIA module parameters configured as input to the driver container
565+
# will not be applied.
566+
#
567+
if [ "${DRIVER_BRANCH}" -ge "570" ]; then
568+
install_args+=("--skip-module-load")
569+
fi
570+
554571
IGNORE_CC_MISMATCH=1 nvidia-installer --kernel-module-only --no-drm --ui=none --no-nouveau-check -m=${KERNEL_TYPE} ${install_args[@]+"${install_args[@]}"}
555572
# May need to add no-cc-check for Rhel, otherwise it complains about cc missing in path
556573
# /proc/version and lib/modules/KERNEL_VERSION/proc are different, by default installer looks at /proc/ so, added the proc-mount-point

ubuntu20.04/nvidia-driver

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,23 @@ _install_driver() {
426426
if [ "${ACCEPT_LICENSE}" = "yes" ]; then
427427
install_args+=("--accept-license")
428428
fi
429+
430+
# Specify the --skip-module-load flag for versions of the nvidia-installer that
431+
# support it. From the nvidia-installer help output:
432+
#
433+
# --skip-module-load
434+
# Skip the test load of the NVIDIA kernel modules after the modules are built,
435+
# and skip loading them after installation is complete.
436+
#
437+
# Without this flag, a subtle bug can occur if the nvidia-installer fails to unload
438+
# the NVIDIA kernel modules after the test load. The modules will remain loaded and
439+
# any custom NVIDIA module parameters configured as input to the driver container
440+
# will not be applied.
441+
#
442+
if [ "${DRIVER_BRANCH}" -ge "570" ]; then
443+
install_args+=("--skip-module-load")
444+
fi
445+
429446
nvidia-installer --kernel-module-only --no-drm --ui=none --no-nouveau-check -m=${KERNEL_TYPE} ${install_args[@]+"${install_args[@]}"}
430447
}
431448

ubuntu22.04/nvidia-driver

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,24 @@ _install_driver() {
503503
if [ "${ACCEPT_LICENSE}" = "yes" ]; then
504504
install_args+=("--accept-license")
505505
fi
506-
nvidia-installer --kernel-module-only --no-drm --ui=none --no-nouveau-check -m=${KERNEL_TYPE} ${install_args[@]+"${install_args[@]}"}
506+
507+
# Specify the --skip-module-load flag for versions of the nvidia-installer that
508+
# support it. From the nvidia-installer help output:
509+
#
510+
# --skip-module-load
511+
# Skip the test load of the NVIDIA kernel modules after the modules are built,
512+
# and skip loading them after installation is complete.
513+
#
514+
# Without this flag, a subtle bug can occur if the nvidia-installer fails to unload
515+
# the NVIDIA kernel modules after the test load. The modules will remain loaded and
516+
# any custom NVIDIA module parameters configured as input to the driver container
517+
# will not be applied.
518+
#
519+
if [ "${DRIVER_BRANCH}" -ge "570" ]; then
520+
install_args+=("--skip-module-load")
521+
fi
522+
523+
nvidia-installer --kernel-module-only --no-drm --skip-module-load --ui=none --no-nouveau-check -m=${KERNEL_TYPE} ${install_args[@]+"${install_args[@]}"}
507524
}
508525

509526
# Mount the driver rootfs into the run directory with the exception of sysfs.

ubuntu24.04/nvidia-driver

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,22 @@ _install_driver() {
447447
install_args+=("-m=${kernel_type}")
448448
fi
449449

450+
# Specify the --skip-module-load flag for versions of the nvidia-installer that
451+
# support it. From the nvidia-installer help output:
452+
#
453+
# --skip-module-load
454+
# Skip the test load of the NVIDIA kernel modules after the modules are built,
455+
# and skip loading them after installation is complete.
456+
#
457+
# Without this flag, a subtle bug can occur if the nvidia-installer fails to unload
458+
# the NVIDIA kernel modules after the test load. The modules will remain loaded and
459+
# any custom NVIDIA module parameters configured as input to the driver container
460+
# will not be applied.
461+
#
462+
if [ "${DRIVER_BRANCH}" -ge "570" ]; then
463+
install_args+=("--skip-module-load")
464+
fi
465+
450466
# Install the NVIDIA driver in one step
451467
sh NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run --silent \
452468
--ui=none \

0 commit comments

Comments
 (0)