12 Aug

Debian 9.1 (stretch) with proprietary nvidia-driver and uvesafb

So it’s 2017 and I can’t believe I had to get my hands this dirty to put this to work, but it finally works: I have high resolution text console while using the proprietary nvidia-driver! Don’t get me wrong: the steps are easy, but the mere fact I had to do this is what annoys me. Why don’t the proprietary nvidia-drivers deliver a beautiful framebuffer console out-of-the-box like nouveau does? Anyway…

If you got to this post, chances are you have done your fair share of searches, tried different suggestions from many different Forums and/or Stack Overflow answers but is still strugling. Also, if you know what this post is related to, chances are you actually need/want a framebuffer console, so I assume you can get around the console and editing system files. That being said, I’ll keep this tutorial very straightforward and not get into many details explaining how to do basic stuff.

Well let’s get to it, then!

NOTE: I usually do these things on a root console, so you won’t see me use sudo on my commands. If you don’t feel comfortable doing that, just remember to put sudo before every command you see here.

Commands have dark background and begin with a #  indicating that I’m on a root shell. Anything else is either the output of a command or the content of a file and have white background.

You’ll need two packages: v86d and hwinfo. Since this tutorial is for Debian:

After that, run:

The output in my case was:

Take note of the resolution and color depth you want for your console. Even though my screen is 3840x2160 (4K) I went with a combination of  1600x1200-16 for GRUB (line 27) and 3840x2160-16 for the console itself (line 30). For the console I applied a bigger font so I could actually go with the native resolution for my screen. More on this later, keep reading!

Next step is to create a new file and edit two existing ones.

First of all, create the file /etc/initramfs-tools/conf.d/splash with the following content:

Next, edit /etc/initramfs-tools/modules and append this, but with the resolution you chose for your console. In my case:

Now let’s set the configuration on the GRUB file both for the Kernel and for GRUB itself. Edit the file /etc/default/grub and look for the highlighted lines below. Input the info as you see, respecting the resolution you chose for GRUB and the one for the Linux Console.

Line 10 is for the Kernel, instructing it to use uvesafb and giving it the same parameters we put on the initramfs file before.

Line 25 is the resolution for the GRUB screen itself (where you choose the operating system to boot). As I previously said, I went with 1600x1200 (16 bits) because it looks better for me (and for some reason 24 bits didn’t work here and it fallback to VESA 640x480). Choose whatever you want, based on what is available at your system.

Line 26 is the resolution GRUB will apply when handing control over to Linux. Keep in mind that many tutorials about improving the console resolution will tell you to use keep on this parameter. That is for when you want to use the same resolution you put on GRUB_GFXMODE.

Attention: note that the syntax for uvesafb both on the initramfs file and on line 10 above use a dash to separate the resolution and color depth, while on GRUB_GFXMODE and GRUB_GFXPAYLOAD_LINUX you must use x.

Ok, now that we must instruct initramfs and GRUB that those files were modified. To do this, run:

Output will be something like this, depending on your Kernel version, operating systems you have installed on your computer and other GRUB settings, so bare in mind your mileage may vary:

And that’s it. You can go on and reboot and see both GRUB and your text console with high resolution!

But before I consider this tutorial finished, let me give you a tip if you also used a very high resolution on your console like I did and now you have tiny fonts there: to solve this, reconfigure your console and tell it to use a different, bigger font.

To do that, run:

Given I am using 3840x2160 on the text console, here is my suggestion for answers to the questions you’ll be asked when running above command in case you use the same resolution:

  • Encoding to use on the console: UTF-8
  • Character set to support: Latin1 and Latin5  (choose what fits your case best)
  • Font for the console: TerminusBold
  • Font size: 12x24 (framebuffer only)

Settings are applied immediately. Enjoy! 😎

3 thoughts on “Debian 9.1 (stretch) with proprietary nvidia-driver and uvesafb

  1. Thanks. I wasn’t clear on how to switch to uvesafb. Couple of notes though: the command to update initramfs’s is of course update-initramfs, not initramfs. Also I don’t think it’s a good idea to update the initramfs for all kernels until you know your updates work…

    Anyways, switching to uvesafb didn’t solve my problem: grub is fine but my monitor goes black after the first messages from kernel. I can login blindly and run startx. Then when in X I can switch to virtual console and if using vesafb or uvesafb, everything is fine. With VGA console even that doesn’t work.

    So, without X I have no working console. If I ever screw up so that X can’t start, the situation is bad. This is with Debian 9, distro kernel 4.9.82-1+deb9u3, Nvidia drivers 384.111. I have an old 3.16 kernel installed too where I do have a console so I guess I’ll be keeping that around as a fallback.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.