Building Virtualbox Guest Additions on RHEL6 fails
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=
Responses
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
I don't remember having any issue with RHEL 6 guest, please try the following in VirtualBox:
- Install RHEL 6 minimal installation
- Do a full yum update
- Install kernel-devel gcc make patch
- Reboot
- Mount VirtualBox Tools iso and try to install the Guest additions
If this works, there is something fishy with your current VMs...
//Zdenek
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:
- Take a snapshot of your current VM
- Update kernel, kernel-devel, boot into the new kernel
- 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.).
- 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.
//Zdenek
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.