Introduction
Working with GPUs on Linux is essential for gaming, AI development, 3D rendering, and accelerated computing. This guide covers GPU detection, driver installation, and verification—tailored for beginners and intermediate users.
1. Checking GPU Hardware Information
Before installing drivers, identify your GPU model:
Method 1: lspci
Command
List all PCI devices (including GPUs):
lspci -v | grep -i vga -A 12
- Output example:
01:00.0 VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060] (rev a1)
- Key flags:
-v
= verbose details,
-A 12
= shows 12 lines after “VGA”.
Method 2: lshw
(Advanced)
Get detailed hardware info:
sudo lshw -C display
Shows vendor, product, driver status, and resources.
Method 3: GUI Tools (Optional)
- Use
gnome-system-monitor
(GNOME) - Install
hardinfo
:sudo apt install hardinfo # Debian/Ubuntu sudo dnf install hardinfo # Fedora
2. Installing GPU Drivers
NVIDIA GPUs
Step 1: Remove existing drivers (if any):
sudo apt purge nvidia* # Debian/Ubuntu
sudo dnf remove nvidia* # Fedora
Step 2: Install drivers:
- Ubuntu/Debian:
sudo apt update sudo ubuntu-drivers autoinstall # Auto-detects best driver # OR manually: sudo apt install nvidia-driver-535 # Specify version
- Fedora:
sudo dnf install akmod-nvidia # Kernel module builder
- Arch Linux:
sudo pacman -S nvidia nvidia-utils
Step 3: Reboot:
sudo reboot
AMD GPUs
Modern AMD cards use open-source amdgpu
drivers (pre-installed in most distros). For Vulkan/OpenCL:
sudo apt install mesa-vulkan-drivers mesa-opencl-icd # Debian/Ubuntu
sudo dnf install vulkan-loader mesa-vulkan-drivers # Fedora
Intel Integrated Graphics
Drivers are included in the kernel. Update Mesa for better performance:
sudo apt install mesa-utils # Debian/Ubuntu
3. Verifying Driver Installation
NVIDIA:
nvidia-smi # Shows GPU stats, driver version, and processes
AMD/Intel:
Check OpenGL renderer:
glxinfo | grep "OpenGL renderer"
- Expected output:
OpenGL renderer: AMD Radeon RX 6700 XT (radeonsi) / Mesa Intel Xe Graphics (TGL GT2)
Check Kernel Module:
lsmod | grep -e nvidia -e amdgpu -e i915
4. Troubleshooting
- Black screen after install?
Boot into recovery mode, purge NVIDIA drivers, and try a lower version:sudo apt install nvidia-driver-470
- Xorg/Wayland issues?
Check logs:cat /var/log/Xorg.0.log | grep -i EE
- Update initramfs after driver changes:
sudo update-initramfs -u
Conclusion
- Detect your GPU with
lspci
. - Install drivers via your distro’s package manager.
- Verify with
nvidia-smi
orglxinfo
. - Reboot after installation.
For proprietary features (CUDA, NVENC), stick to NVIDIA’s official drivers. AMD users benefit from open-source drivers with minimal setup. Always check your distribution’s documentation for specifics!
> Pro Tip: Avoid mixing driver sources (e.g., PPA + official .run files) to prevent conflicts.