Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old September 16th, 2006   #1
Indras
A Carafe of Ubuntu
 
Join Date: Jun 2006
Location: Michigan, US
Beans: 119
Ubuntu 6.06
HOWTO: Change bootup and console resolution

I've seen a few questions about this on the forums, so I've decided to write a full-fledged tutorial on how to set this up in Ubuntu. This will show you how to change your screen's resolution while booting, during usplash, and at any time one one of the text consoles (by pressing CTRL+ALT+F1 through F6). I'll try to make this as friendly as possible for newbies, and I'll make sure to explain all acronyms and abbreviations at least once.

Explanation: (feel free to skip this section, it is only for educational purposes)

Your computer system boots up in multiple stages, each one using the video card and monitor in its own way. This is important to know when tracking down resolution problems.

First, your computer's BIOS (Basic Input-Output System) detects and powers up your video card during POST (the Power On Self Test) and uses it to display all of its relevant information, such as the memory check, a list of devices, and so on. Some motherboards will simply display a full-screen logo, particularly branded PCs, like Hewlett Packard and Compaq. You may have to press the spacebar or escape key to see what's going on behind the logo. Each PC is different, so consult your vendor's support site, your computer's manual, or, if all else fails, google.com.

The BIOS generally chooses a generic resolution that will work on nearly any video card and monitor, like 640x480x8, so as to not have an error message that the user is unable to read. I've only seen a couple computers where this resolution could be configured, as it's not a high priority option.

Then, your bootloader starts, using the resolution already in place. This may be ntldr, on Windows NT/2000/XP systems, darwin on macintosh systems, or Lilo/Grub on Linux systems. Ubuntu Dapper defaults with a basic plaintext grub. See the gfxboot grub tutorial here on ubuntuforums if you'd like to use the graphical grub that Suse has: http://www.ubuntuforums.org/showthread.php?t=208855 However, I'm going to assume you're using default options from here on.

After you choose your operating system and kernel in grub, or it automatically defaults to the first option if you do not press a key during the 3 second countdown, it fires up the kernel and passes it bootup parameters. There are many different parameters you can send to the kernel before bootup, such as 'single', for single-user mode.

The kernel uses it's own video card driver. In Ubuntu, it uses the basic vesafb driver, short for vesa framebuffer. This is a simple, generic, non-accelerated driver, which is optimal for compatibility. Once again, the point is to never have something bad happen and an error message displayed on the screen that the user cannot see. There are still users out there whose monitors cannot display above 800x600, and if your kernel tried to run the vesafb at a resolution higher than this, those users would be alienated.

If grub does not pass a vga parameter to the kernel, it assumes vga=normal, which is 640x480 resolution. From then on, everything running will be at that basic vga resolution, except for the xserver. First, your usplash screen displays, while all other services are starting. This is the screen with an orange Ubuntu logo at the top of the screen and a list of processes starting up in the bottom half. There's also a howto on the forums for changing the colors of the usplash screen, located here: http://www.ubuntuforums.org/showthread.php?t=82835.

Near the end of the bootup sequence, it starts up six consoles, using the getty program, and then the xserver. The first six consoles can be accessed any time by pressing CTRL+ALT+F(x) where x is the number of the console. The xserver then binds itself to F7, the next available number. Try it now if you feel like, by holding CTRL and ALT and go through F1 through F7.

The consoles always use the vesafb driver to display, so they are at the same resolution that was passed to your kernel from grub. The xserver uses its own driver and resolution, defined by /etc/X11/xorg.conf, and then Gnome, KDE, or XFCE run on top of it. I won't go into detail here on how they work.

End explanation section

Okay, if you jumped ahead, here's where you should start paying attention. First, I'm going to give you the vesafb modes table. This was taken from http://www.tldp.org/HOWTO/Framebuffer-HOWTO-5.html, so feel free to go there for more information.

The Table
HTML Code:
Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
--------+--------------------------------------------------------------
 4 bits |    ?       ?     0x302      ?        ?        ?         ?
 8 bits |  0x300   0x301   0x303    0x305    0x161    0x307     0x31C
15 bits |    ?     0x310   0x313    0x316    0x162    0x319     0x31D
16 bits |    ?     0x311   0x314    0x317    0x163    0x31A     0x31E
24 bits |    ?     0x312   0x315    0x318      ?      0x31B     0x31F
32 bits |    ?       ?       ?        ?      0x164      ?

