howtothings.co.uk
Installing VirtualBox guest editions on Linux CentOS - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Operating System and Software Support (https://www.howtothings.co.uk/forumdisplay.php?fid=17)
+--- Thread: Installing VirtualBox guest editions on Linux CentOS (/showthread.php?tid=2240)



Installing VirtualBox guest editions on Linux CentOS - Mark - 07-07-2014

Installing VirtualBox guest editions on Linux Cent OS

After performing a fresh install of Cent OS 6.5, then trying to install VirtualBox Guest Additions failed.

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

If we look at the log file.
Code:
less /var/log/vboxadd-install.log

The thing that stands out is:
Quote:Specify KERN_DIR=<directory> and run Make again.

Download the VirtualBox repo file so that it will be included whenever you run the yum update command:
Code:
cd /etc/yum.repos.d/
Code:
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo


It turns out the problem was that kernel headers were not installed.

Check what Kernel you have installed.
Code:
uname -r

You will get an output something like:
Quote:2.6.32-431.el6.x86_64

See what kernel headers are installed, it won't return anything if non are installed.
Code:
ls /usr/src/kernels/

Install kernel headers/
Code:
yum install kernel-headers kernel-devel gcc

Check kernel headers again.
Code:
ls /usr/src/kernels/

It will return something like:
Quote:2.6.32-431.20.3.el6.x86_64

Specify the KERN_DIR
Code:
KERN_DIR=/usr/src/kernels/2.6.32-431.20.3.el6.x86_64

Echo KERN_DIR to confirm that you've set it up properly:
Code:
echo $KERN_DIR

Export the KERN_DIR
Code:
export KERN_DIR

Re-Run the guest additions setup
Code:
cd /media/VBOXADDITIONS_4.3.12_93733

Run the installer
Code:
./VBoxLinuxAdditions.run

I was then getting a different error in in /var/log/vboxadd-install.log
Quote:KERN_DIR does not point to a directory. Stop.

Check that the kernel is the same as kernel-devel
Code:
rpm -qa kernel\* | sort

Install the latest kernel for your distro
Code:
yum install kernel
Quote:Installed: kernel.x86_64 0:2.6.32-431.20.3.el6

Reboot

Reset the KERN_DIR
Code:
KERN_DIR=/usr/src/kernels/2.6.32-431.20.3.el6.x86_64

export the KERN_DIR
Code:
export KERN_DIR

Re-Run the guest additions installer
Code:
cd /media/VBOXADDITIONS_4.3.12_93733
Code:
./VBoxLinuxAdditions.run

It should now install OK. If it does, reboot one last time and that should be it.