Linux – How to get the Nvidia monitor position settings (in Linux) to persist after a restart

linuxlinux-mintnvidia-graphics-card

I have two monitors, and I run them both in Linux using the proprietary Nvidia drivers with "TwinView". I just installed Linux Mint 13, and since the install after every reboot my monitors come up in the wrong position (the computer thinks the left monitor is on the right).

After boot-up I can run the Nvidia config and fix the monitors' position, and I can even save the configuration file successfully. But as soon as I restart again, the monitors re-appear switched.

Does anyone have any idea what might be causing this (and more importantly, how I can solve it?)

* Edit *

I tried manually editing my xorg.conf as follows:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "CRT-1"
    Option         "metamodes" "CRT: 1280x1024, DFP: 1280x1024"
    Option         "TwinViewOrientation" "RightOf"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

but the wrong monitor still comes up on the right.

If I change "RightOf" to "LeftOf", I boot in to a black screen and a frozen mouse/keyboard.

Best Answer

Run sudo nvida-settings and click on "Save to X configuration file":

enter image description here


UPDATE:

If that doesn't work, try the following:

  • First, generate a new /etc/X11/xorg.conf using the nvidia utility:

    $ sudo nvidia-xconfig
    

    Your current xorg.conf (if you have one) will be saved as /etc/X11/xorg.conf.nvidia-xconfig-original

  • Now, set everything up as you want it with nvidia-settings and save to xorg.conf as in the screenshots above:

    $ sudo nvidia-settings
    

    Make sure you change something, otherwise nvidia-settings won't allow you to save your changes.

  • At this point, you should have an /etc/X11/xorg.conf file with a line like this in Section "Screen":

    Option         "metamodes" "CRT: 1440x900 +1600+0, DFP: 1600x900 +0+0"
    

    The details will be different but what this line means is that the CRT (VGA) monitor has a resolution of 1440x900 and a horizontal offset of +1600. In other words, it is to the right of my laptop's (DFP) monitor.

  • Remove all offset values (+1600+0 and +0+0 above) from that line and set the screen position like so (you can also use the offsets but I find this clearer):

    Option         "metamodes" "CRT: 1440x900, DFP: 1600x900"
    Option         "TwinViewOrientation" "RightOf"
    

    The TwinViewOrientation option sets the position of your secondary monitor with respect to your primary one. You can use RightOf, LeftOf, Above, Below, and Clone

  • Finally, save the file and log out/log back in.

The following resources are a great source of information for xorg.conf and NVIDIA:

Related Question