Settings for multiple monitors are not stored

I am running Ubuntu 12.04. on a Lenovo Thinkpad T400. I connected an external monitor as a second display. The laptop stands under the external screen. The laptop has a native resolution of 1440x900 (16:10), the external monitor 1280x1024 (5:4). There are two graphic adapters: one internal Intel GMA 4500 MHD and an discrete ATI card. Currently, the integrated Intel is enabled.

I use the Displays application to arrange the position of the monitors so it look like this:

Desired display configuration

The problem:
Whenever I restart my computer the configuration gets lost. First, the displays are mirrored instead of extended. I have to press Fn + F7 two times to switch to extended mode. Second, the Displays settings still look like this:

Diplay configuration after restart

I know this worked once when I was running Ubuntu 10.10. I cannot tell since when it does not work. Do you know how I can permanently store the settings?


Sometimes when I start Ubuntu and press Fn + F7 nothing happens. When I open Displays I and position the external screen above and press the "Apply" button nothing happens. Then, after a minute or so the settings apply suddenly. Do you know if there is a log file which could help to analyse the behavior?


Solution 1:

There are 2 basic approaches you can take. The first is to utilize randr which will allow you to create one large virtual display in which you can position your monitors. The second is to utilize xinerama which will allow you to have 2 separate X screens which will function as one large display. I will cover both here and you can decide which is more appropriate for your needs.


RandR - Resize and Rotate

You can dynamically enable dual head by using XRandR

xrandr --output foo --above bar

There is also a gui frontend for this called arandr which is in the 12.04 repos, but it would seem that you want a more static configuration.

It could be as simple as creating /etc/X11/xorg.conf.d/10-monitor.conf with the contents:

Section "Monitor"
  Identifier     "Monitor0"
EndSection

Section "Monitor"
  Identifier     "Monitor1"
  Option         "Above" "Monitor0" 
EndSection

This method implies an randr setup. There are some notable drawbacks if using xrandr with monitors of different resolutions. Windows may be improperly placed, there may be black areas on one screen, etc..

When you run xrandr without command line options you can find out which Identifier you need to use in your 10-monitor.conf. Then restart Ubuntu to see if the settings are loaded.



Xinerama To enable xinerama you need to modify /etc/X11/xorg.conf:
Section "ServerFlags"
  Option    "Xinerama" "true"
EndSection

It might be as simple as that as X is pretty good about automagically configuring things based on hardware detection. But, if simply turning the xinerama extension on does not provide the functionality you desire, you may opt to fully configure X to use xinerama. There are a few ways to configure X. You could have multiple files in /etc/X11/xorg.conf.d/, some for your monitors, some for the devices, etc. I will cover having a single xorg.conf file that contains all the settings using a modified version of my current setup.

Section "ServerLayout"
    Identifier     "DualHead"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" Above "Screen0"
    Option         "Xinerama" "1"                # You can specify xinerama here
EndSection

Section "Device"
    Identifier     "Device0"                     # A Device section for each monitor
    Driver         "nvidia"                      # Specify the driver to use
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 430"
    BusID          "PCI:1:0:0"                   # Use lspci | grep VGA to find BusID
    Screen          0                            # Do note the screen number
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 430"
    BusID          "PCI:1:0:0"
    Screen          1                            # Do note the screen number
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Gateway HX2000"
    HorizSync       31.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "DELL 1907FPV"
    HorizSync       30.0 - 81.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
EndSection

Obviously you will need to modify this to suit your hardware, but the basic skeleton is there for you.

Do note that I have recently read that Intel might have issues with xinerama. You may find yourself needing to utilize your discrete graphics card.

Solution 2:

I'm not sure if this will work but it's worth a try: Disable the intel; enable the ati; install proprietary ati/amd drivers; configure the dual-monitor desktop how you want it; verify the configuration in the amd catalyst software (admin); check that your setup is now persistent. I have a desktop, but using the catalyst tool was the only way I was able to keep my dual-monitor setup persistent.