Wednesday, December 18, 2013

VirtualBox - building Guest Additions on CentOs 6.5 fails: openGL & X11 are not installed

If your VirtualBox became small, ugly and lost Copy&Paste capabilities try running VB Guest Additions install. However if are getting the below error, while running VirtualBox Guest Addition Installation
Building the OpenGL support module     [FAILED]
here is the way to deal with it.

Here is a patch for OpenGL failure described here, slightly modified to support various kernel' versions:
cd /usr/src/kernels/`uname -r`/include/drm/  
ln -s /usr/include/drm/drm.h drm.h  
ln -s /usr/include/drm/drm_sarea.h drm_sarea.h  
ln -s /usr/include/drm/drm_mode.h drm_mode.h  
ln -s /usr/include/drm/drm_fourcc.h drm_fourcc.h

Well, this is not enough if you already tried installing Guest Additions in the past and it failed!

To avoid the  below error

Installing graphics libraries and desktop services components ...fail! (See the log file /var/log/vboxadd-install-x11.log for more information.) Press Return to close this window... install_x11_startup_app: no script given

you also have manually remove two folders as described here and here:

rm -rf /usr/lib64/VBoxGuestAdditions
rm -rf /usr/share/VBoxGuestAdditions
rm -rf /opt/VBoxGuestAdditions


Now run the installer:
cd /media/VBOXADDITIONS_4.3.4_91027
./VBoxLinuxAdditions.run

You might get a warning from the installer, but that's fine - type in "yes" and wait until everything compiles and installs.