NVidia Driver Status Linux Commands & Headless X11
This is a short post listing the ways to check the NVidia driver status at different levels of the Linux system.
Prepared as gist
Hardware Present
lspci | grep -i nvidia
Checks if the NVidia GPU is visible on the PCI bus
Package Installed
dpkg --status nvidia-current
dpkg -l | grep nvidia
The second command checks if the driver is installed as a debian package instead of installed via the executable driver from NVidia.
Module Known
- modinfo nvidia
- dkms status | grep nvidia
Checks if the driver is known to Linux, and in particular as DKMS, located in /lib/modules/*/updates/dkms/. For nvidia it could be to have the driver in multiple location as in dkms and in a per-version subfolder (e.g. 340).
The modprobe command uses the entries in /etc/modprobe.d and for nvidia could happen to have more than one.
The modprobe command uses the entries in /etc/modprobe.d and for nvidia could happen to have more than one.
Driver Loaded
- cat /proc/driver/nvidia/version
- lsmod | grep nvidia
- ls /dev/nvidia*
The first command prints the driver version
The last command shows the driver devices (nvidia0 and nvidiactl), useful for permission and for transfer to docker.
Module-Driver correspondence
- nvidia-smi
The nvidia-smi command provides detailed information about the driver, CUDA and the hardware. If the driver is loaded and this command fails means that there is a mismatch between the driver and nvidia-smi.
X11
- nvidia-xconfig --query-gpu-info
- glxinfo | grep OpenGL
The last command, glxinfo, succeeds only with an active X11 session (or set via DISPLAY) and the GLX extension loaded
There are some cases in which 1. works but 2. not, and this can be verified with:
grep NVIDIA /var/log/Xorg.0.log"
CUDA issues (lack of nvidia-uvm)
In case the nvidia-uvm is missing CUDA is not working although the rest of the driver seems fine. For solving this issue it is possible to re-create the /dev/nvidia-uvm device (script from Stack Overflow):
Headless K20m
Taken from https://pleiades.ucsc.edu/hyades/OpenGL_on_Nvidia_K20
nvidia-xconfig --use-display-device=none
sudo Xorg :1 2> /dev/null &
export DISPLAY=:1
xrandr
glxinfo
In case the nvidia-uvm is missing CUDA is not working although the rest of the driver seems fine. For solving this issue it is possible to re-create the /dev/nvidia-uvm device (script from Stack Overflow):
/sbin/modprobe nvidia-uvm
if [ "$?" -eq 0 ]; then
# Find out the major device number used by the nvidia-uvm driver
D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
mknod -m 666 /dev/nvidia-uvm c $D 0
else
exit 1
fi
Headless K20m
Taken from https://pleiades.ucsc.edu/hyades/OpenGL_on_Nvidia_K20
nvidia-xconfig --use-display-device=none
sudo Xorg :1 2> /dev/null &
export DISPLAY=:1
xrandr
glxinfo
Under K20m with driver 378.13 gives OpenGL 4.3
Note that we need to provide read/write access to the /dev/nvidia to obtain version of OpenGL greater than 2.
Comments