(I apologize for the way this table looks, it's the only way I could get the columns to line up)

So first, choose which resolution you'd like to run your consoles and usplash in from the chart above.

Now, open your menu.lst file:
Code:
sudo nano /boot/grub/menu.lst
And find the entry you normally use to boot with and go to the line that begins with "kernel", it should say something like this:
Code:
kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/hda5 ro quiet splash
Add a "vga=" option to the end of the line, and put in the code from the table above. So if you want 1024x768 at 16 bit color at command line, add "vga=0x317" to the end of your kernel parameters. This is the option I like to use most. You also can use the decimal equivalent, since 0x317 is in hex. The decimal equivalent is 791, so you'd use "vga=791" instead.

Now, save the file, and it will take effect when you restart.

Note: Normally, when you upgrade your kernel or run grub-reconfigure, it will remove this option and set it back to defaults. In order to make this change permanent, go up a couple lines to one that looks like this:
Code:
# defoptions=quiet splash
(yes, it's commented out, but grub-reconfigure looks for this (and other) commented-out options when rebuilding your grub menu)

And add the same vga= option to the end of that as well, and it will make this new resolution permanent, even after new kernels are installed.

Another ubuntuforums member, Herman, made a very important suggestion: you can make modifications to your grub boot sequence for a single boot by editing grub before you boot. Since it does not alter Grub's menu.lst file, the change isn't permanent. When grub first boots up, at the GUI menu, select an option you want to modify and press the 'e' key. This will bring up the full list of commands from the menu.lst file that grub uses to boot that particular option. From there, you can go to your kernel line and add the vga option there, just like in my instructions above, and it will boot Ubuntu a single time with a different vesafb resolution.

As a bonus, here's some extra tidbits, some of it useless knowledge, for your perusal:
  • For the mathematically challenged, there is a hex to decimal converter in Ubuntu. Go to Applications->Accessories->Calculator. From there, go to View->Scientific. Right under the display screen is a button for Hex. Press it and type the code from the table above (like 31C) and press the Dec button.
  • When booting from the LiveCD, you can change this option as well, but you have to do it while still at the graphical grub menu. When the CD boots and shows the Ubuntu logo with a 30 second timeout, press the escape key. A box will come up warning you about going to the text-based grub interface. Just press enter. This will drop you to a boot: prompt. Type "live vga=791", or whatever your desired resolution is, and then the liveCD will boot its kernel at this resolution. Note that this is temporary for one boot only.
  • You can set "vga=ask" in your menu.lst file to force the kernel to ask you what resolution you prefer each time, but you will choose from a rather small list of options. You can type "scan" to have it check your hardware to see which modes it is capable of, but this is mainly for compatibility issues, and it won't give you as complete of a list as above, and you cannot type in 791, or 0x317 here, only a number from 0 to 9 from the list it gives you.
If you see any incorrect information here in this tutorial, or you have something notable to add, please reply below and I'll try my best to make the changes in good time. I do my best to visit the forums daily, so hopefully I'll catch it quickly.

Also, if you're looking for some very well written, illustrated information on using grub to its fullest, please visit Herman's website on grub here: http://users.bigpond.net.au/hermanzone/p15.htm

Last edited by Indras; September 17th, 2006 at 07:43 AM..
Indras is offline   Reply With Quote
Old September 21st, 2006   #2
Indras
A Carafe of Ubuntu
 
Join Date: Jun 2006
Location: Michigan, US
Beans: 119
Ubuntu 6.06
Re: HOWTO: Change bootup and console resolution

Just a quick little update... here's the full table in easy to read (and easy to remember) decimal format.

HTML Code:
Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
--------+--------------------------------------------------------------
 4 bits |    ?       ?      770       ?        ?        ?         ?
 8 bits |   768     769     771      773      353      775       796 
15 bits |    ?      784     787      790      354      793       797 
16 bits |    ?      758     788      791      355      794       798 
24 bits |    ?      786     789      792       ?       795       799 
32 bits |    ?       ?       ?        ?       356       ?


I've also seen questions from people wanting widescreen resolutions. I'm sorry, but it seems that vesafb doesn't support any resolution not in the table above.
Indras is offline   Reply With Quote
Old September 25th, 2006   #3
ethan@xmlstandards.org
5 Cups of Ubuntu
 
Join Date: Mar 2006
Location: London
Beans: 27
Ubuntu 6.06 Dapper
Send a message via MSN to ethan@xmlstandards.org
Re: HOWTO: Change bootup resolution

Thanks so much for this post.

I have used all of the features you mentioned to great benefit.

Much appreciated.

Ethan Cane
Web Developer
ethan@xmlstandards.org is offline   Reply With Quote
Old September 29th, 2006   #4
pejcao
First Cup of Ubuntu
 
Join Date: Sep 2005
Beans: 7
Re: HOWTO: Change bootup resolution

same 4 edgy?
pejcao is offline   Reply With Quote
Old October 18th, 2006   #5
DonnieP
A Carafe of Ubuntu
 
DonnieP's Avatar
 
Join Date: Oct 2006
Location: Richmond, VA USA
Beans: 119
Ubuntu 9.04 Jaunty Jackalope
Re: HOWTO: Change bootup resolution

This works for me in edgy, but just a note that the 1152x864 resolution doesn't seem to be recognized. It gives an error message and presents the limited 1-9 menu listed in the explanation above.
DonnieP is offline   Reply With Quote
Old October 31st, 2006   #6
meimato
Just Give Me the Beans!
 
Join Date: Nov 2004
Beans: 53
Re: HOWTO: Change bootup resolution

I've always used this nice feature, but now in Edgy it doesn't seem to work: the boot screen appears not centered on the screen, but rather in the top left corner.
meimato is offline   Reply With Quote
Old May 2nd, 2007   #7
vstoykov
First Cup of Ubuntu
 
Join Date: May 2007
Beans: 1
Send a message via ICQ to vstoykov
Re: HOWTO: Change bootup and console resolution

Quote:
Originally Posted by Indras View Post
Just a quick little update... here's the full table in easy to read (and easy to remember) decimal format.

HTML Code:
Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
--------+--------------------------------------------------------------
 4 bits |    ?       ?      770       ?        ?        ?         ?
 8 bits |   768     769     771      773      353      775       796 
15 bits |    ?      784     787      790      354      793       797 
16 bits |    ?      758     788      791      355      794       798 
24 bits |    ?      786     789      792       ?       795       799 
32 bits |    ?       ?       ?        ?       356       ?


I've also seen questions from people wanting widescreen resolutions. I'm sorry, but it seems that vesafb doesn't support any resolution not in the table above.

There is a error. Mode 640x480@16b is 785.

This is script to convert table (only nubmers):

HTML Code:
#!/bin/bash 

while read LN ; do
NEWLN=`echo $LN | sed s/?/0/`
for NUMB in $NEWLN ; do
let x=0 ; let x=$NUMB 2>/dev/null
echo -ne "\t$x"
done

echo -ne "\n"

done


Usage example:
HTML Code:
valentin@darkstar:~/lab$ cat tbl1
Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
--------+--------------------------------------------------------------
 4 bits |    ?       ?     0x302      ?        ?        ?         ?
 8 bits |  0x300   0x301   0x303    0x305    0x161    0x307     0x31C
15 bits |    ?     0x310   0x313    0x316    0x162    0x319     0x31D
16 bits |    ?     0x311   0x314    0x317    0x163    0x31A     0x31E
24 bits |    ?     0x312   0x315    0x318      ?      0x31B     0x31F
32 bits |    ?       ?       ?        ?      0x164      ?         ?

valentin@darkstar:~/lab$ cat tbl1  | convert_hex_table_to_dec.bash
        0       0       0       0       0       0       0       0
        0
        4       0       0       0       0       770     0       0       0       0
        8       0       0       768     769     771     773     353     775     796
        15      0       0       0       784     787     790     354     793     797
        16      0       0       0       785     788     791     355     794     798
        24      0       0       0       786     789     792     0       795     799
        32      0       0       0       0       0       0       356     0       0

valentin@darkstar:~/lab$    

valentin@darkstar:~/lab$ cat tbl2
Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
 4bits      ?       ?     0x302      ?        ?        ?         ?
 8bits    0x300   0x301   0x303    0x305    0x161    0x307     0x31C
15bits      ?     0x310   0x313    0x316    0x162    0x319     0x31D
16bits      ?     0x311   0x314    0x317    0x163    0x31A     0x31E
24bits      ?     0x312   0x315    0x318      ?      0x31B     0x31F
32bits      ?       ?       ?        ?      0x164      ?         ?

valentin@darkstar:~/lab$ cat tbl2  | convert_hex_table_to_dec.bash
        0       0       0       0       0       0       0       0
        0       0       0       770     0       0       0       0
        0       768     769     771     773     353     775     796
        0       0       784     787     790     354     793     797
        0       0       785     788     791     355     794     798
        0       0       786     789     792     0       795     799
        0       0       0       0       0       356     0       0

valentin@darkstar:~/lab$     


The result is:
HTML Code:
 Colours  640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
 ----------------------------------------------------------------------
  4 bits     -       -      770       -        -        -         -
  8 bits    768     769     771      773      353      775       796
 15 bits     -      784     787      790      354      793       797
 16 bits     -      785     788      791      355      794       798
 24 bits     -      786     789      792       -       795       799
 32 bits     -       -       -        -       356       -         -
vstoykov is offline   Reply With Quote
Old April 13th, 2009   #8
juanmoreno92
Spilled the Beans
 
Join Date: Aug 2008
Beans: 13
Re: HOWTO: Change bootup resolution

In order to get a console in 1280x800 you need to append:
Code:
vga=865
to your kernel boot line.

Works for me. It is for 1280x80 at 32 bit. 24 bit is 864.
juanmoreno92 is offline   Reply With Quote
Old November 25th, 2006   #9
sniffass
5 Cups of Ubuntu
 
Join Date: Jan 2006
Beans: 36
Re: HOWTO: Change bootup resolution

hi this was a great and very very informative and well-written post. Thank you very much.
Now I just want to find out how to get coloured fonts in the console, so that files/folders appear differently. Like on the gentoo/knoppix live cds.
sniffass is offline   Reply With Quote
Old December 17th, 2006   #10
jdarias
A Carafe of Ubuntu
 
Join Date: Nov 2006
Beans: 93
Re: HOWTO: Change bootup resolution

About this subject i would like to ask,
Is it possible to set up a background image for the virtual consoles like SUSE does?

I mean, when i hit CTRL-ALT-F1 in suse, i get the console with a background image wich has the suse logo on top, and a sort of shading in it.
In ubuntu it's just black. Can it be changed?
jdarias is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:43 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry