site  news  contact

How to fix broken video

October 26, 2021 — BarryK

Page created: October 18, 2021

I decided to write this tutorial in the first-person, so as to more easily relate my personal experiences with video setup. All of my computers, for the last several years, have been all-Intel GPUs (Graphical Processing Units, that is, the video chip). However, just recently I acquired a Nvidia GeForce 210 (GT218 GPU) video card, and that's when I discovered how much "fun" it is to get Nvidia cards to work! Here is a blog post about that video card:

Very cheap card, with an old GPU chip that Nvidia released in 2009.

At first bootup of EasyOS, I got a black screen instead of the expected desktop. After some research and experimenting, I found that the handover from efifb to nouveaufb was failing.

The computer has UEFI-BIOS (which I will just refer to as UEFI from now on), and the default bootup, using UEFI, results in the black screen. However, I found that if choose "Legacy mode", also known as "CSM" (Compatibility Support Module) in the UEFI boot menu, I do get the desktop.

The Linux kernel 'nouveau' driver is used for Nvidia GPUs, and it is an open-source project that attempts to reverse-engineer the GPU chips and somehow create a driver. With no help from Nvidia. What tends to happen, is that support for older GPUs is no longer maintained, and this seems to be the crux of my problem...

It seems that the nouveau kernel driver was developed on legacy-BIOS computers, and has not been improved for booting on UEFI computers. So it seems, from my experience.

Anyway, whatever the video problem is, black screen, or some corruption such as pixelation or screen tearing, there needs to be a mechanism to examine and fix the video. EasyOS has the "Xorg Video Wizard", that was originally in Puppy Linux, but has mutated considerably since then.

Let's say that you have a black screen. Reboot the computer, by pressing the reset button if there is one, or hold down the power button for four or more seconds to power off the computer. Next time that you power-up, choose "Fix broken video" from the menu...

Syslinux and rEFInd boot menus

EasyOS has two different boot menus, depending on whether you are booting in UEFI mode or legacy-BIOS mode. Computers manufactured prior to 2012 are nearly all legacy-BIOS. From 2012 onward, Windows PCs mostly have UEFI, but most do still support booting in legacy-BIOS mode.

If you have a UEFI computer, you might have to press the appropriate hot-key at power-on to go into the UEFI-setup and enable legacy-BIOS booting. I have done this on my computer, and at power-on, if I press the <ESC> key, I get this boot menu:

img1

..."SanDisk" is my USB-stick with EasyOS on it. You can see above, there is a choice to boot in UEFI mode or legacy-BIOS mode. For this tutorial, I am choosing the latter.

Choosing legacy-BIOS mode will bring up the Syslinux boot menu. If I had chosen UEFI-mode, it would bring up the rEFInd boot menu. Just to show you, this is what the rEFInd boot menu looks like:

img2

...you just get the default menu option, but there is a sub-menu. Press 'Insert', "Tab' or 'F2' key, and you get the sub-menu:

img3

...there it is, the "Fix broken video" menu option.

However, as we are doing a legacy-BIOS bootup, the Syslinux menu will display, and this is what we see:

img4

...I have already used the down-arrow key to highlight "Fix broken video". It is on the main menu, not in a sub-menu. Ok, now we bootup to hopefully fix the video...

"Fix broken video" menu choice

If you are able to see the above menus, as in the above snapshots, it means that the kernel framebuffer is working. If not, then you are in trouble. For UEFI bootup, the framebuffer is the 'efifb' kernel driver. For legacy-BIOS bootup, the framebuffer is the 'vesafb' kernel driver.

What is supposed to happen, is the kernel 'nouveau' driver will load later, for Nvidia cards, and there is supposed to be a handover from the efifb or vesafb to nouveaufb. That is the point where the screen goes black on my computer -- before we even get to running Xorg -- when do a UEFI bootup.

With the legacy-BIOS bootup, the handover from vesafb to nouveaufb works, so can get to the desktop. But for the tutorial, will assume that cannot, and need to fix it...

If the 'nouveau' kernel driver is the problem, then there is a simple solution -- blacklist it, that is, prevent it from loading. What that will mean, is that Xorg will startup using the efifb or vesafb. That is not a bad thing, it will work.

