安装virtualbox增强功能的时候,出现
Building the main Guest Additions module [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong)
的错误,google了一下找到以下解决方案。
原网址:http://vbtechsupport.com/1139/
Virtualbox is a useful tool for testing various Linux and Windows operating systems in a virtualized environment. However, while testing mymodified Centmin Nginx installation script on CentOS 6.0 64bit, I came across an issue with installing VBoxGuestAddition components – the VirtualBox Guest Additions’ kernel modules failed to get built. Prior to CentOS 6.0, you could fix this by ensuring kernel-headers and other prerequisites were installed first.
yum -y install dkms kernel* gcc
The error message:
sh ./VBoxLinuxAdditions-amd64.run Building the VirtualBox Guest Additions kernel modules[FAILED] Your system does not seem to be set up to build kernel modules. Look at /var/log/vboxadd-install.log to find out what went wrong. Once you have corrected it, you can run /etc/init.d/vboxadd setup to build them. Doing non-kernel setup of the Guest Additions[ OK ] Installing the Window System drivers Installing X.Org Server 1.7 modules[ OK ] Setting up the Window System to use the Guest Additions[ OK ] You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components[ OK ] |
If you check log /var/log/vboxadd-install.log you’ll see
*** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.. Stop. |
However, with CentOS 6.0 the above solution didn’t work as it seems the YUM mirrors aren’t all updated yet so you have specify the exact kernel-header version during install
yum -y install dkms gcc kernel-headers-`uname -r` kernel-devel-`uname -r` |
Once you do that, reinstall the VirtualBox Guest Additions
sh ./VBoxLinuxAdditions-amd64.run Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module[ OK ] Building the shared folder support module[ OK ] Building the OpenGL support module[ OK ] Doing non-kernel setup of the Guest Additions[ OK ] Starting the VirtualBox Guest Additions [ OK ] Installing the Window System drivers Installing X.Org Server 1.7 modules[ OK ] Setting up the Window System to use the Guest Additions[ OK ] You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components[ OK ]