Ubuntu – Can’t get internal and external monitor working simultaneously with 20.04 on laptop with AMD Ryzen 7 4800H and Nvidia RTX 2060

amd-ryzenasushybrid-graphicsmultiple-monitorsnvidia

Short Version

On Ubuntu 20.04 cannot get internal and external monitor working at the same time.
Can have internal only with default drivers OR external only with manually installed NVIDIA driver. Help!

My system is an ASUS TUF A15 Gaming laptop (FA506). It has an AMD® Ryzen™ 7 4800H Processor with integrated graphics and a NVIDIA RTX 2060.

  • Fresh Ubuntu 20.04 Install
  • Need to set nouveau.modeset=0 in grub entry to get graphics to work
  • External displays not detected
  • Ubuntu 20.04 does not show anything in the Additional Drivers dialog
  • Installing nvidia-driver-440 and running nvidia-xconfig gets the nvidia card working but only the external display (displayport on usbc port) is detected, internal display is not working
  • Can switch back to internal display only by deleting /etc/X11/xorg.conf and rebooting but then lose external displays and NVIDIA driver not being used
  • Can switch back to NVIDIA by running nvidia-xconfig again and rebooting

Long Version

After a fresh Ubuntu 20.04 install (with installing proprietary software enabled) the laptop boots to back screen with the text

[    7.779369] ucsi_acpi USBC000:00: PPM init failed (-110)

I can log in by switching to a virtual terminal with ctrl + alt + F2. After I log in the screen is spammed for over a minute with message:

[   80.199703] nouveau 0000:01:00.0 fifo: SCHED_ERROR 08 []

Followed by

[   80.206302] nouveau 0000:01:00.0 DRM: failed to idle channel 0 [DRM]

After this I can access the terminal. Based on internet advice I can modify the linux grub entry by changing the a line of /etc/default/grub from:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0"

and running

sudo update-grub

After reboot I get the gdm login screen and can log in to a graphical session but if I connect an external it is not detected. Output of xrandr with or without external monitors connect via DisplayPort-USBC and HDMI is

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 0mm x 0mm
   1920x1080     77.00*

Nvidia drivers have not been installed so I first update the system with sudo apt update and sudo apt dist-upgrade and reboot. I check the Additional Drivers tab of Software & Updates but it says "No additional drivers available". Running ubuntu-drivers devices shows nothing.

Next best advice is to install the nvidia drivers through apt

sudo apt install nvidia-driver-440 

After reboot the monitor situation is unchanged still only internal montior. xrandr output is the same, but Nvidia driver is now installed. nvidia-smi shows:

Thu May 28 09:42:22 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64       Driver Version: 440.64       CUDA Version: 10.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  GeForce RTX 2060    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   46C    P0     9W /  N/A |      0MiB /  5934MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

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

nvidia-settings shows a small empty window. Launching is from the terminal prints:

ERROR: Unable to load info from any available system


(nvidia-settings:2986): GLib-GObject-CRITICAL **: 09:45:58.786: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 09:45:58.789: PRIME: No offloading required. Abort
** Message: 09:45:58.789: PRIME: is it supported? no

Now I run sudo nvidia-xconfig to generate /etc/X11/xorg.conf. After a reboot THE EXTERNAL MONITOR IS WORKING I get the normal gdm login screen on my external (displayport) monitor and can login to a graphical session yay. Sadly the internal monitor is no longer detected and just shows the ASUS logo. nvidia-settings dialog now has all the options I would expect (launching from terminal gives the same output as before)

As requested by kanehekili the output of xrandr -q is now:

Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
DP-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     60.00*+ 144.00   120.00    84.98  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      59.89  
   1440x576      50.00  
   1440x480      59.94  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)

full output of lspci -vv is here. But entries for graphics devices as follows:

01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060] (rev a1) (prog-if 00 [VGA controller])
    Subsystem: ASUSTeK Computer Inc. Device 1e21
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0
    Interrupt: pin A routed to IRQ 94
    Region 0: Memory at fb000000 (32-bit, non-prefetchable) [size=16M]
    Region 1: Memory at b0000000 (64-bit, prefetchable) [size=256M]
    Region 3: Memory at c0000000 (64-bit, prefetchable) [size=32M]
    Region 5: I/O ports at f000 [size=128]
    Expansion ROM at fc000000 [virtual] [disabled] [size=512K]
    Capabilities: <access denied>
    Kernel driver in use: nvidia
    Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6) (prog-if 00 [VGA controller])
    Subsystem: ASUSTeK Computer Inc. Renoir
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 255
    Region 0: Memory at d0000000 (64-bit, prefetchable) [size=256M]
    Region 2: Memory at e0000000 (64-bit, prefetchable) [size=2M]
    Region 4: I/O ports at c000 [disabled] [size=256]
    Region 5: Memory at fc500000 (32-bit, non-prefetchable) [size=512K]
    Capabilities: <access denied>
    Kernel modules: amdgpu

