Linux VGA Modes Set Screen Resolution at Boot

A simple way to set your screen resolution and color depth for most Live Linux distributions is via the use of the vga=parameter boot option. For example at boot you might type: vga=795. This would set your Linux system to boot with a screen resolution to 24bit 1280X1024.

Here are some more examples of common VGA boot values, related to depth and screen resolution;

Linux VGA Modes Resolution and Color Depth Chart

Color Depth 800x600 1024x768 1152x864 1280x1024 1600x1200
8 bit vga=771 vga=773 vga=353 vga=775 vga=796
16 bit vga=788 vga=791 vga=355 vga=794 vga=798
24 bit vga=789 vga=792 vga=795 vga=799

Note: That's the Old School method...
Here's How To Set Grub VGA Modes and Resolution nowadays.

How to set gfxmode for GRUB to use at Boot

With recent GRUB configurations, modes can be set by simply adding the resolution and color depth to your grub.cfg file. For example, to set the graphics mode in the GRUB (GRand Unified Bootloader) configuration (grub.cfg), you can add or modify the gfxmode entry. Here's an example of how you might set the graphics mode to 640x480:

  1. Open the grub.cfg file in a text editor with root or superuser privileges.
    The location of grub.cfg can vary, but is commonly found in the /boot/grub/ directory:

    sudo nano /boot/grub/grub.cfg
  2. Look for a section that begins with set gfxmode if it doesn't exist, add it.
    Syntax is width x height x depth. Note that color depth is optional:

    set gfxmode=640x480x24
  3. Save your changes and exit the nano text editor.
  4. Finally, update GRUB to apply your3 changes:
    sudo update-grub

Set GRUB VGA Modes to Autodetect Screen Resolutions

During step 2 above, multiple screen resolutions can also be provided using a comma for separation. Then, during boot GRUB will autodetect which modes will work best with the hardware on the system it is booting from. This allows support for multiple resolution + color depth options for varying systems. Which is exactly what you want when running from a Linux Live USB.

You can use auto to try the next available screen resolution until one is found that works for the particular hardware that your USB drive is being booted from. See the example below;

set GFXMODE=1920x1080,1024x768x32,auto

Setting GFXPAYLOAD=keep in GRUB is used to preserve the graphics mode chosen by the bootloader for passing to the kernel. To allow the kernel to keep the same graphics mode that was used during the boot process, add the following line:

set GFXPAYLOAD=keep

In the example above, a GRUB boot will first attempt to use a 1920x1080 resolution. If that fails, it will move to 1024x768x32. And if that fails, it will automatically continue to try the next available resolution, until a working resolution for the hardware it is booting from is found.

Note that set GFXPAYLOAD=keep will preserve the detected GFXMODE.