Homestead Vagrant 无法启动虚拟机:"The VMMR0.r0 module version does not match VBoxVMM.dll/so/dylib"

Homestead Vagrant Failt to boot the VM: "The VMMR0.r0 module version does not match VBoxVMM.dll/so/dylib"

我尝试按照以下 并将 xdebug 安装到 vagrant 以连接到 atom。

所以在我的 Vagrantfile 中,我进行了以下设置:

config.vm.network :forwarded_port, guest: 9000, host: 9000

结果如下 Vagrantfile 是:

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))

homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
afterScriptPath = "after.sh"
aliasesPath = "aliases"

require File.expand_path(confDir + '/scripts/homestead.rb')

Vagrant.require_version '>= 1.9.0'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exist? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
        config.vm.provision "shell" do |s|
            s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
        end
    end

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON.parse(File.read(homesteadJsonPath))
    else
        abort "Homestead settings file not found in #{confDir}"
    end

    Homestead.configure(config, settings)

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
    end

    if defined? VagrantPlugins::HostsUpdater
        config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
    end

    config.vm.network :forwarded_port, guest: 9000, host: 9000
end

我尝试通过以下命令启动它:

vagrant up --provision

但是我得到以下错误:

There was an error while executing VBoxManage, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "12135e8c-7547-4c7e-a25c-58a7136fb600", "--type", "headless"]

Stderr: VBoxManage: error: The VMMR0.r0 module version does not match VBoxVMM.dll/so/dylib. If you just upgraded VirtualBox, please terminate all VMs and make sure that neither VBoxNetDHCP nor VBoxNetNAT is running. Then try again. If this error persists, try re-installing VirtualBox. (VERR_VMM_R0_VERSION_MISMATCH) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

我的 Virtualbox 版本是 5.1.38_Ubuntur122592 版本(来自命令 VboxManage -v)。

你知道我该如何解决吗?

您应该按照 here 中提到的这些步骤进行操作。步骤是:

首先卸载virtualbox:

sudo apt-get remove virtualbox virtualbox-ose virtualbox-qt

然后运行以下命令:

find / -name '*VMMR0*' -o -name '*VBoxVMM*'

然后安装回去:

sudo apt-get install virtualbox virtualbox-qt

然后 cd 到项目的根路径和 运行

vagrant up

就我而言,我必须重复这些步骤两次才能使其正常工作。