My external monitors are detected but i can not enable them

Hi it is my first steps with Manjaro + amd-nvidia combination and I faced following problem:

When I plug in my two external monitors I can see in the ’Display configuration’ that they are detected, but if I click ’enable’ checkbox then nothing happens to my external monitors, but my main laptop screen becomes black, and I cannot do anything.
I make sure that I have ’non-free’ drivers installed and output says that they are already installed:

sudo mhwd -a pci nonfree 0300
> Skipping already installed config 'video-hybrid-amd-nvidia-prime' for device: 0000:01:00.0 (0300:10de:249d) Display controller nVidia Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q]
> Skipping already installed config 'video-hybrid-amd-nvidia-prime' for device: 0000:05:00.0 (0300:1002:1638) Display controller ATI Technologies Inc Cezanne

Then I do some research, and it looks like maybe I have installed NVIDIA drivers, but my OS is using AMD graphic driver:

glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: AMD
OpenGL renderer string: AMD RENOIR (DRM 3.40.0, 5.10.41-1-MANJARO, LLVM 11.1.0)

Then i read this answer Monitor detected, but black screen - #2 by @pobrn and i thought that maybe it is a good idea to install Nvidia Optimus, but in official Manjaro Wiki I can read that Nvidia Optimus is for combiantion intel + invidia where mine is amd + nvidia (this is the source of my concern that maybe I can break sth). @pobrn also suggested in his answer few changes to make it work with amd + nvidia.

What do you think should I try this solution? Or maybe now there is other suggested way to solve this problem?

Environment:

  • Branch: Stable
  • Desktop Environment: KDE
  • CPU: AMD Ryzen 9 5900HX
  • GPU: RTX 3070
  • Kernel: 5.10.41-1-MANJARO

You shouldn’t be concerned. I still suggest optimus-manager for (almost) all multi-GPU configurations. I believe that’s a flexible and easy to use solution.

OK thanks, so I will give it a try and return with results

@pobrn okay, so I have installed Nvidia Optimus then optimus-manager --switch nvidia then my screen become black then I open shell mode (ctrl + alt + f2) and poweroff my computer. After I turn on again it seems it didn’t work, and I still cannot use my external monitors + result of glxinfo|egrep "OpenGL vendor|OpenGL renderer" is the same:

glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: AMD
OpenGL renderer string: AMD RENOIR (DRM 3.40.0, 5.10.41-1-MANJARO, LLVM 11.1.0)

I have tried to run optimus-manager --switch nvidia one more time, and now it returns such output:

sudo optimus-manager --switch nvidia
A GPU switch from integrated to nvidia is pending.
Log out and log back in to apply.
WARNING : no power management option is currently enabled (this is the default since v1.2). Switching between GPUs will work but you will likely experience poor battery life.
Follow instructions at https://github.com/Askannz/optimus-manager/wiki/A-guide--to-power-management-options to enable power management.

You are about to switch GPUs. This will forcibly close all graphical sessions and all your applications WILL CLOSE.
(you can pass the --no-confirm option to disable this warning)
Continue ? (y/N)
> y
Switching to mode : nvidia
/bin/sh: line 1: i3-msg: command not found
/bin/sh: line 1: openbox: command not found
/bin/sh: line 1: awesome-client: command not found
/bin/sh: line 1: bspc: command not found
/bin/sh: line 1: qtile-cmd: command not found

Any ideas?

EDIT-1:
I also see that now I cannot see my monitors in Display configuration and also cannot open nvidia-settings:

nvidia-settings 

(nvidia-settings:4516): Gtk-WARNING **: 19:33:02.533: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

ERROR: Unable to load info from any available system

This definitely shouldn’t be here. Please read this if you haven’t already. What do optimus-manager --status and ls /etc/X11/xorg.conf.d/ say?

I put # before DisplayCommand and the one starting with DisplayStopCommand it was also in the instruction which you have linked in another answer.

I am getting this output:

optimus-manager --status
A GPU switch from integrated to nvidia is pending.
Log out and log back in to apply.
Optimus Manager (Client) version 1.4

Current GPU mode : integrated
GPU mode requested for next login : nvidia
GPU at startup : integrated
Temporary config path: no

ls /etc/X11/xorg.conf.d/
00-keyboard.conf  10-optimus-manager.conf  30-touchpad.conf

What happens if you log out and log in again?

I get black screen again then I open shell mode and type optimus-manager --status one more time and it returned:

ERROR: a GPU setup was initiated but Xorg post-start hook did not run.
Log at /var/log/optimus-manager/switch/switch-20210612T194807.log
If your login manager is GDM, make sure to follow those instructions:
https://github.com/Askannz/optimus-manager#important--gnome-and-gdm-users
If your display manager is neither GDM, SDDM nor LightDM, or if you don't use one, read the wiki:
https://github.com/Askannz/optimus-manager/wiki/FAQ,-common-issues,-troubleshooting
Cannot execute command because of previous errors.

