Home Theatre PC (HTPC) Build Part 3

Oof, the previous part has already been from November last year, some 8 months ago! I ended that blog post with the ominous message about shenanigans with the Operating System. It’s time to clarify what I meant with that.

Debian 11 and my hardware

I like Debian. It provides the perfect balance between stability and flexibility in an Operating System that I desire. Although this blog is about technical stuff, I’m happy that I have to spent a minimal amount of time on keeping things running in the house. This includes the new HTPC build as well. I don’t want it to break every time I perform any kind of update or change.

So, naively, in November I put Debian 11 on a USB, went to the HTPC in the living space, and fired up the Debian installer. So far so good. I run through the Installer like I have done so many times before and boot up the freshly installed Debian from the NVMe drive. HTPC restarts. Good. Grub menu showing Debian. Excellent. Black screen. Super! Wait, no. I should see the lightdm login screen? Ok weird, maybe rebooting helps. Holds the power button The Grub menu shows again. Waiting patiently for a few seconds until it boots Debian… And the TV loses HDMI signal again from the HTPC.

Luckily the HTPC is connected to my home network and I installed the SSH server. So I was able to login remotely to the HTPC to see WTF was going on.

Troubleshooting

Since it looks like a hardware-software problem, let’s check what dmesg has to say

[    0.025605] DMAR: [Firmware Bug]: Your BIOS is broken; DMAR reported at address 0!

Ok that sounds bad.

[    2.368999] i915 0000:00:02.0: firmware: failed to load i915/kbl_dmc_ver1_04.bin (-2)
[    2.369006] firmware_class: See https://wiki.debian.org/Firmware for information about missing firmware
[    2.369012] i915 0000:00:02.0: Direct firmware load for i915/kbl_dmc_ver1_04.bin failed with error -2
[    2.369015] i915 0000:00:02.0: [drm] Failed to load DMC firmware i915/kbl_dmc_ver1_04.bin. Disabling runtime power management.
[    2.369015] i915 0000:00:02.0: [drm] DMC firmware homepage: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

Firmware errors, kinda expected…

[    2.369637] crtc active state doesn't match with hw state (expected 0, found 1)
[    2.369687] WARNING: CPU: 0 PID: 272 at drivers/gpu/drm/i915/display/intel_display.c:14330 intel_atomic_commit_tail+0x126d/0x12c0 [i915]

More errors, great!

Installing some firmware

One of the realities of life, and Debian, is that not everything is “free”. So to get better support for our hardware, we need to install the non-free package repositories on our system and install the non-free firmware package.

After configuring the non-free repositories, we can find the package containing our firmware like this:

# apt-file search kbl_dmc_ver1_04
firmware-misc-nonfree: /lib/firmware/i915/kbl_dmc_ver1_04.bin

# apt-install firmware-misc-nonfree

With anticipation, we reboot the system. Grub menu shows up on the TV. Good. But then again, the TV loses the HDMI signal. Grrr.

More troubleshooting

Back to logging in via SSH, we try to troubleshoot the problems we are having. Duckduckgo’ing around the Internet leads us to some more firmware packages that could be useful.

One package called “intel-media-va-driver-non-free” has the following description:

The VA-API (Video Acceleration API) enables hardware accelerated video decode/encode at various entry-points (VLD, IDCT, Motion Compensation etc.) for the prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3). It provides an interface to fully expose the video decode capabilities in today’s GPUs. This package contains the video decode and encode driver backend for the Intel HD Graphics of the Intel Core processor family.

Sounds good, we want our HTPC to play multimedia!

# apt install intel-media-va-driver-non-free
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  intel-media-va-driver
The following NEW packages will be installed:
  intel-media-va-driver-non-free
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 5,257 kB of archives.
After this operation, 28.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://deb.debian.org/debian bullseye/non-free amd64 intel-media-va-driver-non-free amd64 21.1.1+ds1-1 [5,257 kB]
Fetched 5,257 kB in 1s (6,726 kB/s)                         
dpkg: intel-media-va-driver:amd64: dependency problems, but removing anyway as you requested:
 va-driver-all:amd64 depends on intel-media-va-driver | intel-media-va-driver-non-free; however:
  Package intel-media-va-driver:amd64 is to be removed.
  Package intel-media-va-driver-non-free is not installed.

