DISCLAIMER: This question is NOT a duplicate of this. The solution from that post (to use file:// protocol when adding the box) did not solve the issue for me.
I am new to Vagrant. Downloaded a custom box because I need to investigate something about this particular box. I can't get vagrant up to work. It fails because Vagrant tries to download a box I already installed from a local file.
Here's my console output:
[andymac@x58Manjaro Boxes]$ pwd
/home/andymac/Boxes
[andymac@x58Manjaro Boxes]$ ls -la
total 737884
drwxr-xr-x 2 andymac andymac 4096 Mar 25 10:21 .
drwxr-xr-x 41 andymac andymac 4096 Mar 25 10:15 ..
-rwxrwxrwx 1 andymac andymac 755579528 Mar 25 09:42 rhel-7.8-beta-1-mlnx-x86_64.2002.01.libvirt.box
[andymac@x58Manjaro Boxes]$ vagrant box add rhel-7.8-beta1 file:///home/andymac/Boxes/rhel-7.8-beta-1-mlnx-x86_64.2002.01.libvirt.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'rhel-7.8-beta1' (v0) for provider:
box: Unpacking necessary files from: file:///home/andymac/Boxes/rhel-7.8-beta-1-mlnx-x86_64.2002.01.libvirt.box
==> box: Successfully added box 'rhel-7.8-beta1' (v0) for 'libvirt'!
[andymac@x58Manjaro Boxes]$ vagrant box list
rhel-7.8-beta1 (libvirt, 0)
[andymac@x58Manjaro Boxes]$ vagrant init rhel-7.8-beta1
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[andymac@x58Manjaro Boxes]$ ls -la
total 737888
drwxr-xr-x 2 andymac andymac 4096 Mar 25 10:24 .
drwxr-xr-x 41 andymac andymac 4096 Mar 25 10:15 ..
-rwxrwxrwx 1 andymac andymac 755579528 Mar 25 09:42 rhel-7.8-beta-1-mlnx-x86_64.2002.01.libvirt.box
-rw-r--r-- 1 andymac andymac 3020 Mar 25 10:24 Vagrantfile
[andymac@x58Manjaro Boxes]$ vagrant box list
rhel-7.8-beta1 (libvirt, 0)
[andymac@x58Manjaro Boxes]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'rhel-7.8-beta1' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'rhel-7.8-beta1' (v0) for provider: virtualbox
default: Downloading: rhel-7.8-beta1
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /home/andymac/Boxes/rhel-7.8-beta1
OS for this output is Manjaro Linux (5.5.11-1-MANJARO), but I also run into same exact issue on Windows 10 1903 build 18362.720
This is because you have installed a box for the provider libvirt
:
==> box: Successfully added box 'rhel-7.8-beta1' (v0) for 'libvirt'! [andymac@x58Manjaro Boxes]$ vagrant box list rhel-7.8-beta1 (libvirt, 0)
And then you try to run it with the default provider virtualbox
:
Bringing machine 'default' up with 'virtualbox' provider...
You need to run it with the provider libvirt
, use this command:
vagrant up --provider=libvirt
Other way to set the provider is to set the environment variable:
export VAGRANT_DEFAULT_PROVIDER=libvirt
Or to modify the config.vm.provider
in your Vagrantfile
.
See vagrant-libvirt#start-vm and Basic Provider Usage #Default Provider
Otherwise if you don't want to use libvirt
but virtualbox
you have to install a rhel
box for virtualbox