So I think this is my third post on setting display resolutions under Ubuntu. I’ve got this Dell P2311H 23″ monitor, which has really been great for what it cost me (around $200, I believe). However, the monitor resolutions don’t get picked up by Ubuntu and after a few restarts of my computer, I end up with 640×480 display, which is really a pain in the ass. The odd part is, that usually during installation and for a few restarts, everything runs fine. Eventually it always gets jacked. It has something to do with the monitor not putting out a EDID. I write a little about it here. Anyhow, I recently updated to Xubunut 12.04 (not a fan of Unity at all). And so of course, here I am dealing with the same issue. Things have changed since 10.10 however.
In Xubuntu 12.04 (which for the record is simply Ubuntu running Xfce rather than Unity), the xorg.conf files are handled a bit differently. Firstly, they’ve moved out of the /etc/X11 directory and into the /usr/share/X11 directory. Additionally, they have become they. In 12.04, and I believe since 11.04, the xorg.conf is now a directory called xorg.conf.d and contains various *.conf files. This is a very welcome change as it allows for the config files to be more organized. In the /usr/share/X11/xorg.conf.d directory, there should already be a number of files. One thing to not here is the that naming convention is to start with a two digit number then dash then the config file name, such as 10-monitor.conf, which is what we will be using. From what I understand the number at the beginning is used to sort which file gets loaded first. I believe there are also some conventions for the number ranges, such as numbers in the 40s are all for some type of config. I really don’t know, but in case you care, there is a rhyme or reason to it, which you can of course choose to ignore if you wish.
Before we begin, there are a few pieces of information we need. Firstly, we need to know how to write our modeline. What’s a modeline? I don’t really know, but we’ll be generating one with the gtf
command which takes three parameters, Horizontal Resolution, Vertical Resolution and Refresh Rate. In my case, I will be entering the command like this:
gtf 1920 1080 60
.
This will provide a modeline for a screen resolution of 1920px width 1080px high and a refresh rate of 60hz. If you don’t know your refresh rate, you probably want to go with 60, especially if you’re using an LCD screen. Entering the command should output something like this:
# 1920×1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
We want the “Modeline” which is including and everything after the word “Modeline”.
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
We also need the Mode Name. This is the first part in quotes: "1920x1080_60.00"
, including quotes.
Next, we need to know the name of our display device. To retrieve this, enter xrandr
into the terminal. This should output something similar to the following:
Screen 0: minimum 320 x 240, current 1920 x 1080, maximum 1920 x 1080
default connected 1020x1080+0+0 0mm x 0mm
What we’re looking for here is the name of the device. This should be whatever appears before the word “connected”. In my case the device name is “default”.
Now it’s time to write the configuration file. As I mentioned earlier, we are going to create a 10-monitor.conf file. To do so sudo an editor of your choosing such as pico or leafpad. If you don’t like the terminal try the command sudo leafpad /usr/share/X11/xorg.conf.d/10-monitor.conf
. Personally, I enjoy myself a little pico and will be entering sudo pico /usr/share/X11/xorg.conf.d/10-monitor.conf
. Either will do.
Type up your config file to look like the following, where <MODELINE> and <MODENAME> are replaced with the modeline and modename you found in the Step 1 and <DEVICENAME> with the device name found in Step 2.
Section "Monitor"
Identifier "Monitor0"
<MODELINE>
EndSection
Section "Screen"
Identifier "Screen0"
Device "<DEVICENAME>"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes <MODENAME>
EndSubSection
EndSection
In my case, the final file looks like this:
Section "Monitor"
Identifier "Monitor0"
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "default"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080_60.00"
EndSubSection
EndSection
IMPORTANT! READ THE FULL NEXT PARAGRAPH
For the changes to take you’ll need to save the file and restart your computer. If everything was done correctly, your resolution should be set at 1920×1080 (or whatever resolution you’re using) and you shouldn’t need to touch this stuff again. HOWEVER, if you have a typo or anything wrong with the config file you’ve just created, it is possible for you to lose your display entirely. If this happens, wait for the computer to fully boot and press Ctrl+Alt+F1. This should bring up a terminal and allow you to remove the config file you’ve just created. Do so by running the following:
sudo rm /usr/share/X11/xorg.conf.d/10-monitor.conf
Once you’ve removed the file, restart the computer (this can also be done in the terminal by running sudo reboot
). You can also edit the file the same as we did before, although leafpad won’t be an option any more, and attempt to decipher what is causing the problem. It is entirely possible that this solution simply won’t work for your configuration and monitor.
Good luck. And thanks to Samuel Martin for the original post on this.
This didn’t work for me, though it provided a starting point. I saved the resolution in a 10-monitor.conf file from the nVidia software per what you suggested above. I also tried several times setting the resolution from the built-in Display icon in Settings. It took a while and I can’t recall the exact steps I took–but basically I did a bunch of fiddling with the nVidia software and with the built-in Display app. At one point it finally stuck, and I’m up and running again.
The DDC (Display Data Channel) part off my monitor failing , i tried this and worked fine for me !
thanks !
Thx,it works for me xubuntu,2 screen1280*800 1024
[…] suggest editing xorg.conf, but that file is not present on my system. I tried the solution in http://www.bingshui.org/tech/defining-display-resolutions-in-xubuntu-12-04/ but this caused the system to freeze right before the login screen comes up, and I had to delete […]
[…] suggest editing xorg.conf, but that file is not present on my system. I tried the solution in http://www.bingshui.org/tech/defining-display-resolutions-in-xubuntu-12-04/ but this caused the system to freeze right before the login screen comes up, and I had to delete […]
[…] suggest editing xorg.conf, but that file is not present on my system. I tried the solution in http://www.bingshui.org/tech/defining-display-resolutions-in-xubuntu-12-04/ but this caused the system to freeze right before the login screen comes up, and I had to delete […]
Short: It worked for me.
Long: I tried out this solution on slot 2 of my nVidia GTX 750 Ti – did not work. I tried this solution while my monitor was plugged in slot 1 – worked wonders. So I don’t know, but … it works. Memo: Try all Inputs.
Thanks a Lot!!!
How does this work if I have two monitors?
I’m having lots of trobule setting this up.
Thank You
As far as I can tell from repeatedly trying many variations on these instructions, this doesn’t work on Xubuntu 14.04. This page comes up a lot on search results, so a person can eat up a lot of time trying to get these instructions to work. One can add the resolution through the command line with a series of xrandr commands, but this technique of persisting it to the next reboot didn’t work for me.
Thanks! It helped to me for Xubuntu 14.04 after changing of monitor