A straightforward way to set your linux VGA modes, screen resolution and color depth for most Live Linux distributions is by using the vga= parameter boot option. For instance, at boot, you might type: vga=795. This command sets your Linux system to boot with a screen resolution of 1280x1024 at 24-bit color depth.
Below are some additional common VGA boot values related to color 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: The above method is considered the "Old School" way of setting screen resolutions. Modern Linux systems with GRUB (GRand Unified Bootloader) offer more advanced methods.
Setting GRUB VGA Modes and Resolution
In recent GRUB configurations, screen resolution and color depth can be set by modifying the grub.cfg file. This file controls the boot process and allows you to specify the desired graphics mode directly.
Here’s how to set the graphics mode in GRUB:
- Open the grub.cfg file in a text editor with root or superuser privileges. This file is usually located in the /boot/grub/ directory. Use the following command to edit it:
sudo nano /boot/grub/grub.cfg
- Locate the section that begins with set gfxmode. If this section does not exist, you can add it. The syntax for this command is width x height x depth, where color depth is optional. For example, to set the graphics mode to 640x480 at 24-bit color, you would enter:
set gfxmode=640x480x24
- After making your changes, save the file and exit the text editor.
- Finally, update GRUB to apply your changes using the following command:
sudo update-grub
Setting GRUB to Autodetect Screen Resolutions
During step 2 above, you can specify multiple screen resolutions separated by commas. GRUB will then attempt to autodetect and use the best resolution supported by your hardware. This is particularly useful when booting from a Linux Live USB on different systems, where hardware configurations may vary.
To set GRUB to automatically find the best working resolution, you can include auto in your list of resolutions. GRUB will try each specified resolution in order and fallback to auto-detection if none are suitable. Here’s an example:
set gfxmode=1920x1080,1024x768x32,auto
In this example, GRUB will first attempt to use a resolution of 1920x1080. If that fails, it will try 1024x768 with 32-bit color depth, and if that also fails, it will continue to auto-detect the next available resolution.
Preserving Graphics Mode Across Boot
To ensure that the graphics mode set during the boot process is maintained when the Linux kernel loads, you can use the GFXPAYLOAD setting. Adding set gfxpayload=keep to your grub.cfg file ensures that the selected resolution is preserved throughout the boot process:
set gfxpayload=keep
This command is particularly useful for systems where maintaining a consistent graphics mode is critical for user experience or specific applications.
By understanding and utilizing these GRUB configuration options, you can customize your Linux system's boot process to ensure optimal display settings on any hardware.