How to Fix Black Screen on NVIDIA After Suspension in Ubuntu 22.04

4 Best Ways to Fix Black Screen on NVIDIA After Suspension in Ubuntu 22.04

Getting a black screen on NVIDIA after suspending your Ubuntu desktop? I have the fix.

Sometimes, you may face a black screen on your Ubuntu device after you suspend it or it goes to sleep. NVIDIA users especially face this more often. In this guide, I’ll show you some quick fixes you can try to get rid of this problem.

I’ve selected tried and tested methods that have successfully fixed the problem for many real users. The best way to follow this guide is to go through each solution serially as I’ve listed them.

Let’s begin.

(Easiest) Solution 1: Disable NVIDIA systemd Services

If the reason you’re facing the black screen issue is because of the NVIDIA driver’s power management, then this is the best solution you can try.

  1. Display the list of all NVIDIA services on your system with this command:
systemctl list-unit-files | grep nvidia
Find NVIDIA services in the unit files list

This command will show you all NVIDIA services in their current state. The left column shows the names of the services. The middle column shows the current state (enabled, disabled) of the service. The right column displays the vendor presets.

  1. Identify NVIDIA services related to monitor display, suspension, or hibernate settings. Some of the common services you should see are as follows:
nvidia-hibernate.service disabled enabled
nvidia-persistenced.service static -
nvidia-resume.service disabled enabled
nvidia-suspend.service disabled enabled
  1. Once you locate the services, notice if they are enabled. If so, you need to disable these services.
  2. First, if the services are currently running, stop them with these commands:
sudo systemctl stop nvidia-suspend.service
sudo systemctl stop nvidia-hibernate.service
sudo systemctl stop nvidia-resume.service
  1. Next, disable the services with these commands:
sudo systemctl disable nvidia-suspend.service
sudo systemctl disable nvidia-hibernate.service
sudo systemctl disable nvidia-resume.service
  1. After disabling the NVIDIA services, delete the NVIDIA systemd script by running this command:
sudo rm /lib/systemd/system-sleep/nvidia
  1. Lastly, reboot your system to see if it now suspends and resumes as expected. Use this command:
reboot

And that should solve the NVIDIA black screen problem on Ubuntu 22.04.

Solution 2: Use a Different NVIDIA Driver

Some Linux users have reported solving the issue by upgrading or downgrading to a different NVIDIA driver. Let’s see how you can do that.

  1. List all the NVIDIA drivers available in the APT list so that you can identify which driver you’re using and which one would be the closest upgrade or downgrade. List the drivers with this command:
apt list '*nvidia-driver*'
List all the NVIDIA drivers in the APT repository
  1. Uninstall the current NVIDIA driver in use. Suppose, you’re using NVIDIA driver version 510. You can remove it individually or using a wild card just like the previous command. To use a wildcard and uninstall the NVIDIA driver, run this command:
sudo apt-get purge '*nvidia*'
  1. After removing the current driver, you can install the NVIDIA driver you want. So going back to the earlier example, if you want to upgrade from 510 to 515, then install 515. On the other hand, if you would like to downgrade to 470 or 460 for example, you can do that as well. Install the appropriate driver from the list with this command:
# For desktop
sudo apt install nvidia-driver-515
# For servers
sudo apt install nvidia-driver-515-server

Or

# For desktop
sudo apt install nvidia-driver-460
# For servers
sudo apt install nvidia-driver-460-server
  1. After installing the driver, check whether is installed for each kernel with this command:
sudo apt install dkms
dkms status

The command will display the dynamically loaded kernel modules (DKMS) that are installed on your system along with their status. It helps ensure that necessary kernel modules are properly installed and available for use with the currently running kernel.

  1. Then run this chain of command:
apt-mark showmanual ^linux-| egrep -v 'linux-base|linux-doc|linux-tools-generic' | xargs sudo apt-mark auto

The above command identifies manually installed Linux packages starting with linux- and marks them as automatically installed. This will help prevent these packages from being removed accidentally.

  1. Lastly, run the below command:
sudo apt autoremove --purge

This will remove any packages that were marked as automatically installed and are no longer required by any manually installed packages.

Now that you’ve successfully upgraded and downgraded to another NVIDIA driver, try using your Ubuntu device and see if it fixes the black screen problem.

Solution 3: Switch to a Virtual Console

Another quick workaround is to temporarily open a virtual console on your Ubuntu desktop. Virtual consoles are basically like Linux terminal emulators. You can use Linux commands using the keyboard. And they look like the black terminal screens you see on Unix systems.

  1. There are usually seven virtual consoles you can open. To open any of them, you must press the Alt + Function keys. Open the first virtual console using the Alt + F1 buttons. In some cases, you may need to press the Ctrl + Alt + F1 buttons. Similarly, you can use the other function keys (F2 to F7) to open the other virtual consoles.
Virtual console in Ubuntu
  1. After that, you need to go back to your GUI session. The buttons for that have the same combination, that is, Ctrl + Alt + Function keys. The function key depends on your system. For me, it’s Ctrl + Alt + F2 buttons. Notice if you can see the screen or not.

Of course, this isn’t a permanent solution but may get the job done for the time being.

Solution 4: Change Your Monitor Cable

Sometimes, it may not be the software but instead the hardware that’s causing your problem. In that case, changing different hardware parts to test the system is a good decision. And one of the most common things you can get started with is the monitor cable.

  1. First things first. If you have both HDMI and VGA ports, try to use the alternative port. So if you’re currently using the VGA port, try using the HDMI port using the appropriate cable and vice versa.
  2. If one of the ports works and the other one doesn’t, then your cable might be at fault. Try getting a better cable and power up your system to see if the problem remains.

Conclusion

I hope that solves your Ubuntu black screen problem. If not, you can always refer to an expert or consult the nearest servicing center to see what’s going on.

You can also check out our other NVIDIA related guides such as installing NVIDIA drivers on Debian and getting the version of NVIDIA CUDA on Ubuntu.

If this guide helped you, please share it.

Related Posts