VGA Modes and GRUB
Hopefully your Linux kernel will detect the video hardware
and select a good video mode.
However, especially on virtualized platforms like Oracle VirtualBox, you may need to help it along.
The modern way to do this is through GRUB variables
Add something like the following to
to set the desired width×height×depth
[ ... lines deleted ... ] GRUB_GFXMODE=1024x768x32 GRUB_GFXPAYLOAD_LINUX=keep [ ... lines deleted ... ]
You can set multiple resolutions, including the default
auto,, using something like this:
[ ... lines deleted ... ] GRUB_GFXMODE=1920x1080x32,1024x768x32,auto GRUB_GFXPAYLOAD_LINUX=keep [ ... lines deleted ... ]
Then update the GRUB configuration.
The GRUB configuration file is in
on a system with the EFI firmware in BIOS legacy mode.
# grub2-mkconfig -o $(find /boot -name grub.cfg)
If the command is instead
with the configuration file in
on your distribution (e.g., Oracle, RHEL, CentOS, etc),
of course use that instead.
If you use command completion and file name completion
<Tab> key as you should,
this wouldn't be a problem and you might not even notice
But If That Doesn't Work...
You can add a
vga= directive to the
kernel line in the GRUB file, something like the
linuxefi /vmlinuz-X.Y.Z vga=792 root=UUID=77aa6e61-df08-4480-a3ae-73bf40116336 ro
You will, of course, see something specific in place of
X.Y.Z and you can use numbers other
That specific number yields 1024×768 with 65,536
See the table below for a variety of choices!
But first, some tips:
vga=XXXdirective can go anywhere on the line. I put it near the beginning in this example to make it easy to spot if you're viewing this page on a phone. But it will be easiest for you to add it to the end.
eat the GRUB menu and add an experimental string, then press
<Ctrl>-Xto boot. If you get an unwanted mode, or even a totally black screen, cycle the power and try again. Once you find a useful value, you can install it as explained below.
You might see
linuxefias in my example above, or
linux, depending on your platform. Leave that alone, you're simply looking for the line with some
vmlinuz-X.Y.Zkernel file name.
Available VGA Modes
|8 bits||256 colors||
|15 bits||32,768 colors||
|16 bits||65,536 colors||
|24 bits||16,777,216 colors||
Installing Your Configuration Change
Do not simply edit the
Changes to that file will be wiped out the next time you install a kernel update.
Edit the file
/etc/default/grub and look
for lines like this:
[ ... lines deleted ... ] GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX="" [ ... lines deleted ... ]
Insert your addition there. If there is only one such line, add it to that string. If there are two lines, add it to the non-empty string:
[ ... lines deleted ... ] GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vga=792" GRUB_CMDLINE_LINUX="" [ ... lines deleted ... ]
Now, regenerate the GRUB configuration file. This will insert your addition to every stanza or boot target.
# grub-mkconfig -o $(find /boot -name grub.cfg)
For example, on a UEFI/GPT/
the GRUB configuration file
might be under
On a BIOS/MBR/
the directory might be
The precise location depends on your distribution.
If you instead find a file named
then you're on a very old system with the legacy
GRUB 0.99 instead of GRUB 2.
Also, there may be a "2" in the command name:
What About The GRUB Menu Resolution?
Yes, there are three operating system environments on your way to what you really want to run:
- Firmware: With UEFI firmware, this can be fairly high resolution graphics. Then then firmware starts:
- GRUB boot loader: This gets whatever the UEFI has set up, although you can tell it to try a specific resolution. That's useful to change in a virtualized environment, where the boot loader is running within a window on a graphical desktop of a host OS. Then it loads and starts:
The above showed how to pass a video resolution
vga=792to the OS kernel as it's loaded.
To set the GRUB boot loader resolution:
look for a line setting
Add it if needed, or change what's there.
You could use double-quotes around the resolution
string but they aren't needed:
[ ... lines deleted ... ] GRUB_GRXMODE=1024x768 [ ... lines deleted ... ]
Then regenerate the GRUB configuration file.
# grub-mkconfig -o /boot/grub/grub.cfg
To the Linux / Unix Page