Fixing resolution issues on Debian 11: New Nvidia cards

After install, resolution might be off. Xrandr might so something like this:

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1024 x 768, current 1024 x 768, maximum 1024 x 768
default connected 1024×768+0+0 0mm x 0mm
1024×768 76.00*

Step 1: Grub resolution is wrong (optional)

This step is usually completely optional – but still nice to have.

To fix this issue go to Grub defaults and modify them:

sudo nano /etc/default/grub

Line of interest is something like this:


The above line will fix Grub boot menu resolution to a desired value. Change the
resolution according to your needs. Save the file and do: sudo update-grub

Reboot your computer and the display settings should now be ok for Grub boot menu.

Step 2: Install Nvidia drivers

Unfortunately, open source drivers do not some times work with all the new cards. We need to install proprietary Nvidia drivers to fix this. First, validate that you actually have such a card:

lspci|grep NVIDIA

Should print out something like:

07:00.0 VGA compatible controller: NVIDIA Corporation Device 2504 (rev a1)
07:00.1 Audio device: NVIDIA Corporation Device 228e (rev a1)

To install the drivers make sure that your sources.list file contains contrib and non-fee entries (sudo nano /etc/apt/sources.list).

Example sources.list:

deb bullseye main contrib non-free
deb-src bullseye main contrib non-free

deb bullseye-updates main contrib non-free
deb-src bullseye-updates main contrib non-free

deb bullseye-security main contrib non-free
deb-src bullseye-security main contrib non-free

Always do: sudo apt-get update to refresh your package sources once new locations are added to the sources.list. Also, generally advisable is to keep your system up-to-date with: sudo apt-get upgrade (or even with: sudo apt-get dist-upgrade – if you like to live on the edge).

Finally, installing the driver is done by executing: sudo apt-get install nvidia-driver -y

The installer will complain about Nouveau driver being currently loaded, but this is fixed by a simple reboot. Once all these steps are completed Nvidia drivers should be installed and resolution should show up correctly on a desktop environment.