(Reading database ... 60920 files and directories currently installed.)
Removing intel-media-va-driver:amd64 (21.1.1+dfsg1-1) ...
Selecting previously unselected package intel-media-va-driver-non-free:amd64.
(Reading database ... 60916 files and directories currently installed.)
Preparing to unpack .../intel-media-va-driver-non-free_21.1.1+ds1-1_amd64.deb ...
Unpacking intel-media-va-driver-non-free:amd64 (21.1.1+ds1-1) ...
Setting up intel-media-va-driver-non-free:amd64 (21.1.1+ds1-1) ...

Turns out we had already a version of the intel-media-va-driver installed on our system but it was swapped by the non-free version. To keep a long story short this also didn’t fix the black screen/signal loss issue.

Even more troubleshooting

Since I’m writing this months after performing the actions (and my notes fail me), I don’t have all the details but somehow I figured out I needed a newer version of the firmware than the version that’s shipped with Debian 11.

So back in November, Debian 12 was not yet released. (It was released yesterday, 10th of June 2023) However, you can use “testing” packages your Debian 11 system using the backports repositories. Backports are packages backported from the next release (in this case Debian 12, bullseye/bookworm) into the stable (Debian 11).

# echo "deb http://deb.debian.org/debian bullseye-backports main non-free" | tee -a /etc/apt/sources.list
# apt update
# apt -t bullseye-backports upgrade
# grub-install /dev/nvme0

I also noted down the package updates at the time:

Packages updated were:
Start-Date: 2022-11-26  15:41:57
Commandline: apt -t bullseye-backports upgrade
Install: linux-image-6.0.0-0.deb11.2-amd64:amd64 (6.0.3-1~bpo11+1, automatic), libjemalloc2:amd64 (5.2.1-3, automatic), libsystemd-shared:amd64 (251.3-1~bpo11+1, automatic), linux-libc-dev:amd64 (6.0.3-1~bpo11+1, automatic)
Upgrade: libvulkan1:amd64 (1.2.162.0-1, 1.3.224.0-1~bpo11+1), libcurl4:amd64 (7.74.0-1.3+deb11u3, 7.85.0-1~bpo11+1), udev:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libext2fs2:amd64 (1.46.2-2, 1.46.5-2~bpo11+2), bind9-host:amd64 (1:9.16.33-1~deb11u1, 1:9.18.8-1~bpo11+1), libcurl3-gnutls:amd64 (7.74.0-1.3+deb11u3, 7.85.0-1~bpo11+1), libatk1.0-data:amd64 (2.36.0-2, 2.38.0-1~bpo11+1), va-driver-all:amd64 (2.10.0-1, 2.14.0-1~bpo11+1), systemd-timesyncd:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libldap-common:amd64 (2.4.57+dfsg-3+deb11u1, 2.5.13+dfsg-2~bpo11+1), libpam-systemd:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), at-spi2-core:amd64 (2.38.0-4, 2.44.1-1~bpo11+1), libdeflate0:amd64 (1.7-1, 1.10-2~bpo11+1), libatk-bridge2.0-0:amd64 (2.38.0-1, 2.38.0-4~bpo11+1), libsystemd0:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libva-x11-2:amd64 (2.10.0-1, 2.14.0-1~bpo11+1), libnss-systemd:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libbpf0:amd64 (1:0.3-2, 1:0.7.0-2~bpo11+1), less:amd64 (551-2, 590-1~bpo11+1), libldap-2.4-2:amd64 (2.4.57+dfsg-3+deb11u1, 2.4.59+dfsg-1~bpo11+1), systemd:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libudev1:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), libcom-err2:amd64 (1.46.2-2, 1.46.5-2~bpo11+2), lshw:amd64 (02.18.85-0.7, 02.19.git.2021.06.19.996aaad9c7-2~bpo11+1), libatk1.0-0:amd64 (2.36.0-2, 2.38.0-1~bpo11+1), linux-image-amd64:amd64 (5.10.149-2, 6.0.3-1~bpo11+1), man-db:amd64 (2.9.4-2, 2.10.1-1~bpo11+1), libatspi2.0-0:amd64 (2.38.0-4, 2.44.1-1~bpo11+1), bind9-dnsutils:amd64 (1:9.16.33-1~deb11u1, 1:9.18.8-1~bpo11+1), rsyslog:amd64 (8.2102.0-2+deb11u1, 8.2208.0-1~bpo11+1), libtdb1:amd64 (1.4.3-1+b1, 1.4.7-2~bpo11+1), firmware-misc-nonfree:amd64 (20210315-3, 20210818-1~bpo11+1), init-system-helpers:amd64 (1.60, 1.64~bpo11+1), bind9-libs:amd64 (1:9.16.33-1~deb11u1, 1:9.18.8-1~bpo11+1), systemd-sysv:amd64 (247.3-7+deb11u1, 251.3-1~bpo11+1), logsave:amd64 (1.46.2-2, 1.46.5-2~bpo11+2), libva-drm2:amd64 (2.10.0-1, 2.14.0-1~bpo11+1), libdw1:amd64 (0.183-1, 0.187-1~bpo11+1), init:amd64 (1.60, 1.64~bpo11+1), libelf1:amd64 (0.183-1, 0.187-1~bpo11+1), libepoxy0:amd64 (1.5.5-1, 1.5.8-1~bpo11+1), iproute2:amd64 (5.10.0-4, 6.0.0-1~bpo11+1), libss2:amd64 (1.46.2-2, 1.46.5-2~bpo11+2), libva2:amd64 (2.10.0-1, 2.14.0-1~bpo11+1), e2fsprogs:amd64 (1.46.2-2, 1.46.5-2~bpo11+2)
End-Date: 2022-11-26  15:43:01

