unable to find the sources of your current Linux k

virtualbox增强工具安装时出现unable to find the sources of your current Linux kernel


当我们在虚拟机里安装Linux系统,避免不了的要安装增强功能,无论是视觉效果还是物理机与虚拟机共享文件都是需要安装增强

功能的。当我们在进入虚拟系统安装增强程序时可能会出现如下状态:

[root@localhost  
VBOXADDITIONS_4.1.12_77245]# ./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 :
用来构建与内核匹配的内核模块的开发软件包。程序安装

打开网络连接,因为执行以下命令以后需要联网下载所需程序。(大概35M)

[root@localhost  

yum install gcc   从软件仓库下载gcc,然后安装,这个是编译器
yum install make  安装make,这个是自动编译源码的工具,写好makefile就可以方便编译
yum install kernel-headers 安装内核,编译内核,驱动必要的
yum install kernel-devel  同上

(用yum安装时最好先用yum search
搜索下相应的程序,不同的版本可能会有不一样的后缀如有的可能是.i386)

二、重新启动电脑,启动时系统会自动从新的内核文件选项启动。不要改回到原来的选项默认就好(回到原来的选项还会出现上面的错误)。重新安装增强程序问题就可以解决。


转载于:https://my.oschina.net/mkh/blog/225501

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值