Fixing TTY resolution with proprietary NVIDIA drivers

So you got fed up with nouveau, installed the proprietary NVIDIA driver, and now your TTYs have giant blurred font and look like trash. I've struggled with this issue a lot in the past, but now I finally have a fix, and it's surprisingly easy.

What's happening is that GRUB fails to detect the right screen mode, and defaults to one of the lowest available, which is then passed to the Kernel and used by your TTYs. The solution is to tell GRUB what resolution to use, instead of giving it a free hand (to mess it up).

Finding the right resolution

Before we can start editing the GRUB config file, you need to find what resolutions are available. It'll vary based on the graphics card and possibly other factors.

  1. Reboot, enter GRUB, and press "C". That opens a GRUB terminal.
  2. Type vbeinfo, press Enter. A list of resolutions appears.
  3. Pick a resolution that best matches your native screen resolution.

For desktop monitors, that's usually 1920x1080 or 1920x1200. Most laptops use 1366x768.

It's a good idea to take a photo of the list for later reference. You don't want to have to reboot each time you forget the options.

Chances are, you won't see the full list. The highest resolutions are going to be near the end anyway, but if you want to see them all, first run set pager=1 in the GRUB terminal. That enables a built-in pager for later commands.

To go back to the GRUB menu, run exit. TODO verify this

Configuring GRUB

Now it's time for some config editing. The file in question is /etc/default/grub.

Open it with sudo nano /etc/default/grub (or use your editor of choice).

Locate this section, and replace the value (here auto) with your selected resolution:

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

The format is WIDTHxHEIGHTxBITS, for example 1920x1200x32.

Additionally, make sure GRUB_GFXPAYLOAD_LINUX is set to keep. That preserves the resolution when GRUB hands control over to the Kernel. Alternatively, replace keep with another resolution you picked from the list.

I like my GRUB bigger, so I used 1280x800x32 for GRUB and 1920x1200x32 for the TTY.

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1280x800x32

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=1920x1200x32

Applying the changes

Editing the file isn't quite enough, the last step is to rebuild the GRUB config file. That's right, this was a config file for a config file builder. Yo dawg.

The command to do that is sudo grub-mkconfig -o /boot/grub/grub.cfg. Ubuntu peasants can use sudo update-grub instead, which is basically the same thing.

To save yourself some typing next time, make an alias for it:

# Add this to ~/.bash_aliases
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'

If all went well, you can reboot and enjoy your new high-res TTYs now. Good luck!

Found something wrong in the article, or have a question?
You can reach me on Twitter, Mastodon and over e-mail.