VirtualBoX虛擬機裏安裝linux系統,在虛擬系統裏安裝增強功能報錯解決方法

轉自

http://www.cnblogs.com/MoShin/archive/2012/04/25/2469156.html

當我們在虛擬機裏安裝lixunx系統,避免不了的要安裝增強功能,無論是視覺效果還是物理機與虛擬機共享文件都是需要安裝增強功能的。當我們在進入虛擬系統安裝增強程序時可能會出現如下狀態:


[root@localhost VBOXADDITIONS_4.1.12_77245]# sh ./VBoxLinuxAdditions.run(增強程序)
VirtualBox Guest Additions installer
Removing installed version 4.1.10 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules           [確定]
Removing existing VirtualBox non-DKMS kernel modules       [確定]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.18-238.el5
Not building the VirtualBox advanced graphics driver as this Linux version is
too old to use it.
Building the main Guest Additions module                   [失敗]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [確定]
Installing the Window System drivers
Installing X.Org 7.1 modules                               [確定]
Setting up the Window System to use the Guest Additions    [確定]
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 componen[確定]
/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。 停止。
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
從上面的結果我們可以很清楚的看出來出現了一處錯誤,根據提示查看/var/log/vboxadd-install.log文件會有下面的錯誤:
[root@localhost VBOXADDITIONS_4.1.12_77245]# cat /var/log/vboxadd-install.log
/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。 停止。
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
通過上面的提示我們可以知道錯誤的原因是沒有內核原文件
解決方法如下:(下面的操作都是在虛擬電腦裏進行的不要理解成在物理機裏)
一;先安裝下面的程序; gcc   kernel   kernel-devel
程序說明
gcc.i686 : 各類編譯器(C、C++、Objective-C、Java, ...)
kernel.i686 : Linux 內核(Linux 操作系統的核心)
kernel-devel.i686 : 用來構建與內核匹配的內核模塊的開發軟件包。
程序安裝
[root@localhost VBOXADDITIONS_4.1.12_77245]#yum instal gcc.i686 kernel.i686 kernel-devel.i686
(用yum安裝時最好先用yum search 搜索下相應的程序,不同的版本可能會有不一樣的後綴如有的可能是.i386)
二;重新啓動電腦,啓動時系統會自動從新的內核文件選項啓動不要改回到原來的選項默認就好了(回到原來的選項還會出現上面的錯誤)。從新安裝增強程序問題可以解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章