If you’ve recently ran an apt upgrade on your Raspberry Pi you might have noticed a bunch of lines scrolling up the screen saying “rpikernelhack” that freaked you out! What is rpikernelhack and why is it running on your Raspberry Pi??
When the developers of the Raspberry Pi were designing the device and its operating system, a decision was made to use the FAT32 file system on the device. On power on, the system looks for a FAT32 file-system called boot. This is built into the firmware of the Raspberry Pi and is not something that can be changed.
This caused some major issues for Debian package developers when they started creating packages for the RPi. The Debian Package Manger (dpkg) was able to correctly place new files onto this FAT32 partition just fine (although it would toss a few warning errors in certain cases that were mostly benign). However, when dpkg tried to update the files it would fail miserably. This is due to the fact that FAT32 does not support hard links on the file system like other Linux file systems. Dpkg would try to create backups of files during its upgrade process, which includes creating hard links to them. A major monkey wrench!
RELATED: 50+ Rasbperry Pi Projects
So what is rpikernelhack?
Well, rpikernelhack is exactly what is sounds like. It’s a hack to get around the FAT32 problem initially created by developer Peter Green.
Peter’s workaround was to use the “diversion” feature offered in Debian package manger. Or as he likes to say he “abused the feature”. Diversion was originally intended to allow files to be “diverted” so they could be replaced with either locally modified versions or versions from another package. This is an important feature for package installers.
However, Peter was able to use it in a more sneaky way. He figured out he could use diversion to allow dpkg to install files files on the partition, and then move his files to their final location at the end of the install (or diversion) process! Brilliant!
To use a diversion, you must specify local, or specify a specific package name. If you specify a specific package the diversion process will affect files owned by all packages but not the one you specify. Hence a package name called rpikernelhack!
Therefore at its fundamentals rpikernelhack is nothing but a fake package name to allow developers and Debian package manager to work around the limitations of the FAT32 file system and install packages without crashing.
What is rpikernelhack? Well now you know! If you have any questions, ask in the comments below and we’ll do our best to answer you!