So I wanted to install the GuestAdditions on my virtual machine running Fedora 21 workstation just now.
The VM was already running, so I estimated about 5 minutes tops to get the job done. I mounted the VBoxGuestAdditions.iso into the VM and started the setup procedure.
However I soon stumbled over a somewhat familiar error message.
The headers for the current running kernel were not found. If the following module compilation fails then this could be the reason.
I had seen this before, I was sure, and even remembered what had to be done without the need of any search bar at all! I must be a genius! Little did I know at that time how the search bar would be my companion for almost the next hour.
On a different occasion I had seen this problem on another VM. To make things short, the GuestAdditions of VirtualBox require the kernel sources and kernel headers during their installation. However, and that’s the part where things may get tricky, the kernel sources and headers must match the current kernel of the system. So I started off with
sudo yum update and
sudo yum upgrade to make sure everything is up to date.
Before I remembered the part about the matching kernel versions, I already had run
sudo yum install kernel-devel and
sudo yum install kernel-headers. So back to install the GuestAdditions I thought. However, the same error message as before popped up.
`uname -r` showed me that my system was running kernel 3.19.3-200.fc21.x86_64. Looking into /usr/src/kernels I saw that yum had given me the kernel sources and headers for version 4.0.4-202.fc21.x86_64.
So I returned to yum and demanded to get the correct sources
sudo yum install kernel-devel-`uname -r` which expands to
sudo yum install kernel-devel-3.19.3-200.fc21.x86_64 (but is more fool proof than typing it by hand). Unfortunately, yum replied with “no matches found”.
Things were getting fishy. A quick internet search told me that old kernel sources are removed from the package repo, but that desperate souls could give it a try at koji. This is basically the central build system of the Fedora project, i.e. kernel, packages, &cetera. But even there I could not find the kernel sources I was looking for.
Time to ask the mob on StackExchange. And while I was typing my question, explaining what I had already tried and how I had failed miserably, I started to get this feeling that I had forgotten something. Something not quite unimportant. I was just about to post the question. But while proof reading a last time, I still had this tickling on my chin, this feeling of unease in my stomach, this itching on the side of my nostrils. That was when I held in my breath, gave it a short thought, and, well, I finally rebooted the bloody VM.
After the VM was back up
uname -r replied with 4.0.4-202.fc21.x86_64, which was a perfect match to the sources I had downloaded. To spell out the obvious: I had forgotten to reboot my Linux system, so the updated kernel was not yet loaded!
Finally, after re-learning this lesson, the GuestAdditions did install in no time.
tl;dr: don’t forget to reboot. no matter what you do. reboot occasionaly. (is that a haiku?)