Some technical details...

The 'nouveau' kernel driver is what is known as a KMS driver, which means Kernel Mode Setting. The kernel has KMS drivers for most GPUs that are available these days, except for very old GPUs. That is, GPUs made by Intel, Nvidia and AMD have KMS kernel drivers.

As we are booting to fix the video, EasyOS will prevent the loading of these potentially troublesome KMS drivers. At bootup, the file /etc/modprobe.d/gpu.conf will have this in it:

blacklist amdgpu
blacklist gma500_gfx
blacklist i915
blacklist nouveau
blacklist radeon

...this will blacklist all of the kernel KMS drivers, so they won't load.

The next thing that will happen, is the "Xorg Video Wizard" will run. This has a text-mode GUI, and is running on the basic efifb or vesafb...

Xorg Video Wizard

This will run automatically, after having chosen "Fix broken video", and here is the first screen, and I have used the down-arrow to choose the 'nv' Xorg driver...

img5

You need to know that the kernel video drivers are different from the Xorg drivers, even though they may have the same name. And, they may need each other -- for example, the Xorg 'nouveau' driver needs the kernel 'nouveau' driver to be loaded.

The Xorg Video Wizard tries to be intelligent and offer you appropriate choices. In the above snapshot, the wizard knows that the GPU is Nvidia, and only the vesafb is running, so offers a choice of 'nv' or 'vesa' Xorg drivers.

'nv' works, I get a desktop. It works for both UEFI bootup and legacy-BIOS bootup. It is fine, a simple driver, that may not have the rendering speed you want for games or HD video. Or it may, you would need to find out on your computer.

To use the first two options in the above snapshot, the kernel 'nouveau' KMS driver has to be loaded, and on my computer, as already stated, I get a black screen for UEFI bootup. But the first two choices do work with legacy-BIOS bootup, so that is probably what I will set the default to in the UEFI-setup.

You have to experiment, find what works for you. Proceeding with the choice of 'nv'...

Testing a chosen Xorg driver

In the above snapshot, 'nv' is chosen. After clicking the <OK> button, another window asks about screen resolution:

img9

...and I chose "Let Xorg guess it", which is usually the best choice. Then there is an intermediate window:

img6

After choosing <TEST X NOW>:

img7

...success! After clicking on OK, there is a summary window:

img8

...and I chose <FINISHED>. And the desktop starts up successfully:

img10

...that is an old monitor, one of the early flat screens, only 1024x768 pixels native resolution.

KMS reboot option

If I had chosen one of the KMS options, 'nouveau' or 'modesetting', a reboot would have been required, with the kernel 'nouveau' driver not blacklisted. In that case, this window will appear:

img11

...the information in that window is very useful to remember. At any time in the future, you can bootup to the commandline, do not start Xorg, or from the desktop choose "Shutdown -> rectify -> Exit to commandline", then run Xorg Video Wizard:

# xorgwizard

The wizard will detect the current situation, and offer tweaks to improve performance.

Having said that, the Xorg Video Wizard is a work-in-progress. It has been a work-in-progress since the first release in 2007, about 15 years!
I only do some work on it occasionally, very occasionally. If you have a few clues about video configuration and some bash/ash shell scripting capability, feel free to hack on /usr/sbin/xorgwizard-cli -- let me know if you improve the script!

Note, this tutorial is for EasyOS version 3.1 or later.

Regards,
Barry Kauler


Further thoughts...

It seems that my conventional knowledge about 'vesafb' and 'efifb' may be out of date. Awhile back, I introduced "CONFIG_FB_SIMPLE=y" in the kernel configuration. Now, get this in the initrd, for both UEFI and legacy-BIOS bootup:

# cat /proc/fb
0 simple

I don't understand the relationship between this simple framebuffer and vesafb and efifb.
Note, my presumption that vesafb is active for legacy-BIOS bootup, is have it builtin to the kernel and also have "vga=792" in the kernel commandline.

if you have some knowledge in this area, contribution is welcome at the forum:

http://forum.puppylinux.com/viewforum.php?f=63

Or direct to me via the "Contact me" link at the top of https://bkhome.org/news/    

Tags: user