【问题标题】:CentOS 7: VirtualBox is complaining that the kernel module is not loadedCentOS 7:VirtualBox 抱怨内核模块未加载
【发布时间】:2018-08-18 14:28:23
【问题描述】:

背景:

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

在这个沙盒虚拟机中,我想启动几个虚拟机来测试带有 Kitchen CI 和 Vagrant 的 Ansible Playbook,因此我通过以下链接下载了 VirtualBox:https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2-5.2.8_121009_el7-1.x86_64.rpm

安装后我执行了命令:

[david@vmkitchen-env ansible-test]# VBoxManage --version

它返回:

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 centos7 kernel-module


    【解决方案1】:

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

    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.本站有内核模块-website

    wgethttps://linuxsoft.cern.ch/cern/centos/7/updates/x86_64/Packages/kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm

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

    5.sudo /sbin/vboxconfig

    问题已解决

    【讨论】:

      【解决方案2】:

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

      https://wiki.centos.org/HowTos/Virtualization/VirtualBox

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

      以下是对我有用的命令集:

      yum groupinstall "Development tools"

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

      yum install dkms

      yum install kernel-devel

      reboot

      机器重新启动后,我能够让 VirtualBox 正常工作。

      我通过命令行验证:

      [david@vmkitchen-env ansible-test]# VBoxManage --version

      它返回了正确的值:

      5.2.8r121009

      【讨论】:

      • 嘿,戴维德,您知道哪个版本的 kernel-devel 适合您以及您是如何安装它的吗?我使用的版本或内核开发版本比 virtualbox 6 预期的要新,它似乎无法识别该工具已安装。
      • 嗨@yvanscher,我在我的工作站上的虚拟机中工作。如果我设法找到了正确的虚拟机(我强烈认为我做到了),操作系统是 CentOS 7,内核版本:3.10.0_693.5.2.el7.x86_64。我希望这可能对解决您的问题有任何好处:)
      猜你喜欢
      • 2014-07-07
      • 2016-07-08
      • 1970-01-01
      • 2012-08-20
      • 2016-01-05
      • 1970-01-01
      • 2016-04-29
      • 2012-03-14
      • 1970-01-01
      相关资源
      最近更新 更多