June 10, 2008

How-To: Change Console Resolution

The standard size of the console is 80 columns and 25 lines, which is too big if you want to work easily in console and don't even use a desktop environment (or use one but also prefer to do things in console rather than an X terminal). It will also look nicer when booting up the system.

To change the resolution and colour depth of the console you need to edit the /boot/grub/menu.lst file and add one parameter to the line containing the kernel to boot. On a Debian Lenny system, this should look something like:

title Debian GNU/Linux, kernel 2.6.24-1-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-1-686 root=/dev/hda1 ro quiet vga=791
initrd /boot/initrd.img-2.6.24-1-686

The new parameter added is vga=791, which means a resolution of 1024x768 with a colour depth of 16 bits per pixel (65,536 colours). Some other VGA modes would be:

791 - 1024x768, 16 bit
792 - 1024x768, 24 bit
794 - 1280x1024, 16 bit
795 - 1280x1024, 24 bit

After you restart the system and boot in console mode (if a graphical desktop environment is loaded, just press CTRL+ALT+F1 to go into console mode, and CTRL+ALT+F7 to go back), you'll notice the resolution is now changed, and you can see more now than the standard 80 columns and 25 lines.

Updated: June 10, 2008 (Created: June 10, 2008)

3 comments:

Mohamed Hammad said...

The tips works great, however it introduces a problem for me which I'm unable to determain how to fix it. Once you log in to console, and you're happy with the resolution, you startx or you have gdm setup to start with X11. You use alt+ctrl+f1 or alt+ctrl+f2 and you can no longer read what's in front of you because the color changed to something very dark. What is the problem? And how to fix it? Any tips?

dozykraut said...

You wrote: "CTRL+ALT+F1 to go into console mode, and CTRL+ALT+F7 to go back"

You did mean to write "ALT+F7 to go back", didn't you?

Unknown said...

WARNING! These VGA modes you list (like 791) are video-card specific. I beautifully borked my installation by following this post blindly, and was rewarded with weird green squares on my screen.

The safe way to figure this out is to change the above to say "vga=ask". Then on boot grub will give you the option of looking at a menu of video modes your card supports, so that you can choose the right one (in my case, 317) to set permanently.