CentOS 7:VirtualBox抱怨没有加载内核模块

CentOS 7:VirtualBox抱怨没有加载内核模块,virtualbox,centos7,kernel-module,Virtualbox,Centos7,Kernel Module,背景: 我在macOS上用VirtualBox创建了一个沙盒虚拟机。它正确地启动了一个VM(运行CentOS7),我可以在上面访问它 在这个沙盒虚拟机中,我想启动几个虚拟机,以便使用Kitchen CI&Vagrant测试Ansible剧本,因此我通过从以下链接下载安装了VirtualBox: 安装后,我执行了以下命令: [david@vmkitchen-环境安全测试]#VBoxManage--版本 它返回: WARNING: The vboxdrv kernel module is not l

背景

我在macOS上用VirtualBox创建了一个沙盒虚拟机。它正确地启动了一个VM(运行CentOS7),我可以在上面访问它

在这个沙盒虚拟机中,我想启动几个虚拟机,以便使用Kitchen CI&Vagrant测试Ansible剧本,因此我通过从以下链接下载安装了VirtualBox:

安装后,我执行了以下命令:

[david@vmkitchen-环境安全测试]#VBoxManage--版本

它返回:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.10.0-693.2.1.el7.x86_64) or it 
         failed to load. Please recompile the kernel module and install it 
         by
           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.
5.2.8r121009
我安装了开发工具,但我一直遇到同样的问题

我认为我不需要重新编译任何内核模块。有什么想法吗


提前感谢您的帮助。

因此,在互联网上搜索后,而不仅仅是在VirtualBox网站上,我找到了解决方案,我是对的:我不需要编译任何模块。 以下是CentOS wiki页面的参考:

简而言之,我必须安装
dkms
kernel-devel
软件包。为此,我需要安装EPEL存储库;但就个人而言,我更喜欢安装并启用IUS存储库

以下是适用于我的一组命令:

yum-groupinstall“开发工具”

yum安装https://centos7.iuscommunity.org/ius-release.rpm

yum安装dkms

yum安装kernel-devel

重新启动

机器重新启动后,我可以让VirtualBox正常工作

我已通过命令行验证:

[david@vmkitchen-环境安全测试]#VBoxManage--版本

它返回了正确的值:


5.2.8r121009

以下步骤为我解决了这个问题

1.sudo/sbin/vboxconfig

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-957.10.1.el7.x86_64
2.本网站拥有核心模块-

wget

4.yum localinstall kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm-y

5.sudo/sbin/vboxconfig

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-957.10.1.el7.x86_64

问题已解决

嘿,大卫,你知道什么版本的kernel-devel适合你,你是如何安装的吗?我使用的是比virtualbox 6预期的更新版本或内核开发版,它似乎没有意识到该工具已安装。您好@yvanscher,我在工作站上的虚拟机中工作。如果我设法找到了正确的虚拟机(我强烈认为我找到了),那么操作系统就是CentOS 7,内核版本:3.10.0_693.5.2.el7.x86_64。我希望这可能对解决您的问题有所帮助:)