Guerrilla Tactics to Force Screen Mode in Ubuntu
Readers of my previous posts will know about the bad luck I've had when it comes to getting the screen setup on Linux, particularly with Ubuntu Linux. It's a particularly annoying problem when the hardware detection goes wrong and one is presented with a list of unsuitable screen modes. What follows is a way of using XRandR (X Rotate and Resize) to brute force a desired screen mode for X when conventional routes have failed.
Once you've added the new mode and tested that it works, you can add it to your xorg.conf or to the startup script of your login manager. Most of what follows assumes that you are using Ubuntu Linux, but it should work just as well with all but the most unusual distributions.
If you're having a problem whereby your monitor immediately goes blank and reports that the incoming signal is out of range when X starts, it might be worth attempting to the change the screen mode by hitting ctrl+alt+[minus symbol]. Repeatedly pressing this combination might select a screen mode that your monitor can display.
Once you have a usable display, open up a command line and type:
xrandr
When you invoke XRandR with no parameters, it lists the currently supported screen modes. Typical output might look something like this:
Screen 0: minimum 800 x 600, current 800 x 600 , maximum 800 x 600 default connected 800x600 +0+0 0mm x 0mm 800x600 60.0
If the screen resolution and refresh rate that you need are listed here, it might be a good idea to try changing the screen mode using the standard tools for your desktop environment or the specific tools for your graphics card driver.
If your desired resolution is not displayed, you can add it to the system using XRandR. First generate a modeline for your screen setup using the cvt command. For example, if you need a screen mode of 1280x1024 at 60Hz, type:
cvt 1280 1024 60
The output should look something like this:
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
Add this mode to the system using XRandR
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
I got the technical information I needed by copying and pasting everything after the word “Modeline” from the output of cvt. Now type “xrandr” again to make sure that the new mode has been added to the system. You should see it listed along with the other modes. Note that the string “1280x1024_60.00" in that example is simply the name of the mode, the actual numbers in the name are irrelevant. Once the mode has been created, attach it to a display output using the following.
xrandr --addmode default 1280x1024_60.00
On my setup, the display output is called “default”, as revealed by the second line of the output of the xrandr command with no parameters. Now try changing to the new screen mode.
xrandr --output default --mode 1280x1024_60.00
If this works, you're ready to make the change permanent. You can do this by editing the xorg.conf file or adding a command sequence to a startup file.
Basically, you add the modeline to the “Monitor” section of your xorg.conf file and the mode itself to the “Display” subsection within the “Screen” main section, adding to or replacing what's already there.
So, in keeping with the above examples, the Monitor section should look something like this:
Section "Monitor"
Identifier "default"
Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
Option "PreferredMode" "1280x1024_60.00"
EndSection
and the Screen section something like:
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Modes “1280x1024_60.00”
Depth 24
EndSubSection
EndSectionReboot and see if you have a working display.
Another way of doing this is to add the command sequence that you've already used to your login manager. This is a last resort if other means simply refuse to work, but it works pretty well. In the case of KDM, the KDE4 login manager, you should be able to edit the startup script by typing
sudo kwrite /etc/kde4/kdm/Xsetup
The equivalent GDM (Gnome) file is “/etc/gdm/Init/Default”. Using the setup above as example, simply cut and paste the following lines to this file.
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync xrandr --addmode default 1280x1024_60.00 xrandr --output default --mode 1280x1024_60.00
There you have it, a rather guerrilla method of forcing the screen to do what you want.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- New Products
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- seo services in india
4 hours 26 min ago - For KDE install kio-mtp
4 hours 27 min ago - Evernote is much more...
6 hours 27 min ago - Reply to comment | Linux Journal
15 hours 12 min ago - Dynamic DNS
15 hours 46 min ago - Reply to comment | Linux Journal
16 hours 45 min ago - Reply to comment | Linux Journal
17 hours 35 min ago - Not free anymore
21 hours 37 min ago - Great
1 day 1 hour ago - Reply to comment | Linux Journal
1 day 1 hour ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
ubuntu scr res
My computer claims to have 1280x1024 screen, ubuntu allows for that size, but refuses to believe the computer.
So I added xforce vga=771 to the boot and that seems to work well enough.
g
Crude, thought we were past that!
I recall having to do this sort of nonsense back over 12 years ago using Slackware. I've been running Mandriva for almost 8 years now and this type of screen setup is unheard of! Just run XFdrake and the utility does all this for you, from the command line.
When I looked at Ubuntu, I could not understand all the excitment surrounding it. I found Ubuntu to be crude and lacking a *lot* of polish that I otherwise take for granted.
How to set max monitor resolution
Hi. I have tried to change desktop resolution for xubuntu virtual machine (running under xen), but encoutered following error
xrandr: screen cannot be larger than 800x600 (desired size 1024x768)How can I set up the resolution of virtual screen?
I have exactly the same
I have exactly the same issue. Using VirtualPC 2007.
There is a lot of information and much chat on how to make the changes mentioned above permanent etc, but nowhere can I find information on what to do if the above steps dont work! I too get the error: "screen cannot be larger than 800x600 (desired size 1024x768 )"
Seems logical that Additions for Virtual PC would sort it but I can't find an ubuntu version so dead end has been reached :¬(
Anyone..?
Not sure this will work for me
On my system-- a laptop with nvidia graphics-- there is almost nothing in the xorg.conf:
I'm not worried about setting the resolution of my primary display (the laptop screen)-- but I find that for about half the projectors I try, the laptop does not successfully read their edid, so I'm left with 640x480.
I usually set them up using TwinView, with the projector echoing the upper left corner of my screen.
Given the paucity of information in my xorg.conf and my desire to change the resolution of an external screen, can you provide guidance on how I would modify the instructions above to successfully reach, say, a 1280x1024 resolution on a projector that isn't behaving well (i.e., not broadcasting an edid correctly)?
nvidia-settings
Does the nvidia-settings command work? If not, nvidia-settings can generate a fresh xorg.conf file, that might be more complete.
If you can't get that to work and the xrandr command does allow you to manually set the screen mode you want, it might be worth adding the command sequence to the startup script of your login manager as described. Try it, would be my advice.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.
A good thing about using
A good thing about using Xrandr is that you can always try it to see if it works from the command line without editing any files.
HELP
Greetings from Venezuela, I got this problem with my video card Drivers, my card It's a Nvidia GeForce 6200, using Ubuntu 10.04, my monitor It's a Samsung 19" widescreen.
The resolution 1440x900 doesn't get it from the drivers... Did search the Nvidia page, got the driver but nothing...
This metod that you mention here would work to force that resolution???
Thanx in advance for the attention and congratulation for the blog, had learn a lot with all of you.
I had similar problems with
I had similar problems with my Samsung monitors. I had 2 connected to an ATI card. The one connected to the DVI port set is resolution correctly. The one connected to the VGA port wouldn't. I checked the X log and the monitor was reporting the wrong resolutions when connected via the VGA cable, but not the DVI cable. In the end I got an HDMI to DVI cable and connected the second monitor to that. Then both monitors worked correctly.
Try it
A good thing about using Xrandr is that you can always try it to see if it works from the command line without editing any files.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.
Excellent! Just what i was
Excellent!
Just what i was looking for.
Debian Lenny with an ati card and the proprietary drivers set don't get the full resolution of my LCD.
01010010 01010100 01000110 01001101 00100001