Published on

Fix Resolution on Linux with Xrandr and GRUB

Authors
  • avatar
    Name
    Ailton Baúque (vybraan)
    Twitter
    @vybraan

When you're running linux on old hardware, sometimes it's difficult for it to pick up your device drivers on some faulty installation. on this quick guide I'll show some ways of possible solution for faulty resolution.

Method I: Xrandr.

If you are running Xorg, this is an easy way to fix your resolution. Open your terminal and run xrandr, which will show some options, make sure you note or write down the display name that is shown. Write the following: cvt 1920 1080 (choose your resolution according to your monitor)

cvt 1920 1080

The output will be verbose, copy everythinng after Modeline, and run xrandr --newmode "what you copied".

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

Add the newly created mode to the display we want. The name is shown when you first ran xrandr, that command lists all your displays with the modes they currently support!`

xrandr --addmode "1920x1080_60.00" HDMI1

Apply the new mode. You can do it from the commandline or on settings depending on your Graphical Environment.

xrandr -s "1920x1080_60.00"

Method II: GRUB

This method sets resolution used on graphical terminal

Note that you can use only modes which your graphic card supports via VBE If you want to check which modes, you can reboot your computer to grub menu, and press c to enter the command mode! or you might as well skip this part and apply your default resolution... You can see them in real GRUB with the command:

videoinfo

Test your chosen resolution with the command:

videotest 1920x1080

When satisfied you can rebbot your computer and add those options to grub permanently... open the grub configuration file

sudo vim /etc/default/grub

Find and uncomment the line with GRUB_GFXMODE and set your-resolution,auto

GRUB_GFXMODE=1920x1080,auto

Uncomment the line GRUB_GFXPAYLOAD_LINUX to allow the kernel use the same resolution used by grub

GRUB_GFXPAYLOAD_LINUX=keep

Finally you can apply the configuration to grub

sudo grub-mkconfig -o /boot/grub/grub.cfg

On Ubuntu based you can just apply with a simple command:

sudo update-grub

That’s all, see ya!