Problem with Virtual box - Vagrant

   I have a problem


- I made chapter 1 without problem

- I connect today to make the replicas set and I can not access the shared folder because it gives me an error, but the other day I did not have any problem

- I close all shell and restart the virtual box

- I connect to the vagrant again and I can access the shared folder but it puts 0 files

- I close everything and delete the m103 from the virtual box and the m103-vagrant-env folder to start everything from the beginning

- I go to the shell and I am located in the directory C:\COURSE_ID\university\m103 where I have the file m103-vagrant-env.zip

- I put vagrant up --provision and shows

"A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again."

- I put vagrant up and it and shows

"A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again".

- I put init and shows

"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."

- I put vagrant global-status and shows 2

C:\COURSE_ID\university\m103>vagrant global-status
id       name        provider   state   directory
30bcb2e  mongod-m040 virtualbox running C:/COURSE_ID/university/m040/m040-vagrant-env
223d31a  mongod-m103 virtualbox running C:/COURSE_ID/university/m103/m103-vagrant-env

"The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

- I go to the virtual box and I only have 1 (m040)

- I go to the directory C:\COURSE_ID\university\m103 and the folder m103-vagrant-env is not created

- C:\COURSE_ID\university\m103>vagrant destroy 223d31a

"The working directory for Vagrant doesn't exist! This is the
specified working directory:"

- C:\COURSE_ID\university\m103>vagrant destroy (223d31a)

"The machine with the name '(223d31a)' was not found configured for
this Vagrant environment"

- C:\COURSE_ID\university\m103>vagrant global-status

id       name        provider   state   directory
--------------------------------------------------------------------------------------
30bcb2e  mongod-m040 virtualbox running C:/COURSE_ID/university/m040/m040-vagrant-env

- I manage to eliminate it even though it gave an error

- C:\COURSE_ID\university\m103>vagrant up --provision
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
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
    default: Downloading: base
    default:
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 /C:/COURSE_ID/university/m103/base
- C:\COURSE_ID\university\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
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
default:
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 /C:/COURSE_ID/university/m103/base

- I do not know what the problem is, but now I can not do anything

It is done

  • I downloaded the course file again, I unzipped it, and I repeated the steps again and I already have access to shared

vagrant @ m103: / shared $ ls
mongod-repl-1.conf mongod-repl-2.conf mongod-repl-3.conf

I do not know why it has been giving me so many problems, but after many attempts I have solved it, I do not know if the files had been damaged

That is the thing that made it work this time. :slight_smile:

It seems like in last comment, you were not in the directory where you needed to run vagrant up. I have written down some steps in case you want to take a look: Installing, Setting up Vagrant and Run Validation Scripts

Kanika