· Jose Antonio López  · 4 min read

Fix Green Screen in Ubuntu 22.04 with Secondary Monitor

Guide to fixing the green screen with a second monitor and crashes in Ubuntu 22.04 with NVIDIA hybrid graphics.

Guide to fixing the green screen with a second monitor and crashes in Ubuntu 22.04 with NVIDIA hybrid graphics.

Objective

The objective of this article is to resolve a complex issue in Ubuntu 22.04 where the second monitor is not detected (HDMI-1 disconnected). The screen turns green when connecting the cable and often the system freezes completely.

This error is usually a combination of a corrupt driver and a bad PRIME configuration on laptops with hybrid graphics (Intel + NVIDIA).

FeatureDescription
Operating SystemUbuntu 22.04 LTS
GPU DetectedNVIDIA GeForce GTX 960M
Driver Usednvidia-driver-535
SymptomsGreen screen, HDMI disconnected, system freezes

Problem Diagnosis

Identify Corrupt Driver

If the driver is not loaded or is poorly installed, running nvidia-smi will give you a communication error. This often happens after a failed kernel update or conflicts with nouveau.

terminal
nvidia-smi

Typical error output:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. 
Make sure that the latest NVIDIA driver is installed and running.

PRIME Configuration (Root Cause)

On many laptops, the internal screen is connected to Intel, but the HDMI port is wired directly to the NVIDIA GPU.

If the driver works but the HDMI gives no signal (or gives a green screen), you will see something like this:

terminal
nvidia-smi

Look at the Disp.A Off (Display Active Off) column and the absence of Xorg processes:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.288.01             Driver Version: 535.288.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce GTX 960M        Off | 00000000:01:00.0  Off |                  N/A |
| N/A   45C    P8              N/A / 200W |      5MiB /  4096MiB |      0%      Default |
+---------------------------------------------------------------------------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

That Disp.A Off indicates that the NVIDIA is not controlling the screen output, which causes the signal error (green screen) or the HDMI appearing as disconnected in xrandr.

Implementation: Steps for the Solution

Clean Driver Reinstallation

First, remove any trace of previous drivers and install the recommended version. In my case it is 535.

terminal
sudo apt purge nvidia*
sudo apt autoremove
sudo apt install nvidia-driver-535
sudo reboot

Force NVIDIA Usage (PRIME Mode)

You must tell the system to use the NVIDIA GPU to control the video outputs.

terminal
sudo prime-select nvidia
sudo reboot

Verification

Driver Status

Run nvidia-smi. Now you should see that the NVIDIA GPU has active processes and that the Disp.A (Display Active) column is On:

terminal
nvidia-smi

Expected output:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.288.01             Driver Version: 535.288.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce GTX 960M        Off | 00000000:01:00.0  On |                  N/A |
| N/A   52C    P0              N/A / 200W |   1242MiB /  4096MiB |     26%      Default |
|                                         |                      |                  N/A |
+---------------------------------------------------------------------------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      1380      G   /usr/lib/xorg/Xorg                          612MiB |
|    0   N/A  N/A      2130      G   cinnamon                                     67MiB |
+---------------------------------------------------------------------------------------+

Monitor Detection

Run xrandr. The monitor that previously appeared as disconnected should now be shown connected and with its native resolution:

terminal
xrandr | grep -w connected

Expected output:

HDMI-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 697mm x 392mm
eDP-1-1 connected 1920x1080+3840+1080 (normal left inverted right x axis y axis) 344mm x 193mm

What if it still fails?

If after all the above you still have no signal on the HDMI, there is likely a session configuration problem or a kernel-specific bug. If so, I don’t have the answer on how to fix your problem.

References

  • Ubuntu
  • NVIDIA
Share: