I have not seen a clear explanation anywhere on how to do this. X and Xorg.conf is frankly atrocious and outdated and needs to replaced as soon as possible by something like Wayland.
Ubuntu no longer uses the xorg.conf settings file. The X.org server simply generates default sections on the fly. This is fine if you have a monitor directly plugged in. But if you have a KVM box (to switch between multiple monitors, mice and keyboards) that blocks full communication with the monitor then Ubuntu will boot up into an ugly low-res default resolution (or worse). Here’s how I fixed this on my machine.
First use nvidia-settings to make a basic xorg.conf settings file. Make sure you are doing this connected direct to the monitor (no KVM box).
Make sure the correct metamode, resolution and refresh rate is set, then “Save to X configuration file”. Copy the xorg.conf file from the window that brings up. Save it somewhere. Then save the EDID monitor file … there’s button for this in the nvidia-settings.
Add the EDID line as shown below to your xorg.conf file. Make sure the name at the start of the line matches with the
“Identifier “Device0″” line in the device section name of your display device (examine you xorg log). Should be something like “CRT-1”.
Option “CustomEDID” “CRT-1:/home/djbarney/edid.bin”
Then remove “nvidia-auto-select” from the metamodes line in the Screen section. Leave the rest of the line as it is.
# nvidia-settings: X configuration file generated by nvidia-settings # nvidia-settings: version 270.29 (buildd@roseapple) Fri Feb 25 14:43:24 UTC 2011 Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" Option "Xinerama" "0" EndSection Section "Files" 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 "NUL-M17W" HorizSync 31.5 - 60.0 VertRefresh 56.0 - 75.0 Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce 8600 GT" Option "CustomEDID" "CRT-1:/home/djbarney/edid.bin" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "TwinView" "0" Option "metamodes" "+0+0; 1440x900_60 +0+0" SubSection "Display" Depth 24 EndSubSection EndSection
Copy your xorg.conf file to “/usr/share/X11/xorg.conf.d”. Make sure there are no xorg.conf files around that might cause trouble … look in /etc/X11. If you find any delete them.
Now connect your KVM box. Stop the X server with “sudo service gdm stop”. Then start it with “sudo service gdm start”. The server should then start with the resolution set as if you had it connected direct to the monitor.
Lastly support Wayland and other replacements for X. Xorg has an odd history and is really a mess of experimental code and peculiar standards that have built up over the years. It is not kind to Linux beginners and needs to be replaced with something sane and non-evil.
UPDATE APRIL 2013: I had not updated this post. This method works but has issues with it. For example X can sometimes get confused switching between monitors because it can only see the EDID file. I eventually bought a KVM box that saves the actual EDID data in the box so X will always be presented automatically with the correct EDID.