Enable framebuffer on Ubuntu Karmic Koala using grub2

How to set up framebuffer support in grub2 on Ubuntu Karmic Koala so your console screen resolution is configurable.

I usually develop and test my webpages on various VirtualBox virtual machines and since I work a lot in the console I use a framebuffer which enables larger resolutions than the default console.

Until now I was using Ubuntu 8.04 LTS virtual machines, but recently I upgraded to 9.10.

Ubuntu 9.10 (Karmic Koala) is using grub2 so the simple adding of vga=791 or similar value to boot options won’t work. Here’s how to enable the framebuffer on virtual consoles:

1. Enable kernel modules

$ sudo nano /etc/initramfs-tools/modules

Add two lines at the end of the file enabling two kernel modules:

vesafb
fbcon

Prevent blacklisting the vesafb module:

$ sudo nano /etc/modprobe.d/blacklist-framebuffer.conf

Look for the line blacklist vesafb and comment it out:

#blacklist vesafb

2. Modify grub configuration

$ sudo nano /etc/default/grub

Remove the comment from the GRUB_GFXMODE line and set the desired resolution:

GRUB_GFXMODE=1024x768

There’s no need to set bit depth, just the screen resolution. Then open the very first config file in /etc/grub.d

$ sudo nano /etc/grub.d/00_header

Look for the code set gfxmode=${GRUB_GFXMODE} and insert one line after it so the code looks like this:

if loadfont `make_system_path_relative_to_its_root $(){GRUB_FONT_PATH}` ; then
  set gfxmode=${GRUB_GFXMODE}
  set gfxpayload=keep
  insmod gfxterm
  insmod ${GRUB_VIDEO_BACKEND}

3. Update your boot configuration

$ sudo update-grub2
$ sudo update-initramfs -u

That’s it! Now reboot and watch your enhanced virtual console with the framebuffer.

Last updated on by Attila