GekBuzz

Answers, Explainers & Everyday Guides

Fix Black Screen After Suspend on Ubuntu with Nvidia Drivers

Fix Black Screen After Suspend on Ubuntu with Nvidia Drivers

Experiencing a black screen after your Ubuntu system wakes from suspend when using Nvidia graphics can be frustrating. This guide will walk you through practical, step-by-step solutions to resolve this issue, restoring your display and ensuring smooth suspend-resume cycles. These fixes cover common Nvidia driver and configuration problems that cause the black screen.

What You’ll Need

  • Ubuntu system with Nvidia GPU and proprietary Nvidia drivers installed
  • Basic familiarity with terminal commands and editing system files
  • Internet access to download packages or search for additional help if needed

Step-by-Step

  1. Confirm Your Nvidia Driver Version
    Open a terminal and run nvidia-smi or nvidia-settings to verify your current Nvidia driver version. Ensuring you have a supported and up-to-date driver is essential.
  2. Update Your System and Nvidia Drivers
    Run sudo apt update && sudo apt upgrade -y to update packages. Then, check for the latest Nvidia drivers available via ubuntu-drivers devices. Install recommended drivers with sudo ubuntu-drivers autoinstall if needed. Reboot after installation.
  3. Disable Wayland (If Enabled)
    Nvidia drivers have better compatibility with Xorg. Edit the GDM custom config file by running sudo nano /etc/gdm3/custom.conf. Uncomment or add the line WaylandEnable=false. Save and exit. Restart the display manager with sudo systemctl restart gdm3 or reboot.
  4. Create a Systemd Sleep Hook to Reload Nvidia Modules
    Sometimes the Nvidia driver or kernel module does not resume correctly. Create a script to unload and reload Nvidia modules on suspend/resume:

    • Run sudo nano /lib/systemd/system-sleep/nvidia-resume.sh
    • Paste the following script:
      #!/bin/bash
      case "$1" in
        suspend|hibernate)
          /sbin/modprobe -r nvidia_uvm
          /sbin/modprobe -r nvidia_drm
          /sbin/modprobe -r nvidia_modeset
          /sbin/modprobe -r nvidia
          ;;
        resume|thaw)
          /sbin/modprobe nvidia
          /sbin/modprobe nvidia_modeset
          /sbin/modprobe nvidia_drm
          /sbin/modprobe nvidia_uvm
          ;;
      esac
      
    • Save the file and exit.
    • Make it executable: sudo chmod +x /lib/systemd/system-sleep/nvidia-resume.sh
  5. Configure Kernel Parameters to Improve Nvidia Suspend Handling
    Add Nvidia-specific kernel parameters:

    • Edit GRUB config: sudo nano /etc/default/grub
    • Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add nvidia.NVreg_PreserveVideoMemoryAllocations=1 nvidia.NVreg_TemporaryFilePath=/tmp inside the quotes. It should look like:
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia.NVreg_PreserveVideoMemoryAllocations=1 nvidia.NVreg_TemporaryFilePath=/tmp"
    • Save and exit.
    • Update GRUB: sudo update-grub
    • Reboot your system.
  6. Disable Secure Boot (If Enabled)
    Secure Boot can interfere with unsigned Nvidia kernel modules, causing suspend/resume problems. Access your BIOS/UEFI settings and disable Secure Boot. Save changes and reboot.
  7. Adjust Display Manager and Nvidia Settings
    Open Nvidia Settings with sudo nvidia-settings and navigate to “X Server Display Configuration.” Set the option “Force Composition Pipeline” or “Force Full Composition Pipeline” if available. Apply and save to X configuration file.
  8. Test Suspend and Resume
    Use systemctl suspend or manually suspend your laptop/desktop. When resuming, the display should come back without a black screen.
  9. Check Logs if the Problem Persists
    Review journalctl -b -1 (previous boot) and dmesg outputs for Nvidia or suspend-related errors. This can help diagnose unresolved issues.

Common Mistakes

  • Using Nouveau Drivers Instead of Nvidia Proprietary Drivers: The open-source Nouveau driver often lacks full suspend/resume support for Nvidia GPUs, causing black screens.
  • Ignoring Secure Boot: Not disabling Secure Boot can prevent Nvidia kernel modules from loading correctly after suspend.
  • Incorrect Script Permissions: Forgetting to make systemd sleep scripts executable will prevent them from running.
  • Editing GRUB Incorrectly: Syntax errors in /etc/default/grub can cause boot issues or ignored kernel parameters.
  • Not Rebooting After Changes: Many fixes require a full reboot to take effect, skipping this step leads to confusion.

Tips

  • Keep Nvidia Drivers Updated: Nvidia regularly releases fixes for suspend/resume bugs—using the latest stable version helps.
  • Use LTS Kernel Versions: Ubuntu LTS kernels tend to have better Nvidia support and stability.
  • Backup Configuration Files: Before editing system files like GRUB or Xorg config, create backups to restore if needed.
  • Test One Change at a Time: Apply fixes incrementally to identify which solution works for your hardware.
  • Consider Switching Display Managers: Sometimes GDM or LightDM behaves differently with Nvidia; testing alternatives can help.

Troubleshooting

If the black screen after suspend persists despite following the steps above, consider these troubleshooting approaches:

  • Check Kernel Logs for Nvidia Errors: Run dmesg | grep -i nvidia after resume to identify driver errors or failures.
  • Test with a Different Nvidia Driver Version: Sometimes newer drivers introduce regressions. Try installing an older stable driver version via ubuntu-drivers or manually.
  • Switch to a Different Kernel: Use sudo apt install linux-image-generic-hwe-20.04 or similar to install a newer or older kernel and test suspend behavior.
  • Check Xorg Log Files: Inspect /var/log/Xorg.0.log for errors related to Nvidia or display initialization after resume.
  • Try Disabling DPMS and Screensaver: Sometimes power management features can interfere. Disable DPMS with xset -dpms and disable screensaver temporarily.
  • Use a Different Display Manager: Switch from GDM to LightDM or vice versa to isolate display manager-related issues.
  • Consult Nvidia Forums and Ubuntu Bug Reports: Look for hardware-specific quirks or patches that may apply to your GPU model.

Frequently Asked Questions

Why does my screen go black after suspend with Nvidia drivers?

This is often caused by Nvidia kernel modules not properly reinitializing the GPU or display pipeline after suspend, driver conflicts, or Secure Boot blocking unsigned modules.

Is the open-source Nouveau driver a good alternative?

Nouveau is less reliable for suspend/resume with Nvidia hardware, especially for newer GPUs. Proprietary Nvidia drivers generally provide better support and performance.

How do I check if Secure Boot is enabled on my system?

You can check Secure Boot status by running mokutil --sb-state in the terminal. If enabled, consider disabling it in your BIOS/UEFI settings.

Can Wayland cause black screen issues with Nvidia?

Yes. Nvidia drivers historically had better support on Xorg. Disabling Wayland and using Xorg often resolves black screen problems after suspend.

What does the “Force Composition Pipeline” option do in Nvidia Settings?

It forces the GPU to handle display composition, which can fix tearing and some display resume issues, improving post-suspend screen rendering.

Why do I need to reload Nvidia modules on suspend/resume?

Sometimes Nvidia kernel modules fail to restore GPU state correctly after suspend, causing a black screen. Reloading modules resets the GPU driver state.

Following these steps and tips should help you fix the black screen after suspend on Ubuntu systems using Nvidia GPUs. Remember to apply changes carefully and test after each step for the best results.

Related

Fix Black Screen After Suspend on Ubuntu with Nvidia Drivers

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top