52

I did a fresh install of Ubuntu 11.04 on a HP 550 Notebook. But grub2 isn't really fit in the best screen resolution that this Notebook can support (1280x800).

How can I do this without using a third party application ?

65

To do this safely requires two steps.

Step 1: find the preferred mode

Reboot and press and hold Shift to display your grub. Press C to enter console mode. Then type (for Ubuntu versions before 18.04):

$ vbeinfo

For Ubuntu 18.04 and later:

$ videoinfo

This will display various stuff how grub recognizes your display. At the bottom is "preferred mode" - in your case it should say 1280x800. Note down the value.

Note: sometimes, some buggy video cards incorrectly give Grub the wrong preferred resolution - if the preferred mode is much higher than you were expecting, then select the nearest mode in the list displayed that you were expecting.

Press Esc to return to grub and press Enter to boot.

Step 2: Setting the resolution in grub

Reach for your terminal and type

$ sudo nano /etc/default/grub

find the line

#GRUB_GFXMODE=640x480

remove the # and change 640x480 with the preferred mode you wrote down. E.g.:

GRUB_GFXMODE=1280x800

save, then type

$ sudo update-grub

Note: the preferred mode has to be among those listed by vbeinfo. For example, if your preferred mode is 1920x1080 (a common 16x9 aspect ratio setting), your preferred mode is NOT supported by vbeinfo and may not work correctly. In fact, there do not seem to be any 16x9 modes supported by vbeinfo, as of Ubuntu 13.04. In that case you could try falling back to something common like 640x480, which, it seems most monitors support and vbeinfo supports. Also, not all the modes supported by vbeinfo are necessarily supported by your monitor and you may have to experiment.

  • @fossfreedom: I dont see anything when the grub is shown, my screen says "Out of range signal". Thus I cannot see the output of vbeinfo. How do I rectify in that case ? – Rajat Gupta Jan 3 '14 at 21:38
  • @user01 - you'll need to first boot into ubuntu - set the GRUB_GFXMODE in grub to something low like 640x480. Then the next reboot you'll have grub and you can then see the output of vbeinfo – fossfreedom Jan 3 '14 at 21:42
  • 4
    You can use sudo hwinfo --framebuffer shows the same information as vbeinfo. – Chris K Jan 12 '14 at 1:48
  • 3
    While running 16.0.4 I noticed that the resolution kept getting reset after the kernel started. I had to add: GRUB_GFXPAYLOAD="keep" and GRUB_CMDLINE_LINUX="nomodeset" to make it stick. – JD Frias Nov 30 '16 at 20:41
  • 1
    That fixed grub, but to fix the TTY console resolution I needed to sudo dpkg-reconfigure console-setup and selected terminus 16x32 for the font. (Note that nomodeset caused a worse problem. Other details: Ubuntu 18.04, Dell XPS 15, 3840 x 2160). – robocat Dec 6 '18 at 4:22
21

I'm using Ubuntu 16.04 and things are a little different in the packaged version of Grub for me.

The vbeinfo command does not exist.

  1. Turn on
  2. At the grub menu press c to get the grub comand line
  3. Type videoinfo
    This lists all the modes - it is the <width>x<height> you need to make note of.
  4. Optionally, there is a videotest command which you can use to test a given resolution, e.g. videotest 1280x1024. However, while this test worked for me, I could not then get back to the grub menu! So that's not quite as useful (unless anyone can explain how to escape the test.)
  5. Boot up fully and edit (sudo) /etc/default/grub but the line you're looking for is now called GRUB_GFXMODE. So un-comment and set that to your desired mode.
  6. Run update-grub and reboot.
  • 1
    For me with 16.04, typing videoinfo at the grub command-line resulted in an error like "Secure Boot forbids loading module...". So then I disabled Secure Boot in the BIOS settings and then a more reasonable screen resolution appeared in the grub menu without me having to do anything else. Maybe the Secure Boot option was stopping grub's default auto value for GRUB_GFXMODE from taking effect. – snark Sep 15 '17 at 17:18
  • It's kind of nuts that we need to reboot in order to find out the supported frame rate buffer of our video card... there must be a simpler way! – GrayedFox May 9 '18 at 12:06
  • 1
    Commadn vbeinfo is now videoinfo in Ubuntu 18.04 – Stéphane V May 23 '18 at 8:54
  • 'hwinfo --framebuffer' at bash command line is supposed to be the same thing as 'vbeinfo' or 'videoinfo', but it doesn't work for me. (I get one line after another output to screen, but every line overwrites the previous, and the last line is erased by bash prompt. Redirecting output to file yields an empty file.) – Mark J. Bobak Nov 24 '18 at 12:11
5

I am running 14.04LTS on an ASUS M51AC with an Nvidia 625GT OEM. I found that in addition to the accepted answer, I needed to also add the line:

GRUB_GFXPAYLOAD="keep"

to /etc/default/grub.

3

Grub Customizer:

Easy to use Grub2 settings customizer. Go to "Preferences" -> "Appearance"

  • check "custom resolution" and select one of the available resolution
  • click "close"
  • hit "save"
  • close program and restart computer

enter image description here

  • 1
    i've found this method to be unreliable, my menu colors never update and the resolution list is not valid in all cases. luckily nothing breaks when choosing an unsupported resolution, it just doesn't change anything – Dirk Hartzer Waldeck Jul 22 '11 at 7:44
  • 1
    I used to have the same issue where no visual settings applied would take hold... under the "Advanced" tab in "Preference" make sure "GRUB_GFXMODE" is checked and when using a background picture make sure it is in the same "/boot" folder as the grub installation. Now all options w/in the program works perfectly for me w/ no issues at all. – 13east Jul 22 '11 at 14:51
2

For me on Ubuntu 17.10 server it was

GRUB_GFXPAYLOAD_LINUX="keep"
GRUB_GFXMODE="1920x1080x32"

I also had to set the following to prevent shutdown from hanging

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.