Vagrant up error

I followed the instructions until running the vagrant up command, and i get stuck here… ideas?

Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/chicoboliviano16/.ssh/id_rsa:
Call to virConnectOpen failed: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: No such file or directory

What is your working directory when you run the vagrant up command?

Hi @Sergio_36161:

Please go through the following links to get solution for this error:

Please let me know, if any of these links help.

Thanks,
Sonali

Hi
I am new to M103. I have vagrant up problem on BOX
C:\Users\Owner\VirtualBox VMs\mongod-m103>vagrant ssh
VM must be created before running this command. Run vagrant up first.

C:\Users\Owner\VirtualBox VMs\mongod-m103>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Box ‘base’ could not be found. Attempting to find and install…
default: Box Provider: virtualbox
default: Box Version: >= 0
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/uri/rfc3986_parser.rb:67:in split': bad URI(is not URI?): file:///C:/Users/Owner/VirtualBox VMs/mongod-m103/base (URI::InvalidURIError) from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/uri/rfc3986_parser.rb:73:inparse’
from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/uri/common.rb:231:in parse' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/box_add.rb:485:inmetadata_url?’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/box_add.rb:91:in block in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/box_add.rb:89:inmap’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/box_add.rb:89:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/before_trigger.rb:23:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builder.rb:116:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:inblock in run’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/util/busy.rb:19:in busy' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:inrun’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/handle_box.rb:82:in handle_box' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/handle_box.rb:42:inblock in call’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/handle_box.rb:36:in synchronize' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/handle_box.rb:36:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/before_trigger.rb:23:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:121:inblock in finalize_action’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builder.rb:116:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in block in run' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/util/busy.rb:19:inbusy’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in run' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/call.rb:53:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/before_trigger.rb:23:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/after_trigger.rb:26:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/providers/virtualbox/action/check_virtualbox.rb:26:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/before_trigger.rb:23:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builder.rb:116:incall’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in block in run' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/util/busy.rb:19:inbusy’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in run' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:238:inaction_raw’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:209:in block in action' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/environment.rb:615:inlock’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:195:in call' from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:195:inaction’
from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run’

Could you help me ?
Thanks!

Have you completed all steps as per your instructions?
There are many threads on vagrant setup.Please check

Chapter 0: Introduction & Setup

Hi @Lei_70670,

Did you download m103-vagrant-env.zip file from the Handouts in the course? You need to unzip it in the m103 folder and then run “vagrant up --provision” command from inside “m103-vagrant-env” folder.

Please check the following post for detailed instructions:

Please let me know, if you have any questions.

Thanks,
Sonali

Hello Sonali.
I had the same problem. I tried the second two of the three links you suggested.

When I tried the instructions from the answer to the question in the third link, I had no success. Then I tried the instructions from Pavel P (end of the page in the second link), and it did not work. I had to delete the first part of the command on the second line, so it looked like this:
vagrant plugin install vagrant-libvirt sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
sudo adduser pavel libvirt sudo adduser pavel libvirt-qemu
$ sudo /etc/init.d/libvirtd restart

I did get a different error after I did this, though:
The box you’re attempting to add doesn’t support the provider (Vagrant::Errors::BoxAddNoMatchingProvider)
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn’t
simply misspell it.

If you’re adding a box from HashiCorp’s Vagrant Cloud, make sure the box is
released.

Name: ubuntu/trusty64
Address: https://vagrantcloud.com/ubuntu/trusty64
Requested provider: [:libvirt]

Hi @Ross_Hathaway_17049,

Can you please try re-installing vagrant once after completely uninstalling it?
You may also refer to the following thread for assistance.

Please let me know if you face any further issues.

Thanks,
Muskan
Curriculum Support Engineer

Thank you Muskan. I tried installing with the debian this time, and I was able to verify that vagrant was installed (showed version number), but when I typed “vagrant up --provision”, I got a message saying:

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)’

Once I tried some of their suggestions - first “vagrant plugin repair” then “vagrant plugin expunge --reinstall”, and I get this error:

ERROR: Failed to build gem native extension.

current directory: /home/ross/.vagrant.d/gems/2.4.6/gems/ruby-libvirt-0.7.1/ext/libvirt

/opt/vagrant/embedded/bin/ruby -r ./siteconf20190727-28305-1c7j5uv.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
–with-opt-dir
–with-opt-include
–without-opt-include={opt-dir}/include --with-opt-lib --without-opt-lib={opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
–with-libvirt-include
–without-libvirt-include
–with-libvirt-lib
–without-libvirt-lib
–with-libvirt-config
–without-libvirt-config
–with-pkg-config
–without-pkg-config
extconf.rb:73:in `’: libvirt library not found in default locations (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/home/ross/.vagrant.d/gems/2.4.6/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ross/.vagrant.d/gems/2.4.6/gems/ruby-libvirt-0.7.1 for inspection.
Results logged to /home/ross/.vagrant.d/gems/2.4.6/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/gem_make.out

Finally, when I did “vagrant plugin update”, I was able to run “vagrant up --provision” successfully. It started out with the following message, though:

Bringing machine ‘mongod-m103’ up with ‘virtualbox’ provider…
==> mongod-m103: Box ‘ubuntu/trusty64’ could not be found. Attempting to find and install…
mongod-m103: Box Provider: virtualbox
mongod-m103: Box Version: >= 0
==> mongod-m103: Loading metadata for box ‘ubuntu/trusty64’
mongod-m103: URL: https://vagrantcloud.com/ubuntu/trusty64
==> mongod-m103: Adding box ‘ubuntu/trusty64’ (v20190429.0.1) for provider: virtualbox
mongod-m103: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190429.0.1/providers/virtualbox.box

Actually, I thought it was finished, but it was not. Here is what happened:

==> mongod-m103: Successfully added box ‘ubuntu/trusty64’ (v20190429.0.1) for ‘virtualbox’!
==> mongod-m103: Importing base box ‘ubuntu/trusty64’…
==> mongod-m103: Matching MAC address for NAT networking…
==> mongod-m103: Setting the name of the VM: mongod-m103
==> mongod-m103: Clearing any previously set forwarded ports…
Vagrant is currently configured to create VirtualBox synced folders with
the SharedFoldersEnableSymlinksCreate option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

config.vm.synced_folder ‘/host/path’, ‘/guest/path’, SharedFoldersEnableSymlinksCreate: false
==> mongod-m103: Clearing any previously set network interfaces…
==> mongod-m103: Preparing network interfaces based on configuration…
mongod-m103: Adapter 1: nat
mongod-m103: Adapter 2: hostonly
==> mongod-m103: Forwarding ports…
mongod-m103: 22 (guest) => 2222 (host) (adapter 1)
==> mongod-m103: Running ‘pre-boot’ VM customizations…
==> mongod-m103: Booting VM…
==> mongod-m103: Waiting for machine to boot. This may take a few minutes…
mongod-m103: SSH address: 127.0.0.1:2222
mongod-m103: SSH username: vagrant
mongod-m103: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured (“config.vm.boot_timeout” value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout (“config.vm.boot_timeout”) value.

Hi @Ross_Hathaway_17049,

The message (shown below) that you see in the beginning is fine and not an error

Bringing machine ‘mongod-m103’ up with ‘virtualbox’ provider…
==> mongod-m103: Box ‘ubuntu/trusty64’ could not be found. Attempting to find and install…
mongod-m103: Box Provider: virtualbox
mongod-m103: Box Version: >= 0
==> mongod-m103: Loading metadata for box ‘ubuntu/trusty64’
mongod-m103: URL: https://vagrantcloud.com/ubuntu/trusty64
==> mongod-m103: Adding box ‘ubuntu/trusty64’ (v20190429.0.1) for provider: virtualbox
mongod-m103: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190429.0.1/providers/virtualbox.box

Regarding the time-out issue, can you please refer the following link and see if it works?

Thanks,
Muskan
Curriculum Support Engineer