Rebooting… Grub shows. Good. Waiting a few seconds… Lightdm shows!!! Amazing!

So what fixed the problem? Although I’m not a 100% sure, I think the fix was in the “va-driver-all” which updated from 2.10 to 2.14 with the backports. Looking at the public repository for it, we see that 2.10 was from December 2020 whilst my CPU is from 2021. 2.14 is from early 2022, so my guess is that there’s been some changes in those releases that fixes the HDMI problem that I was having.

However, using backports together with stable (11), meant a bit more shenanigans than I’d like when installing and upgrading things. Furthermore because of this video issue, I didn’t install encryption on the LVM and this is something I try to do for all my computers (and hard drives). So I have to reinstall it properly when Debian 12 comes out.

Debian 12

So why am I writing this up on this lovely Sunday in June (weather is 30°C and sunny). Well for one, I have severe hay fever allergy so I’m stuck inside whilst the Hooikoorts radar is showing “extreme levels” of pollen in the air. Secondly, I just read that Debian 12 was released yesterday.

Extreme levels of pollen

Extreme levels of pollen

After installing the system and forcing my way through with Debian 11 and all the shenanigans that ensued (including installing of the media software which quickly became an even bigger mess although it “worked”), I figured it would be best and most conform my earlier statements of “stability” and not wanting to do too much sysadmin’ing to wait until Debian 12 came out and then perform a reinstall.

So here we are today. Debian 12 is out. No excuses.

# dd of=/dev/sdc if=/home/adri/Unsorted/debian-12.0.0-amd64-netinst.iso bs=8M
92+1 records in
92+1 records out
773849088 bytes (774 MB, 738 MiB) copied, 152.861 s, 5.1 MB/s

Ejecting USB. Injecting it in the HTPC. Booting. Next. Next. Next. User bas. Encrypted LVM pl0x. Typing very complex password. Next. Next. Xfce, SSH server and system utilies plz. Next. Next. Waiting. Installation finished. Rebooting…

At first my heart sank because I saw some hardware errors but the HDMI signal stayed on and it asked for my encryption key (albeit a bit off screen). Enters key Lightdm appears! Logs in.

Installs without issues

Installs without issues

Conclusion

A lazy (and patient) sysadmin is a good sysadmin.

In the next part, we’ll install the media software including making sure that the blu-ray drive works (which I acquired during these months of silence on the blog).