Get more characters onto your Debian Squeeze text mode console

Improved utilization of terminal with Grub 2 + Debian 6 by increasing the screen resolution at boot

In the name of “Keep it simple, stupid!”I don’t install the X Windowing system onto my Debian Lenny and Squeezeservers. (And hence no Gnome, no KDE.) What I do change is the screen resolution from the default 640×480 to 1024×768, which any modern monitor can support. This has several advantages:

  • The boot sequence and commands like ls -l will show 56% more lines: 30 vs. 47
  • Commands like ps aux won’t wrap as frequently
  • The huge fonts in text-mode 640×480 are just plain ugly
  • Increases the overall number of characters displayed on a single screen by ~2.5x

Step one: Set the resolution for Grub 2. Edit /etc/defaults/grub with your favorite editor. Uncomment the GRUB_GFXMODE line and change the value to 1024x768.

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1024x768

Step two: Have the resolution passed to the kernel when it is loaded. Find the below block around line 126 in /etc/grub.d/00_header and add the set gfxpayload=keepline. I’ve also commented the edit, but that is optional. 

if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
  set gfxmode=${GRUB_GFXMODE}
  #keep the gfx mode set in grub (stu)
  set gfxpayload=keep
  load_video
  insmod gfxterm
fi

Step three: Generate a grub2 config file based on the template edits above.

root@zimbali:~# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
done

And that’s it! On the next boot the resolution will be greater and the text terminal will display many more characters.