Code Done Right!

Ubuntu – Auxiliary display not detected (AMD CPU/nVidia GPU)

If you have an AMD Ryzen CPU paired with nVidia GPU you will run into some problems as Ubuntu does not play well with this pairing.

In order to remedy this you have to tweak configs a bit by yourself.

Cause of the problem: Ubuntu’s prime-select feature still does not work for AMD/nVidia pairing but only for Intel/nVidia and requires manual tweaking

Solution

  • Delete /etc/X11/xorg.conf if exists
sudo rm /etc/X11/xorg.conf
  • Modify /usr/share/X11/xorg.conf.d/10-amdgpu.conf replacing only
Driver "amdgpu"

with

Driver "modesetting"
  • Modify OutputClass of /usr/share/X11/xorg.conf.d/10-nvidia.conf by adding
Option "PrimaryGPU" "Yes"

Caution! The above Option may be removed from the config after a driver update. Check this if you run into any troubles with your drivers after an update has been performed.

  • Create two files optimus.desktop in the following locations
    • /etc/xdg/autostart/
    • /usr/share/gdm/greeter/autostart/
  • Inside paste the following
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
  • Caution! Exec… line is long, make sure it is actually one line
  • Create a new file /etc/X11/xorg.conf
  • Inside paste the following
Section "ServerLayout"
  Identifier "layout"
  Option "AllowNVIDIAGPUScreens"
EndSection
  • Reboot

Caution! If you have the auxiliary display plugged in, greeter might be displayed only on the auxiliary monitor! Mouse movement can be restricted to that monitor as well!

In order to remedy the situation

  • Open Ubuntu Settings
  • Navigate to Displays
  • Select Single Display option
  • Set Primary Display to 1 Built-in display
  • Click Apply
    • You should have only your laptop display working right now
  • Go back to Displays settings and set them however you like now
    • Displays should work correctly now
  • To force greeter on built-in display open terminal and run the following
cd ~/.config
sudo cp monitors.xml /var/lib/gdm3/.config/

Now everything should be set-up correctly

Source: https://forums.developer.nvidia.com/t/nvidia-xconfig-doesnt-do-what-i-want-it-to-nor-does-nvidia-settings/107883/7

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.