PLEASE HELP ME FIGURE THIS OUT

From my internet searching I am not the only one battling with this AMD/NVIDIA hybrid graphics configuration. The holy grail would be seamless integration of the two graphics cards to save battery when possible and use dicrete graphics when needed but I will happily settle for permanent power guzzling nvidia with both monitors working!

From my research the core of the issue is that the nvidia card is hard wired to the displayport and the integrated graphics are connected to the internal montior. Ideally the nvidia can render to a buffer which can be copied to the integrated graphics but I don't know the specifics and don't know how to configure this.


Note: Some internet advice has recommended adding the nvidia ppa before installing nvidia drivers:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

I have tried this in the past but there is no difference, the nvidia-driver-440 package in that ppa and the ubuntu repository are the same version 440.82+really.440.64-0ubuntu6 and there is no change to the Additional Drivers tab.

Also note: I have secure boot disabled


Edit: This post Ubuntu 20.04 does not recognize second monitor

Suggests installing nvidia-driver-435 but in my case this does not solve the issue.


I have a partial answer to my own question but would still like help.

After reading this reddit post I came to suspect that the kernel version in Ubuntu 20.04 which is 5.4 does not have good support for the latest AMD APUs. To test this I installed the latest kernel 5.6.15 using the instructions here. With the newer kernel installed I can now use my HDMI port for an external monitor while running on the integrated graphics. That is by deleting the xorg.conf sudo rm /etc/X11/xorg.conf and rebooting. But when using the nvidia card I can still only use the displayport (on usbc). I would still like to be able to use NVIDIA on the internal display.

Best Answer

  • I managed to the the AMD graphics working using the experimental support for Renoir in the Linux kernel that ships with Ubuntu 20.04.

    You need to add amdgpu.exp_hw_support=1 to /etc/default/grub.

    To do this, open the file for editing as root, for example run

    sudo edit /etc/default/grub
    

    And to the line beginning GRUB_CMDLINE_LINUX_DEFAULT=, to the list of parameters in double quotes, add amdgpu.exp_hw_support=1. For example, depending on what you had before, the line may look like this after editing:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amdgpu.exp_hw_support=1"
    

    Save the file and exit, and then run this command to make the change effective:

    sudo update-grub
    

    and reboot. Now, blacklist the nouveau driver. To do this, create a new configuration file in /etc/modprobe.d/ using for example

    sudo nano /etc/modprobe.d/blacklist-nouveau.conf
    

    Add the following entries:

    blacklist nouveau
    options nouveau modeset=0
    

    save changes and exit (ctrl+x if using nano). Now update initramfs

    sudo update-initramsfs -u
    

    Reboot. This supports both internal and external displays.

    Still no nvidia graphics though. It would be good to know a way to get this machine (AsusTUF with Ryzen 7 4800H and RTX 2060) to use switchabme AMD/Nvidia graphics.

    EDIT: Activating the NVidia Card on internal/external monitors (HDMI)

    If you are happy to use integrated graphics only (amdgpu driver ) read no further. To change to NVidia graphics continue.

    Start by purging any previous installations of the NVidia driver, in the terminal:

    sudo apt-get remove --purge '^nvidia-.*'
    sudo apt-get install ubuntu-desktop
    sudo rm /etc/X11/xorg.conf (if present)
    

    Reboot the system. Now, reinstall the NVidia drivers

    sudo apt-get install nvidia-driver-440
    

    Edit the X11 configuration files for for amdgpu and nvidia drivers. These are located in /usr/share/X11/sorg.conf.d/. First, change the conf file for amdgpu:

    sudo nano /usr/share/X11/xorg.conf.d/10-amdgpu.conf
    

    Change the file contents so it looks like:

    Section "OutputClass"
        Identifier "AMDgpu"
        MatchDriver "amdgpu"
        Driver "amdgpu"
        Option "PrimaryGPU" "no"
    EndSection
    

    Now, change the conf file for NVidia:

    sudo nano /usr/share/X11/xorg.conf.d/10-nvidia.conf
    

    Edit the file with the following entries

    Section "OutputClass"
       Identifier "nvidia"
       MatchDriver "nvidia-drm"
       Driver "nvidia"
       Option "AllowEmptyInitialConfiguration"
       Option "PrimaryGPU" "yes"
       ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
    EndSection
    

    Reboot the system. This solution worked for me. You should now have a working system with Nvidia drivers for both internal/external monitor configuration using HDMI (I don't have display-port or USB-C to test).

    To revert back to the amdgpu swap the flags for the "PrimaryGPU" entries from "yes" to "no" as appropriate. This solution is sub-optimal and I will continue to look for a more robust swapping solution (e.g. nvidia on-demand). As a side note, I was unable to get anything to work properly by updating the kernel (tried 5.5.19 & 5.6.19). Although there are some interesting features that will benefit this laptop in newer kernel versions. The Nvidia module did not install correctly in my attempts (maybe if compiled the integration with the rest of the system might be more robust).

  • Related Question