我正在按照教程尝试设置 vagrant,这是我人生中第一次设置。我使用 VVCW 框,因为我想用它来操作 WordPress。所以我下载了 zip 文件并将其解压到我的 /home 文件夹中,并且没有更改 default.yml 文件。
这就是结果:(我在 Xubuntu 18.04 上)
fabio@thinkpad:~/Vagrant/vccw$ vagrant up
Bringing machine 'vccw.test' up with 'libvirt' provider...
#<Thread:0x000055ef7b1cc6c0@/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:71 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 25: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:82:in
运行中的块(2 个级别)' 24:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:inaction' 23: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:in
调用' 22:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/environment.rb:592:inlock' 21: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/machine.rb:202:in
操作中的块' 20:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/machine.rb:227:inaction_raw' 19: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in
运行中' 18:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:inbusy' 17: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in
运行中的块' 16:来自/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in call' 15: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in
call' 14:来自/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builtin/config_validate.rb:25:in call' 13: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in
call' 12:来自/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builtin/box_check_outdated.rb:31:in call' 11: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in
call' 10:来自/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:52:in call' 9: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:170:in
to_app' 8:来自/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:170:innew' 7: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:20:in
初始化' 6:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:20:inmap' 5: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:20:in
块初始化' 4:来自 /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:90:infinalize_action' 3: from /usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:90:in
新' 2:来自 /usr/share/rubygems-integration/all/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_networks.rb:26:ininitialize' 1: from /usr/share/rubygems-integration/all/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/driver.rb:40:in
连接' /usr/share/rubygems-integration/all/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/driver.rb:43:inrescue in connection': Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/fabio/.ssh/id_rsa: (VagrantPlugins::ProviderLibvirt::Errors::FogLibvirtConnectionError) Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/fabio/.ssh/id_rsa: Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
我刚刚尝试使用另一个盒子,但出现了同样的错误。
有人能帮帮我吗?非常感谢!
编辑 1:在其他地方寻找错误,我刚刚安装了 vagrant-libvirt 插件。
fabio@thinkpad:~/Vagrant/teste$ vagrant plugin install vagrant-libvirt Installing the 'vagrant-libvirt' plugin. This can take a few minutes... Installed the plugin 'vagrant-libvirt (0.0.43)'!
但是当我这样做时vagrant up
,出现了同样的错误。:(
编辑-2:我按照说明操作:
$ vagrant plugin install vagrant-libvirt $ sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager $ sudo adduser fabio libvirt $ sudo adduser fabio libvirt-qemu $ sudo /etc/init.d/libvirtd restart
错误仍然存在...:(
答案1
我刚刚发现这个问题
我正在使用存储库中的 VirtualBox 6.0 版本,而存储库的 Vagrant 版本不是最新版本,因此存在冲突。
所以我首先删除了 vagrant
sudo apt --purge remove vagrant
sudo apt autoremove
之后我从这里并安装:
sudo dpkg -i vagrant_x.x.x_x86_64.deb
安装非常快,因此我调用 Vagrant 版本来确保它已安装:
vagrant version
我得到了这个输出:
Vagrant failed to initialize at a very early stage:
The plugins failed to initialize correctly. This may be due to manual modifications made within the Vagrant home directory. Vagrant can attempt to automatically correct this issue by running:
vagrant plugin repair
If Vagrant was recently updated, this error may be due to incompatible versions of dependencies. To fix this problem please remove and re-install all plugins. Vagrant can attempt to do this automatically by running:
vagrant plugin expunge --reinstall
Or you may want to try updating the installed plugins to their latest versions:
vagrant plugin update
Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-libvirt (= 0.0.43)'
所以我决定(实际上记得)卸载 vagrant-libvirt:
sudo apt --purge remove vagrant-libvirt
做了sudo apt update
——以防万一……
然后vagrant up
再次。
而且它有效!!!!:)
答案2
我遇到了同样的错误,以 开头Vagrant failed to initialize at a very early stage:
并以 结尾Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-libvirt (= 0.12.0)'
。
此外,我还有以下问题Plugin 'vagrant-proxyconf' not found.
我已经使用了最新的 Vagrant 版本 (2.3.6),因此这不是 Vagrant 版本太旧的问题。libvirt 似乎已安装并处于活动状态,因为 virsh 命令有效:
# virsh list --all
Id Name State
--------------------
就像你一样,我尝试过dnf remove vagrant-libvirt
,但No match for argument: vagrant-libvirt
看完之后vagrant libvirt 文档,安装了旧版本 (2.2.19) 的 Vagrant,一切正常!看来 vagrant-libvirt 尚不支持 Vagrant 版本 2.6.6。因此,使用旧版本 Vagrant <2.3 是解决方案。