Enabling Resolutions in Ubuntu 12.04 & Lubuntu 12.04
Earlier I was setting up a new Lubuntu powered computer which was to be connected to a TV via HDMI as its primary display. When I set it up with my TV it recognised 1920×1080 as a viable resolution no problem at all.
When I went to set it up on its destination display it refused to display anything above 1280×720.
“What gives?” I thought to myself. Well, I never found out what gave, but here’s how to fix it:
The problems:
- xandr based commands reset whenever you restart, and while you can (apparently) set the commands to run on startup, my attempts to do so proved fruitless.
- xorg.conf is A) deprecated B) couldn’t be generated by Xorg :1 -configure.
- /etc/X11/xorg.conf.d/10-monitor.conf (the proper replacement for xorg.conf) path (as specified by the Archlinux Wiki) was nowhere to be found, and creating it did nothing.
The solution:
It turned out after some Googling that xorg config files had been moved to /usr/share/X11/xorg.conf.d/
So, what do we do with that information? Well first we need two bits of machine-specific information.
1) We need to generate a modeline
We do so by going into terminal and typing “gtf x y r” where x is the horizontal resolution, y is the vertical resolution and r is the refresh rate (which is largely irrelevant since LCDs are the norm). So for example, mine was:
gtf 1920 1080 60
You’re probably safe to keep the refresh rate at 60 unless you have a good reason to do otherwise. Once you’ve executed the command you’ll be presented with something like this
# 1920x1080 @ 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’re only interested in the second half, so make a note of everything from modeline onwards.
2) We need to find the display interface name
In the terminal type: xrandr
This will give you something along the lines of:
Screen 0: minimum 64 x 64, current 1920 x 1080, maximum 32000 x 32000 HDMI-1 connected 1920×1080+0+0 0mm x 0mm
The display interface name is the bit before ‘connected’ so in this case ‘HDMI-1’. Make a note of yours.
3) Creating the 10-monitor.conf
In order to create our spangly new resolution we need to create /usr/share/X11/xorg.conf.d/10-monitor.conf
So in the terminal run:
sudo leafpad /usr/share/X11/xorg.conf.d/10-monitor.conf
This will open a blank text file, into which you want to paste the following:
Section "Monitor"
Identifier "Monitor0"
<INSERT MODELINE HERE>
EndSection
Section "Screen"
Identifier "Screen0"
Device "<INSERT DEVICE HERE>"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "<INSERT MODENAME HERE>"
EndSubSection
EndSection
The modename is the bit in quotes (so 1920x1080_60.00 in our earlier example). You can add additional resolutions that already exist in the list xandr shows just by putting them in quotes and adding them to the end of the modes line.
So for reference, mine looks like this:
Section "Monitor"
Identifier "Monitor0"
Modeline "1920x1080_60.00" 82.97 1000 1064 1168 1336 1000 1001 1004 1035 -HSync +Vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "HDMI-1"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080_60.00" "1024x768"
EndSubSection
EndSection
And you’re done!
Once you’ve saved 10-monitor.conf in /usr/share/X11/xorg.conf.d/, restart your computer and you should have your brand new resolution available and set as default.
What to do if it all goes wrong.
If you get a black screen on restarting, don’t panic, it probably means a typo or other syntax error of some description.
While the computer’s on, hit ctrl+alt+F1 to go into a terminal and run:
sudo rm /usr/share/X11/xorg.conf.d/10-monitor.conf
Then restart and you’ll be back to defaults! Hope this saves someone some time and hair-pulling!