2
0

fix udev rules again

This commit is contained in:
Ward Nakchbandi (CosmicFusion) 2024-09-02 11:23:17 +02:00
parent f9f7a9bcc2
commit 8517b166b0
3 changed files with 40 additions and 6 deletions

View File

@ -1 +1,2 @@
nvidia-modprobe /usr/bin/
extra_files/nvidia-create-device-nodes /usr/bin/

View File

@ -5,11 +5,7 @@
# nvidia-modprobe should not be invoked.
ACTION=="add|bind", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \
DRIVER=="nvidia", TEST!="/dev/nvidia-uvm", \
RUN+="/usr/bin/nvidia-modprobe", \
RUN+="/usr/bin/bash -c 'for i in $(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \ -f 4); do /usr/bin/nvidia-modprobe -c${i} && /usr/bin/nvidia-modprobe -s -c${i}; done", \
RUN+="/usr/bin/nvidia-modprobe -l -m", \
RUN+="/usr/bin/nvidia-modprobe -c0 -u", \
RUN+="/usr/bin/nvidia-smi"
RUN+="/usr/bin/nvidia-create-device-nodes"
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="add|bind", SUBSYSTEM=="pci", DRIVERS=="nvidia", ATTR{vendor}=="0x10de", \

View File

@ -0,0 +1,37 @@
#! /bin/bash
if ls /dev/ 2>&1 | grep nvidia[0-9] 2>&1 > /dev/null
then
true
else
for gpu in $(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \ -f 4)
do
echo "Creating device node for NVGPU: ${gpu}"
/usr/bin/nvidia-modprobe -c${gpu}
/usr/bin/nvidia-modprobe -s -c${gpu}
done
fi
if [[ ! -e /dev/nvidia-uvm ]]
then
echo "Creating Unified Memory device nodes"
/usr/bin/nvidia-modprobe -c0 -u
fi
if [[ ! -e /dev/nvidia-nvlink ]]
then
echo "Creating Nvlink device nodes"
/usr/bin/nvidia-modprobe -l
fi
if [[ ! -e /dev/nvidia-modeset ]]
then
echo "Creating modeset device nodes"
/usr/bin/nvidia-modprobe -m
fi
if [[ ! -e /dev/nvidiactl ]]
then
echo "Creating NVIDIA Control device nodes"
nvidia-smi
fi