3

I have two monitors set up on my desktop PC running Ubuntu 18.04 with an NVIDIA GTX 960 graphics card. I'm running the proprietary NVIDIA drivers.

First I open nvidia-settings and adjust the monitors so that they are arranged as shown below.

enter image description here

Then I create a new /etc/X11/xorg.conf file using the "Save to X Configuration" button. The resulting /etc/X11/xorg.conf is shown below.

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 410.79

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL U2414H"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 960"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "DP-4: nvidia-auto-select +1920+0 {rotation=left}, DVI-I-1: nvidia-auto-select +0+840"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

After rebooting, the right monitor is no longer rotated, as indicated in the nvidia-settings.

enter image description here

In case it's important the left monitor is connected via DVI-I (DVI-I-1) and the right monitor is connected via DisplayPort (DP-4).

What I've tried

First I checked to see if a /usr/share/X11/xorg.conf file existed, which I believe would take precedence over /etc/X11/xorg.conf. The /usr/share/X11/xorg.conf does not exist.

Next, I tried removing the /etc/X11/xorg.conf completely, then recreating the it file through the nvidia-settings tool. Same behavior as before.

If I remove /etc/X11/xorg.conf file then the monitor locations are swapped which indicates that the configuration is being loaded since the behavior is different when the nvidia-settings xorg.conf file is present.

(Nuclear Option) I also tried installing a fresh copy of Ubuntu 18.04 on an extra internal hard disk. Same behavior as before.

Does anyone have an idea why this is happening? It's pretty annoying to have to change my monitor rotation every time I start the system.

1
3

In your case, with your monitors named DVI-I-1 and DP-4 a temporary solution would be to set the following command as a startup application:

xrandr --output DP-4 --rotate right --pos 1920x0 --output DVI-I-1 --pos 0x840

However i do not find this solution satisfying as this should be handled by Ubuntu and/or Nvidia drivers so that the configuration is instantaneously right at startup rather than waiting for this command to run.

For those who have the same issue, with two monitors having the same resolution Hres x Vres, the left monitor horizontal and the right vertical:

  1. Find your monitor names with:

    xrandr | grep " connected"

Now let's assume they are called Mon1 and Mon2 (replace with your own names in the subsequent commands).

  1. Calculate the vertical position Vpos defined as the distance between the top of your horizontal monitor to the top of your vertical monitor. You can see below this is defined this way because the origin is at the top left. If you only know the vertical shift Vshift from the bottom, you can easily compute Vpos as:

    Vpos = Vres - Hres - Vshift

       0                        Hres           Hres + Vres
    0                            -------------------
                                 |                 |
                                 |                 |
                                 |                 |
                                 |     Mon2        |
  Vpos    -----------------------|                 |
          |                      |  Vres x Hres    |
          |                      |                 |
          |         Mon1         |                 |
          |                      |                 |
          |     Hres x Vres      |                 |
          |                      |                 |
Vpos+Hres -----------------------|                 |
                     ^           |                 |
             Vshift  |           |                 |
  Vres               v           -------------------
  1. Create a startup application (search for "startup" in Ubuntu search) with the command below (replace mon1 and mon2 with your monitor names, Hres with your monitor horizontal resolution, and Vpos with the number as you computed from step 2):

    xrandr --output mon2 --rotate right --pos Hresx0 --output mon1 --pos 0xVpos

You should be able to easily generalize to monitors with different resolutions or with different alignments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.