Troubleshooting NVIDIA Driver Installation On Ubuntu 24.04 For GeForce RTX 5060
Introduction
When setting up a new Ubuntu 24.04 system with an NVIDIA GeForce RTX 5060 graphics card, users may encounter challenges with driver installation. This article addresses common issues and provides a comprehensive guide to resolve them. We will explore various methods, troubleshooting steps, and solutions to ensure your NVIDIA drivers are correctly installed and functioning optimally. This guide is tailored for users with dedicated NVIDIA GPUs and AMD processors without integrated graphics, which can sometimes present unique installation scenarios. Let’s dive into the common methods, potential pitfalls, and effective solutions for NVIDIA driver installation on Ubuntu 24.04.
Method 1: Using the Ubuntu Software & Updates GUI
Initial Steps
One of the most straightforward ways to install NVIDIA drivers is through Ubuntu’s built-in Software & Updates GUI. This method typically involves navigating to the “Additional Drivers” tab and selecting the recommended driver version. However, sometimes, this approach doesn't work as expected, leading to a non-functional system. If you find yourself in this situation, don't worry; there are several steps we can take to troubleshoot and resolve the issue.
First, ensure that your system is fully updated before attempting to install any drivers. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade
These commands update the package lists and upgrade the installed packages to their latest versions. This is a crucial step because outdated system packages can sometimes conflict with new drivers.
Identifying the Problem
If the GUI method fails, the first step is to identify the exact nature of the failure. Common symptoms include the system freezing, the display not working correctly, or the drivers not being recognized after installation. To get more information, you can check the system logs. The dmesg
command is particularly useful for this:
dmesg | grep nvidia
This command filters the kernel log for messages related to NVIDIA, which can provide clues about any errors or warnings during the driver installation process.
Possible Solutions
-
Secure Boot: One common issue is Secure Boot being enabled in the BIOS. Secure Boot is a security feature that prevents unsigned drivers from loading. NVIDIA drivers, by default, may not be signed in a way that Secure Boot recognizes, leading to installation failures. To resolve this, you might need to disable Secure Boot in your BIOS settings. Accessing the BIOS typically involves pressing a key (such as Delete, F2, or F12) during system startup. Consult your motherboard's manual for the specific key.
-
MOK (Machine Owner Key) Management: If disabling Secure Boot is not an option, you can enroll the NVIDIA driver's Machine Owner Key (MOK). During the driver installation, the system might prompt you to set a password for the MOK. After rebooting, you'll be presented with a screen to enroll the MOK using the password you set. Follow the on-screen instructions to complete this process.
-
Conflicting Packages: Sometimes, existing packages on your system can conflict with the NVIDIA drivers. To identify and remove conflicting packages, you can use the following command:
apt list --installed | grep nvidia
This will list all installed packages related to NVIDIA. If you find any packages that seem to be causing issues (e.g., older driver versions or partially installed packages), you can remove them using
sudo apt remove <package-name>
. -
Driver Blacklisting: In some cases, the open-source
nouveau
driver might interfere with the NVIDIA driver installation. Thenouveau
driver is a free and open-source driver for NVIDIA GPUs, but it may not provide the best performance or compatibility compared to the proprietary NVIDIA drivers. To prevent it from interfering, you can blacklist it by creating a file in/etc/modprobe.d/
:sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Add the following lines to the file:
blacklist nouveau options nouveau modeset=0
Save the file and update the kernel:
sudo update-initramfs -u
Reboot your system for the changes to take effect.
Method 2: Using the Command Line (apt)
Advanced Installation
The command line offers a more direct and sometimes more reliable method for installing NVIDIA drivers. Using the apt
package manager, you can specify the exact driver version you want to install. This method is particularly useful if the GUI method fails or if you need to install a specific driver version for compatibility reasons.
Adding the NVIDIA Repository
Before installing the drivers, you might need to add the NVIDIA repository to your system. This ensures that you have access to the latest driver versions. Add the NVIDIA repository using the following commands:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
The first command adds the PPA (Personal Package Archive) for graphics drivers, and the second command updates the package lists to include the new repository.
Installing the Driver
Once the repository is added, you can install the NVIDIA drivers. You can list the available drivers using the following command:
apt search nvidia-driver
This command will display a list of available NVIDIA driver packages. Choose the driver version that is recommended for your hardware or the one you specifically need. For the GeForce RTX 5060, a recent driver version such as nvidia-driver-535
or nvidia-driver-550
might be suitable. Install the driver using the following command:
sudo apt install nvidia-driver-<version>
Replace <version>
with the actual driver version number (e.g., 535
).
Post-Installation Steps
After the installation is complete, reboot your system:
sudo reboot
Troubleshooting Command Line Installation
If you encounter issues during the command-line installation, consider the following troubleshooting steps:
-
Check for Errors: Pay close attention to any error messages displayed during the installation process. These messages can provide valuable clues about the cause of the problem. Common errors include unmet dependencies or package conflicts.
-
Resolve Dependencies: If you encounter dependency issues, try installing the missing dependencies manually using
sudo apt install -f
. This command attempts to fix broken dependencies. -
Purge and Reinstall: If the installation fails repeatedly, you might need to purge the existing NVIDIA packages and start fresh. Use the following commands:
sudo apt purge nvidia-driver-<version> sudo apt autoremove sudo apt update sudo apt install nvidia-driver-<version>
This will completely remove the specified driver version, remove any unused dependencies, update the package lists, and then reinstall the driver.
Method 3: Using NVIDIA’s Official Driver Installer
Manual Installation
For the most control over the installation process, you can use NVIDIA’s official driver installer. This method involves downloading the driver directly from NVIDIA’s website and running the installer manually. This is particularly useful if you need a specific driver version that is not available in the Ubuntu repositories or if you want to customize the installation.
Downloading the Driver
Visit the NVIDIA Driver Downloads page and select the appropriate driver for your GeForce RTX 5060 and Ubuntu 24.04. Make sure to choose the correct operating system and architecture (usually Linux 64-bit). Download the .run
file to your computer.
Preparing for Installation
Before running the installer, you need to prepare your system. This involves stopping the display manager (which is responsible for the graphical login screen) and blacklisting the nouveau
driver.
-
Stop the Display Manager: The display manager needs to be stopped to prevent conflicts during the driver installation. The specific command to stop the display manager depends on which one you are using. Common display managers include GDM3 (used by default in GNOME), LightDM, and SDDM. Here are the commands for each:
-
GDM3:
sudo systemctl stop gdm3
-
LightDM:
sudo systemctl stop lightdm
-
SDDM:
sudo systemctl stop sddm
You will be switched to a text-based console.
-
-
Blacklist Nouveau Driver: If you haven’t already blacklisted the
nouveau
driver, do so now:sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Add the following lines to the file:
blacklist nouveau options nouveau modeset=0
Save the file and update the kernel:
sudo update-initramfs -u
Running the Installer
Navigate to the directory where you downloaded the NVIDIA driver .run
file using the cd
command. Make the installer executable:
chmod +x NVIDIA-Linux-x86_64-*.run
Run the installer with root privileges:
sudo ./NVIDIA-Linux-x86_64-*.run
The installer will guide you through a series of prompts. It is generally safe to accept the default options, but you might need to answer some questions, such as whether to install 32-bit compatibility libraries or whether to automatically update the X configuration file.
Post-Installation Steps
After the installation is complete, restart the display manager:
sudo systemctl start gdm3
(or lightdm
or sddm
, depending on which display manager you use).
Troubleshooting Manual Installation
- Installer Errors: The NVIDIA installer might encounter errors if it detects issues such as missing dependencies or conflicting files. Carefully read the error messages and address any problems. Common solutions include installing missing dependencies using
apt
or removing conflicting packages. - X Configuration: If the X configuration file is not updated correctly, you might experience issues with the graphical environment. The NVIDIA installer usually offers to update the X configuration file automatically, but if this fails, you might need to do it manually. The NVIDIA installer creates a backup of your existing X configuration file, so you can always revert to the previous configuration if necessary.
- Kernel Module Issues: Sometimes, the NVIDIA kernel module might not load correctly after installation. This can be due to various reasons, such as kernel version incompatibilities or issues with Secure Boot. Check the system logs (
dmesg
) for any error messages related to the NVIDIA kernel module.
Verifying the Installation
After installing the NVIDIA drivers using any of the methods described above, it’s crucial to verify that the installation was successful. Here are a few ways to do this:
Using nvidia-smi
The nvidia-smi
(NVIDIA System Management Interface) command-line utility provides information about your NVIDIA GPU and the installed drivers. Open a terminal and run:
nvidia-smi
This command should display information about your GeForce RTX 5060, including the driver version, CUDA version, and GPU utilization. If nvidia-smi
is not found, it could indicate that the drivers are not correctly installed or that the PATH environment variable is not set up correctly.
Checking NVIDIA X Server Settings
The NVIDIA X Server Settings application provides a graphical interface for managing NVIDIA driver settings. You can launch it by typing nvidia-settings
in a terminal or by searching for it in your application menu. If the application opens and displays information about your GPU, it indicates that the drivers are correctly installed.
Verifying OpenGL
To verify that OpenGL is working correctly, you can use the glxinfo
command. If it’s not already installed, you can install it using:
sudo apt install mesa-utils
Then, run:
glxinfo | grep