Problem with xorg and dual monitor

Hello all,
I’m newish to Linux, came from Arch and previously Manjaro, I must say I’m loving EOS so far. I got the i3 edition, just finished tweaking and setting my workflow. I used arandr to get my monitor working, wrote the xorg conf but when I reboot it doesn’t start my second monitor, just the default from the laptop.
Running an MSI laptop with HDMI connected to a monitor.
here’s my xrandr:

Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1920x1080     60.01*+  59.93  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1024x768      60.00  
   1024x576      60.00    59.90    59.82  
   960x540       60.00    59.63    59.82  
   800x600       60.32    56.25  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+  59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1400x1050     59.98  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-1-0 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
  1680x1050 (0x48) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1280x1024 (0x4e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x800 (0x55) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1024x768 (0x5a) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x61) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  640x480 (0x66) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz

my 10-Monitor.conf:

Section "Monitor"
    Identifier  "HDMI-1-0"
    Option      "Primary" "true"
EndSection

Section "Monitor"
    Identifier  "eDP1"
    Option      "LeftOf" "HDMI-1-0"
EndSection

arandr generated the follow xrandr command (which works perfectly):
xrandr --output eDP1 --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off --output HDMI-1-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DP-1-0 --off --output DP-1-1 --off

I’d appreciate any help

It sounds like you have more experience with this than I do - but did you tell arandr to save its results as a default? I seem to recall something about xorg.conf not being used as it was as well. At worst - a startup script with the ‘works perfectly’ command?

I think you need to setup your screen with xrandr and then save the configuration using the following command

autorandr --save workstation

Workstation is a custom name you can choose. Then any time you use this display config it should remember automatically.

I tried both options above and didn’t work.
Spent almost all day trying to fix this but no success.
I tried using nvidia only:
https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Use_NVIDIA_graphics_only
Now just the HDMI works (external monitor), still need to arandr in every boot.
Tried bumblebee, nothing, doesnt show my nvidia card in any way. Nvidia-xrun also doesn’t work.
I tried some xorg.conf with the monitor settings and positions but my laptop screen(eDP) just shows a blinking _
Some ideas?

If you have a dual/hybrid card perhaps you driver install may be problematic then.

I am a bit confused about the problem. Above you mention that you had problems saving your laptop and external screen config when rebooting and having to reset it at each boot but you managed to connect both initially.

Here you mention a problem with graphics driver and that you cannot connect both screens. What hardware are you running, nvidia only or hybrid graphics? Just trying to get the right info so someone can help you.

I suggest you post first your hardware and explain the steps or method you used to install your graphics driver. Bumblee and then back to nvidia/optimus is a bit messy to fix and there are several discussion threads where users have been helped with fixing this in this forum I recall. I suggest to first fix this issue. Use the search function above, I will also see if I can find any.

Edits: removed the other info to avoid confusion…

I prefer and recommend installing the nvidia driver first and make it work before using optimus. For hybrid graphics, normally the system would use the nvidia for the external screen and the intel for your laptop without the need to switch manually using optimus. The best may be to remove optimus, bumblebee, altogether and install your nvidia driver first.

Here are the steps for nvidia driver just in case:

Edits: it may also be worth checking which service is running, besides listing graphics cards:

inxi -G

systemctl status optimus-manager.service

systemctl status bumblebee.service

And before I forget, welcome to the community :grinning:

Thank you @Zircon34
My response was a bit unclear since I was very tired of rebooting over 50 times in a day haha
When I uninstalled bumblebee I couldn’t even load my lightdm, needed to switch tty and delete all config files in /etc/X11/ and some left from bumblebee.


 I  ~  inxi -G                                                                                                                                                                     
Graphics:  Device-1: Intel HD Graphics 530 driver: i915 v: kernel 
           Device-2: NVIDIA GP106M [GeForce GTX 1060 Mobile] driver: nvidia v: 460.39 
           Display: x11 server: X.Org 1.20.10 driver: loaded: modesetting,nvidia unloaded: fbdev,vesa resolution: 
           1: 1920x1080~60Hz 2: 1920x1080~60Hz 
           OpenGL: renderer: GeForce GTX 1060/PCIe/SSE2 v: 4.6.0 NVIDIA 460.39 
 I  ~  systemctl status optimus-manager.service                                                                                                                            
Unit optimus-manager.service could not be found.
 I  !  ~  systemctl status bumblebee.service                                                                                                                                      
Unit bumblebee.service could not be found.

I won’t remember all the steps I did, but tried pretty much everything I could find on arch forums.
I tried to use just the NVIDIA card but couldn’t get my laptop screen to work (eDP1)
tried bumblebee but I guess it will just work if I want to use both screens with intel graphics, which I don’t want.
where am I at right now:
I have just some xorg script from the arch wiki to enable only NVIDIA, which makes only my external monitor to work on boot up (HDMI) and then wrote a simple xrandr script that I run with i3blocks click or i3 shortcut to show both screens:

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection
#!/bin/sh
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DP-1 --off --output DP-0 --off

edit, my xrandr output right now:

Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
HDMI-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+  59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1400x1050     59.98  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
eDP-1-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1920x1080     60.01*+  60.01    59.97    59.96    59.93  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
  1680x1050 (0x1c4) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1280x1024 (0x1c9) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x800 (0x1ca) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1024x768 (0x1d0) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x1d2) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  640x480 (0x1d6) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz

Ok, looks like you have the right driver. Sorry for asking again, its been a long workday.

Do I unterstand correctly that when you boot you can connect both screens but it is not persistent?

yes, I boot and only HDMI is enabled, when I arandr I need to enable eDP1 (or right now just run the script)

Just wondering, what happens when you boot without hdmi, then connect your screen to your laptop, does it pick it up if you use the two commands above, the xrandr to define your screen config and the autorandr to save it? Sorry if it seems dumb, just making sure we cover the most simple scenario first and you mentioned several time that hdmi was connected on boot…

I suggest you try boot normal no hdmi connnected. Then connect hdmi when in the system and try this again:

xrandr --output HDMI-0 --auto --left-of eDP-1-1
if it connects your external screen the use these two commands:

autorandr --save workstation1
autorandr --change

This should hopefully do it and save it this time. It may be that you need to disable some of these previously saved scripts you mentioned, back them up.

and additional info on autorandr may help

1 Like

Thank you @Zircon34 ! it works now :smiley:
I saved this xrandr:
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal
edit
----Solution for me----

Laptop with external monitor HDMI and hybrid cards (Intel and NVIDIA)

  1. delete all XORG conf setting monitor output/position from “/etc/X11/xorg.conf.d/*” or “/etc/X11/xorg.conf”
  2. add “/etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf”:
Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection
  1. Download autorandr - $ pacman -S autorandr
  2. set xrandr:
    xrandr --output <outputeDP> --mode 1920x1080 --pos 0x0 --output <outputHDMI> --primary --mode 1920x1080 --pos 1920x0
  3. save autorandr:
    autorandr --save workstation1
    autorandr --change
1 Like

Awesome! :+1: