When you install a dedicated graphics card or upgrade to a new GPU, whether the system can correctly recognize and use it depends crucially on whether the driver is compatible. The driver acts as a translator between the operating system and the hardware; if the translator is incorrect, even the best hardware won't perform to its full potential. In Linux systems, checking if the graphics card driver is installed correctly requires several steps.
First, you need to know which graphics card is installed in your computer. Open a terminal and use the `lspci` command to list all PCI devices. By filtering by keywords, we can quickly find the graphics card information.
spci | grep -E "VGA|3D|Display"
The output will display your graphics card model, such as NVIDIA's GeForce RTX 4060 or AMD's Radeon RX 7800 XT. If it's an integrated graphics card, it might display Intel's UHD Graphics. Note this model number; it's the basis for determining driver compatibility.
Once you know the graphics card model, the next step is to check which driver module the system is currently using. Drivers are loaded as modules in the Linux kernel. We can use the `lsmod` command to list all loaded kernel modules, and then use a pipe to combine it with `grep` to filter out graphics-related modules.
lsmod | grep -E "nvidia|amdgpu|radeon|i915"
This command will display the corresponding modules based on your graphics card brand. For NVIDIA graphics cards, you'll see the `nvidia` module; for newer AMD graphics cards, it might be the `amdgpu` module; older AMD graphics cards might be `radeon`; and Intel integrated graphics will show `i915`. If nothing is displayed, the driver is likely not loaded at all.
For users with NVIDIA discrete graphics cards, especially those who installed closed-source drivers from the official repository, there is a dedicated tool that provides detailed information. Running the `nvidia-smi` command will display a table containing driver version, GPU model, temperature, memory usage, and running processes. The output of this tool is the most direct evidence of whether the NVIDIA driver is working correctly.
nvidia-smi
Besides kernel modules, we can also check the logs of the X Window System or Wayland compositor to see if the graphics server recognizes the driver. Using the `dmesg` command to view the kernel ring buffer allows filtering out graphics card-related initialization information.
dmesg | grep -i "drm\|nvidia\|amd\|vga"
On systems with newer display stacks, such as those using GNOME or KDE Plasma, we can get clues by checking the renderer used by the session. The `glxinfo` command queries OpenGL rendering information, which tells you which driver is currently responsible for 3D acceleration.
glxinfo | grep "OpenGL renderer"
The output might show "NVIDIA GeForce RTX 4060", "AMD Radeon RX 7800 XT (radeonsi)", or "Intel HD Graphics 630 (Coffeelake)". This indicates that the driver is not only loaded but is also being used by the graphics interface.
Sometimes, multiple drivers may be installed on a system, but the optimal one may not be loaded. We can check which driver the system has configured for the graphics card. On Debian/Ubuntu-based systems, this can be done by checking the configuration files in the `/etc/X11/xorg.conf` or `/etc/X11/xorg.conf.d/` directories. However, many modern systems no longer use static `xorg.conf` files but instead use dynamic configuration.
Another method is to check the kernel boot parameters. Sometimes, especially for hybrid graphics (dual-graphics) laptops, parameters need to be added at boot time to select the graphics card. Checking the `/proc/cmdline` file will show the currently used kernel parameters.
cat /proc/cmdline
If you see settings like `nouveau.modeset=0` or `radeon.modeset=0` in the parameters, it means the system may have disabled an open-source driver in favor of a proprietary one.
If you are using official NVIDIA drivers, you can also confirm this by checking the driver installation status. NVIDIA driver installers typically create a file in `/proc/driver/nvidia/version`, which provides detailed driver version information.
cat /proc/driver/nvidia/version
For AMD graphics card users, especially newer models, the kernel-provided `amdgpu` driver is usually the preferred choice. This can be confirmed by checking the AMD GPU initialization information in `dmesg`. Alternatively, you can check the files in the `/sys/kernel/debug/dri/` directory, which contains DRM (Direct Rendering Manager) debugging information, but accessing it may require root privileges.
If the driver fails to load correctly, it might be because the driver itself is not installed. You can use a package manager to check installed driver packages. For example, on Ubuntu, you can use `apt list --installed` to search.
apt list --installed | grep -E "nvidia-driver|nvidia-.*-server|amdgpu|libgl1-mesa"
On Fedora or RHEL systems, use `dnf list installed`.
Sometimes, even if the driver is installed, it may fail to load due to kernel version incompatibility. Checking the compatibility between the kernel version and the driver module is crucial. You can view module information, including its dependent kernel versions, using the `modinfo` command.
modinfo nvidia | grep version
If the driver fails to load, the system may fall back to a basic framebuffer driver (such as `vesafb` or `efifb`), resulting in very poor graphics performance. We can confirm this by checking the currently used display output driver. You can use `cat /sys/class/graphics/fb0/name` to view the framebuffer device, but this isn't the primary method for determining driver compatibility.
On devices with hybrid graphics cards, such as laptops, the situation is more complex. You might need to check the graphics switching scheme, such as NVIDIA's Optimus or AMD's Dynamic Switchable Graphics. In this case, tools like `prime-select` (Ubuntu) can help you query and switch the currently used GPU.
prime-select query
Finally, a very practical test is to run an application or game that requires hardware acceleration. If the driver is compatible, you should be able to launch the application normally, and the performance should meet expectations. If crashes, black screens, or abnormally low performance occur, it's very likely due to driver incompatibility or configuration issues.
In summary, checking driver compatibility with the GPU is a verification process from hardware identification to software configuration. Starting with `lspci` to confirm the hardware, then using `lsmod` and `nvidia-smi` (or equivalent commands) to check driver loading, and finally `glxinfo` to verify the actual renderer being used, each step provides information from different perspectives. Comparing this information with your known graphics card model and the correct driver you should be using will determine whether a match has occurred. If a problem is found, adjust the driver installation or system configuration based on the specific error message.
EN
CN