91

grub2 isn't really fit in the best screen resolution that my laptop can support (1280 x 800).

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

Binarylife
  • 16,662

7 Answers7

109

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
  • 174,526
40

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.
artfulrobot
  • 8,733
9

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"
jmervine
  • 191
9

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.

4

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

13east
  • 1,945
0

For Ubuntu 20.04 LTS this worked for me (on ESXi VMs):

GRUB_CMDLINE_LINUX=""

make sure to remove maybe-ubiquity

#GRUB_TERMINAL=console

make sure to comment/disable this line.

GFX_GFXMODE=1024x768 
GFX_PAYLOAD_LINUX="keep"

change to desired resolution

0

Sorry to resurrect an old thread, but this comes up a lot when searching for Ubuntu console resolution or tty resolution.

Please ask yourself which of these things you are trying to achieve:

  1. The pixel resolution of the console / tty

or

  1. The size of the font on the console / tty

GRUB_CMDLINE_LINUX will sort out question 1. Note that anything with nomodeset will fix the resolution - make it unchangeable - even when you boot into the desktop. That is probably NOT what you want. It's an example of an answer being correct but the question being wrong.

However, if all you want is to increase/decrease the size of the font on the console - let's say you have a 2k monitor and the console font is teeny tiny - then we are talking about scenario 2.

In that case, from the command line:

sudo dpkg-reconfigure console-setup

This lets you select a character set (you almost certainly want UTF-8), a font and a font size. The font named "Terminal" has a good selection of sizes.

Also note that if you have a multi-monitor setup, and the console mirrored on each, then the number of rows and columns of your console will be determined by the smallest monitor. Larger monitors will NOT stretch the display, they'll just show it as a kind of cut-out in the top left.

Two hours of my life fiddling with grub, only to discover that what I wanted wasn't controlled by grub. You're welcome.