Setting TTY / Virtual Consoles resolution with Grub 2 in Ubuntu Lucid Lynx

June 23rd, 2010 by rvdavid Leave a reply »

I’ve been using Ubuntu for a while now and something that bugged me a lot was the crappy screen resolution whenever I had to go and use my virtual terminals (TTY).

In previous versions of ubuntu which used grub 1, setting up the resolution for tty was done by simply using the vga=??? boot option. In grub 2 however, this is not so easy.

I remember when it first came out. I was somewhat exasperated by the fact that I had _just_ become comfortable f*cking with grub’s menu.lst and now I had to learn how to use grub 2 – which had some new convention for editing menu items let alone setting up the resolution.

Anyway, there’s really nothing to it. I had to do a lot of digging around and some experimentation, but in the end, as with all things linux it was “easy” when I finally found out how.

Step 1: Open up your the grub header file stored in /etc/grub.d/00_header

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

Step 2: Add a command inside the block of string with script that sets the gfxmode. Acceptable Set the gfxpayload parameter to the resolution you want to use for your virtual terminals / TTY.

SO for me, lines 101 – 113 of the 00_header file in /etc/grub.d looks like this

101 cat << EOF
102 if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
103 set gfxmode=${GRUB_GFXMODE}
104 insmod gfxterm
105 insmod ${GRUB_VIDEO_BACKEND}
106 if terminal_output gfxterm ; then true ; else
107 # For backward compatibility with versions of terminal.mod that don't
108 # understand terminal_output
109 terminal gfxterm
110 fi
111 #set gfx payload - use your own resolution here. I have a 19 inch monitor which natively supports 1440x900
112 set gfxpayload=1440x900x32
113 EOF

Step 3: After you save the file, go back to the terminal and run update-grub2 as root.


$ sudo update-grub2

Your terminal should look like this:

$ sudo update-grub2
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-23-generic
Found initrd image: /boot/initrd.img-2.6.32-23-generic
Found memtest86+ image: /boot/memtest86+.bin
done

And that’s it. On your next boot, you should see your console displayed in the resolution you used for setting gfxpayload.

if you enjoyed this post, make sure you subscribe to my RSS feed!
You can also follow me on Twitter here.

Related posts:

  1. Setting up Ubuntu on my new 19 inch LG S900-U.CPS1A Notebook/Work Rig!
  2. How to get the use of your number pad back in Ubuntu
Advertisement

4 comments

  1. Lorentz says:

    Not sure if it’s the same on Ubuntu, but I just upgraded from Debian Lenny (stable) to Squeeze (testing) and found it also uses grub2. I set the resolution up by changing /etc/default/grub, at the param called GRUB_GFXMODE. Then I do the usual update-grub2, and presto, done. Same deal for passing vga= value to the kernel; change the param GRUB_CMDLINE_LINUX_DEFAULT.

    Perhaps grub2 is more reliant on /etc/default configuration style, unlike what how used to be with its own menu.lst.

    • rvdavid says:

      Tried all that before hand, but the only thing that worked was setting gfxpayload. I don’t see my problem as a common thing out there at the time I was looking for answers, so maybe it’s because of the res/native res I got on my beast.

      BTW The VGA param is deprecated in grub2 so I can’t use that.

      and yeah, grub2 configuration is very different to hacking away at good ole menu.lst

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.