Debian Sid, Fix broken graphics output with GPU passthrough
13 Jan 2022I realized I had no graphics output before Windows has loaded in my virtual machine with GPU passthrough. Or if I was using a FreeBSD/Linux VM I had no graphics until Xorg was loaded, so if I quit to console mode my screen went blank.
The problem is a bug in the latest OVMF uefi package. So it isn’t initializing the GPU properly. The solution is to install the ovmf package from Debian Stable (Bullseye).
First we need to add the Debian stable repository to the /etc/apt/sources.list
# /etc/apt/sources.list
# Debian Sid/Unstable
deb http://ftp.se.debian.org/debian/ Sid main contrib non-free
deb-src http://ftp.se.debian.org/debian/ Sid main contrib non-free
# Debian Stable to use for broken Sid packages
deb http://ftp.se.debian.org/debian/ stable main contrib non-free
So now I have the Debian stable repository as well. Now lets make sure apt is chosing the ovmf package from the stable branch.
I am using the pinning feature of apt to make sure the ovmf package from the stable branch have higher priority than the Sid branch. Create the file /etc/apt/preferences.d/stable-pkgs
# /etc/apt/preferences.d/stable-pkgs
Package: ovmf
Pin: release a=stable
Pin-Priority: 1100
You can name the file what you want. The Pin-Priority should be above 1000 to force a downgrade of an already installed package.
Now we can run apt-update to update the packages cache list
$ sudo apt update
and to install the older version of the package we just need to run apt install ovmf
$ sudo apt install ovmf
because of our high Pin-Priority apt will downgrade the package to the stable version.