Building Virtualbox Guest Additions on RHEL6 fails

Latest response

We have some test systems where we have Virtual Box v4.3.28 and have a few RHEL v6 test VMs living in it.

I feel that to get this installed is a type of hodge-podge of directions. I've installed an rpm from Fedora website called epel-release along with adding the following: KERN_DIR=/usr/src/kernels/uname -r

During the install, it outputs the following:

Building the main Guest Additions Module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)

I look at vbox.add-install.log and there is too much to freeform here, however it is pointing back to KERN_DIR= and run Make again.


Do you have the kernel-devel package installed? Please note that the version must match the running kernel.

The kernel that I have installed is the following:


I've also installed the following rpms:


I uninstalled Guest Additions and reinstalled it again and this is what the uninstall log is saying:

/tmp/vbox.0/Makefile.include.header:97 *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

Also getting echo " ERROR: Kernel configuration is invalid.";
included/linux/autoconf.h or include/cofig/auto.conf are missing.";
run 'make oldconfig && make prepare' on kernel src to fix it.";

There is also way too much output in this log for me to try and type it in by hand. I can try to attach a usb drive and copy the file to that and see if I can get it all out that way.


Could you show us the output returned by:

rpm -qa kernel* | sort


uname -mr

rpm -qa kernel* | sort


uname -mr

2.6.32-431.el6.x86_64 x86_64

What's the output from "echo $KERN_DIR" prior to trying to work with the Guest Additions?

echo "$KERN_DIR" returns nothing.

In your original post you said "along with adding the following: KERN_DIR=/usr/src/kernels/uname -r". Where did you add that? KERN_DIR needs to be defined prior to running the install. Try

KERN_DIR=/usr/src/kernels/$(uname -r) ; echo $KERN_DIR; ls -ld $KERN_DIR

Even after adding KERN_DIR, and upgrading VirtualBox to v5.0, I still continue to get Building the Main Guest Addition module as a Failure.

If looking at /var/log/bvox-add-install.log there are still alot of errors in the log. Too many too type by hand, however starting at the beginning its the same as I've posted before.

/tmp/vbox.0/Makefile.include.header:97: *** Error:  unable to find the sources of your current Linux kernel.   Specify KERN_DIR-<directory> and run Make again.  Stop.  

Looking at the rpms, I have kernel-headers, are there any flags that needed to be set when this was installed?

Also I see dracut-kernel-004-335.el6.noarch installed, will this cause an issue?

I don't remember having any issue with RHEL 6 guest, please try the following in VirtualBox:

  1. Install RHEL 6 minimal installation
  2. Do a full yum update
  3. Install kernel-devel gcc make patch
  4. Reboot
  5. Mount VirtualBox Tools iso and try to install the Guest additions

If this works, there is something fishy with your current VMs...


What you advised was successful. Except that I didn't have to install make or patch, just gcc.

[root@ApacheFTP ~]# lsmod | grep -i vbox
vboxsf                 37535  0 
vboxguest             284665  6 vboxsf
vboxvideo               2148  1 
drm                   280012  2 vboxvideo

So this worked, so what do you think is fishy about the RHEL VM?

Also if there is a new Kernel or update of Virtual Box or Virtual Box Guest Additions, do I have to do anything, such as re-install the software?


Yes there is definitely something wrong there. Basically, the loaded kernel and kernel-devel package need to be the same version (incl all minor/build parts, etc.). What I would suggest is to:

  1. Take a snapshot of your current VM
  2. Update kernel, kernel-devel, boot into the new kernel
  3. Clean up the VirtualBox installation, incl. any older version and check if there are no longer any vbox related drivers (rpm -qa, lsmod, find /lib/modules, etc.).
  4. Reboot and try to re-run the recent VirtualBox Guest Additions setup

Let's see if it helps...

And yes, if you change the running kernel (upgrade/downgrade), you need to re-run the VirtualBox Guest Additions setup.


The kernel and kernel-dev are the same along with being a vanilla install of RHEL v6.5, other then not having gcc installed, I'm not sure what the issue is.

Its working now, and going forward I kind of know what to look for or troubleshoot if I have to do a fresh install or new install if the kernel is upgraded.


On my install (Linux ghd7160013.localdomain 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux) the "build" symbolic link in /lib/modules/2.6.32-642.el6.x86_64 was broken.

I recreated it pointing at the correct object:

[root@ghd7160013 2.6.32-642.el6.x86_64]# ll total 3888 lrwxrwxrwx. 1 root root 50 Nov 10 12:48 build -> ../../../usr/src/kernels/2.6.32-642.6.2.el6.x86_64

VBoxAdditions then installed without issue.

Installed kernel-devel .Issue resolved

For me too:

dnf install kernel-devel-$(uname -r) kernel-core-$(uname -r)