Disclaimer: We may earn a commission when you purchase products linked throughout our site.

DigitalOcean โ€” Cloud hosting for developers
Fix Nvidia Drivers on Ubuntu 24.04: Black Screen, Secure Boot, and Wayland

Fix Nvidia Drivers on Ubuntu 24.04: Black Screen, Secure Boot, and Wayland

Troubleshoot and fix Nvidia driver issues on Ubuntu 24.04 including black screens after install, Secure Boot MOK enrollment, and Wayland session compatibility.

Nvidia drivers on Ubuntu are one of those things that either work perfectly on first install or cascade into a debugging marathon involving black screens, Secure Boot MOK enrollment failures, and Wayland sessions that refuse to start. Ubuntu 24.04 has improved the experience significantly โ€” the driver integration is tighter, Wayland support is functional with driver 535 and above, and ubuntu-drivers automates most of the heavy lifting โ€” but the failure modes are still real and still catch people. This guide covers every common Nvidia issue on Noble Numbat, from initial installation through recovery from a bricked desktop, tested across GTX 1060, RTX 3070, and RTX 4090 hardware with both Secure Boot enabled and disabled.

Installing Nvidia Drivers the Right Way

Check Your GPU

lspci | grep -i nvidia

Note the model number โ€” this determines which driver branch to use.

sudo ubuntu-drivers list
sudo ubuntu-drivers install nvidia:535

The ubuntu-drivers tool selects the appropriate driver for your GPU from Ubuntu’s own repository. On 24.04, the available branches are typically 535 (production), 545, and 550 (newer).

For the latest supported driver:

sudo ubuntu-drivers install

This picks the recommended version automatically.

Reboot

sudo reboot

After reboot, verify:

nvidia-smi

You should see your GPU model, driver version, and CUDA version. If you get nvidia-smi: command not found or an error, the driver did not load โ€” proceed to troubleshooting.

Black Screen After Driver Installation

This is the most common failure. You install the driver, reboot, and get a black screen โ€” sometimes with a blinking cursor, sometimes completely blank.

Recovery Step 1: Switch to a TTY

Press Ctrl+Alt+F3. If you get a text login prompt, the kernel is running fine and the issue is the display server or driver.

Log in and check the driver status:

nvidia-smi

If this works, the driver is loaded but the display server cannot start. Check Xorg logs:

cat /var/log/Xorg.0.log | grep -E "EE|WW"

Or for Wayland/GDM:

journalctl -b --unit=gdm3

Recovery Step 2: Reinstall the Driver

From the TTY:

sudo apt install --reinstall nvidia-driver-535
sudo update-initramfs -u
sudo reboot

The update-initramfs step is critical โ€” it rebuilds the initial ramdisk with the Nvidia kernel module included.

Recovery Step 3: Boot with Nouveau Temporarily

If the TTY is also broken, boot from GRUB recovery:

  1. Hold Shift during boot to access GRUB
  2. Select “Advanced options for Ubuntu”
  3. Select the recovery mode entry
  4. Choose “root shell with networking”

Blacklist the Nvidia driver temporarily to boot with nouveau:

echo "blacklist nvidia" > /etc/modprobe.d/blacklist-nvidia-temp.conf
update-initramfs -u
reboot

Once you have a working desktop with nouveau, properly reinstall the Nvidia driver and remove the blacklist file.

Secure Boot and MOK Enrollment

Secure Boot verifies that all kernel modules are signed with a trusted key. Nvidia’s proprietary driver module is not signed by Microsoft or Canonical’s default key, so Ubuntu creates a Machine Owner Key (MOK) during driver installation.

What Should Happen

During nvidia-driver-* installation, you are prompted to set a password for MOK enrollment. On the next reboot, a blue “Perform MOK management” screen appears. Select:

  1. Enroll MOK โ†’ Continue โ†’ enter the password you set โ†’ Reboot

After this, Secure Boot trusts the Nvidia module and the driver loads normally.

What Goes Wrong

You missed the MOK screen: It only appears once. If you skipped it or rebooted too quickly, the key was not enrolled and the Nvidia module is blocked. Fix:

sudo mokutil --import /var/lib/shim-signed/mok/MOK.der

Enter a temporary password, reboot, and complete the MOK enrollment when the blue screen appears.

The MOK screen never appeared: Some UEFI firmware implementations do not display the MOK manager. In this case, you have two options:

  1. Disable Secure Boot in BIOS (pragmatic, reduces security slightly)
  2. Manually sign the Nvidia module using your own key (advanced, but keeps Secure Boot intact):
sudo apt install dkms
sudo update-secureboot-policy --new-key
sudo reboot
# Complete MOK enrollment

The driver loads but nvidia-smi shows an error: This usually means the module loaded but Secure Boot validation failed silently. Check:

mokutil --sb-state
dmesg | grep -i "nvidia\|secure"

Nvidia and Wayland on Ubuntu 24.04

GNOME on Wayland works with Nvidia driver 535 and above. Ubuntu 24.04 automatically enables the Wayland session when it detects a compatible Nvidia driver.

Verifying Wayland Is Active

echo $XDG_SESSION_TYPE

Should return wayland. If it returns x11, GDM may have fallen back to Xorg. Check:

cat /etc/gdm3/custom.conf

Ensure WaylandEnable=false is NOT set (or is commented out).

Enabling DRM Kernel Mode Setting

Wayland requires KMS (Kernel Mode Setting) for Nvidia. On Ubuntu 24.04, this should be enabled automatically, but verify:

cat /etc/modprobe.d/nvidia-graphics-drivers.conf

Look for:

options nvidia-drm modeset=1

If it is missing, add it:

echo 'options nvidia-drm modeset=1' | sudo tee /etc/modprobe.d/nvidia-drm-modeset.conf
sudo update-initramfs -u
sudo reboot

Known Wayland Issues with Nvidia

  • Screen flickering on multi-monitor: Occasionally occurs with mixed refresh rate monitors. Setting all monitors to the same refresh rate usually resolves it.
  • Suspended system does not wake: A known issue with some Nvidia driver versions. Updating to the latest driver point release often fixes this.
  • Firefox/Chrome screen sharing shows black: Ensure xdg-desktop-portal-gnome is installed and PipeWire is running.

Switching Between Nvidia and Nouveau

If you need to temporarily switch to the open-source nouveau driver (for debugging or compatibility):

sudo apt install xserver-xorg-video-nouveau
sudo prime-select on-demand  # For hybrid GPU laptops
sudo reboot

To switch back to Nvidia:

sudo prime-select nvidia
sudo reboot

The Nvidia Open Kernel Module

Starting with driver 535, Nvidia ships an open-source kernel module (nvidia-open) alongside the proprietary one. On Turing (RTX 20xx) and later GPUs, you can use it:

sudo apt install nvidia-driver-535-open

The open module is required for some Wayland features and may become the default in future Ubuntu releases.