Setting the resolution of the VGA console in Debian and Ubuntu

06 Jun 2011

If you’ve ever had to use certain Debian-based Linux distributions within a Virtualbox instance, you are probably familiar with the maddeningly slow and tiny VGA framebuffer console that they inflict upon you. (The 10.04 LTS release of Ubuntu is the specific perpetrator that prompted this post.)

Well, here’s the solution for you. This will make your Virtualbox instance much faster and give you control over its console resolution.

Note: all of this must be done as root (inside the VirtualBox instance), of course.

Step 1: Blacklist the VGA16 framebuffer

In the file /etc/modprobe.d/blacklist-framebuffer.conf, add a line that reads blacklist vga16fb.

Also, comment out the line that reads blacklist vesafb. In other words, put a “#” (hashmark, pound sign, octothorpe, whatever you want to call it) at the beginning of that line.

Step 2: Put your desired resolution in grub’s configuration file

In the file /etc/default/grub, there should be a line that by default reads GRUB_GFXMODE=640x480. Change that 640x480 to whatever resolution floats your boat and you know works on your monitor. (I like 1024x768 personally.) I would also suggest removing the word “quiet” from the GRUB_CMDLINE_LINUX_DEFAULT line (just leave the quotes empty) but that’s up to you. I like to see the messages scrolling by.

Step 3: Hack the grub scripts to make it set the resolution you want

In the file /etc/grub.d/00_header, search for the line which reads set gfxmode=${GRUB_GFXMODE}. Add a line below this which reads set gfxpayload=keep.

Step 4: Run update-grub

Run update-grub so that everything gets updated and grub actually reads your changes at the next boot.

You’re done.

You should now have a fast, high-resolution console. Congratulations.

Software referenced in this post: