Vagrant Up 错误操作不允许

Vagrant Up Error Operation not permitted

我正在尝试安装 laravel/homestead 但是,在安装过程中,当我 运行 命令 vagrant up 时,我的 VBoxManage 遇到错误,我该如何解决这个问题?

错误:

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

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: Operation not permitted
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 71 of file VBoxManageHostonly.cpp

这跟权限有关系吗?因为 Operation not permitted?

我用 ls -l /dev/vboxnetctl 检查了文件,这是它返回的内容:

crw------- 1 root root 10, 55 Oct  3 07:24 /dev/vboxnetctl

我应该更改此文件的权限吗?如果是这样,我想让你知道,我之前做过,它仍然显示错误,但这个错误是不同的:

/home/troopy712139/Homestead/scripts/homestead.rb:4:in `configure': undefined method `[]' for nil:NilClass (NoMethodError)
    from /home/troopy712139/Homestead/Vagrantfile:30:in `block in <top (required)>'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `block in load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/vagrantfile.rb:28:in `initialize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `vagrantfile'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:492:in `host'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:214:in `block in action_runner'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:479:in `hook'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:728:in `unload'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `ensure in <main>'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `<main>'

VBoxManage hostonlyif create 命令在我 运行 根目录下工作了一次。

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface 'vboxnet1' was successfully created

你能试试吗运行sudo vagrant up --provision.

您可能还需要检查以确保您的路径在 Homestead.yaml 文件中匹配

周围的错误:/dev/vboxnetctl 告诉您您的用户没有访问权限。

试一试行: sudo usermod -a -G vboxusers

阿尔瓦罗

看来我需要做的就是让 vboxnetctl 归我所有,然后重新启动我的计算机。我还在启动时通过 运行 将此代码添加到 vboxdrv 到 运行:

service vboxdrv start