Then i poweroff and run optimus-manager --status one more time. This is the result now:

optimus-manager --status
Optimus Manager (Client) version 1.4

Current GPU mode : integrated
GPU mode requested for next login : no change
GPU at startup : integrated
Temporary config path: no

Should I logout and login one more time?

@pobrn I logout and login again nothing changed still cannot open nvidia-settings and do not see my monitors in Display configuration.

optimus-manager --status still gives the same result

optimus-manager --status
Optimus Manager (Client) version 1.4

Current GPU mode : integrated
GPU mode requested for next login : no change
GPU at startup : integrated
Temporary config path: no

Can you post the output of head -n-0 /etc/X11/* /etc/X11/xorg.conf.d/*?

head -n-0 /etc/X11/* /etc/X11/xorg.conf.d/* result:

==> /etc/X11/mhwd.d <==
head: error reading '/etc/X11/mhwd.d': Is a directory

==> /etc/X11/xinit <==
head: error reading '/etc/X11/xinit': Is a directory

==> /etc/X11/xorg.conf.d <==
head: error reading '/etc/X11/xorg.conf.d': Is a directory

==> /etc/X11/xorg.conf.d/00-keyboard.conf <==
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "pl"
EndSection

==> /etc/X11/xorg.conf.d/10-optimus-manager.conf <==
Section "Device"
        Identifier "integrated"
        Driver "modesetting"
        BusID "PCI:5:0:0"
        Option "DRI" "3"
EndSection


==> /etc/X11/xorg.conf.d/30-touchpad.conf <==
Section "InputClass"
    Identifier "touchpad"
    Driver "libinput"
    MatchIsTouchpad "on"
    Option "Tapping" "on"
EndSection

That looks OK. Can you also post the contents of /var/log/optimus-manager/switch/switch-20210612T194807.log?

@pobrn this is the result of optiums-manager --switch nividia operation:

[7] INFO: # Xorg pre-start hook
[7] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': 'integrated'}
[7] INFO: Requested mode is: nvidia
[180] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[181] INFO: Unloading modules ['nouveau'] (if loaded)
[184] INFO: switching=none, nothing to do
[216] INFO: Loading module nvidia
[219] INFO: Loading module nvidia_drm
[240] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[240] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20210613T234259', 'requested_mode': 'nvidia'}
[241] INFO: Xorg pre-start hook completed successfully.
[6] INFO: # Xorg post-start hook
[7] INFO: Running xrandr commands
[16] ERROR: Cannot setup PRIME (xrandr error):
None
[16] INFO: Running /etc/optimus-manager/xsetup-nvidia.sh
[38] INFO: Writing state {'type': 'done', 'switch_id': '20210613T234259', 'current_mode': 'nvidia'}
[39] INFO: Xorg post-start hook completed successfully.

What is in /etc/X11/xorg.conf.d/10-optimus-manager.conf? And what does xrandr -q say?

I find out another way to make it to work. I will post the solution after few days if I do not spot any side effects

Display Port is currently broken on some setups with the current 465 drivers …

@philm @pobrn after few days I can say it doesn’t work correctly. I was having many ‘noisy squares’ on my screen, for example:

They had different sizes. When I was moving my mouse, those ‘noisy squares’ were moving too. Sometimes it was working correctly, and I was not seeing any ‘noisy squares’, but in the end (today) it has stopped working correctly at all, boot process always stopped at /dev/nvme0n1p5: clean. What do you think, is there something wrong with my laptop GPU or maybe these Nvidia + AMD configuration is super hard to make them work under Linux with 2 external displays?

How did you configure it?

I did sth like that: AMD + NVIDIA setup on linux manjaro / arch (github.com). I found this on some forum, but now I cannot find this anymore (I am not an author of this script. I only modified it a little for my own peruse).

Today I make it to work with optiums-manager. I build optiums-menager using AURA repository, then remove /etc/X11/xorg.conf.d/90-mhwd.conf. In the README.md of this project, it is written that optiums-manager should take care of this and remove this file by himself, to avoid any conflicts. In my case, is didn’t happen, and I had to do it manually, then everything started to work.
Only one issue left. I still have those ‘noisy-squares’. Can you advise me something @pobrn @philm ? Is it connected more with Nvidia drivers for linux, or maybe more possible that there is sth wrong with my GPU? (I am connecting with this monitors by usb-c docking station with 2 display ports 1.4, but actually the same thing happens if I connect on directly to my laptop with HDMI cable).

[For future readers]
For all of you, I highly recommend following instructions from official source instead of some forum posts. It can save a lot of your time. Repository with Arch bridge for optimus-menager: Askannz/optimus-manager: A Linux program to handle GPU switching on Optimus laptops. (github.com)

You can enable AUR in add / remove software preferences