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
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.
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
Re: HOWTO: Change bootup resolution
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.
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.
Re: HOWTO: Change bootup resolution
Nice info, but I am trying to figure out for the default login screen.
Re: HOWTO: Change bootup resolution
Sorry, re-read the thread and saw anything other than what's in the table is not supported.
What do I need to use if I'm trying to achieve 1900 x 1200 at 24 or 32 bit?
Re: HOWTO: Change bootup resolution
Quote:
Originally Posted by
meimato
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.
I've only just found the feature, and yes, the boot screen is not centred. Anyone know how to fix this? BTW,tty1-6 is awesome at high res, thanks for the pointer!
Re: HOWTO: Change bootup resolution
If only 1280x800 was supported...