Problem with virtual machine

I have Vagrant v1.9.6 and VirtualBox v5.1.28 . Both are remains from previous courses.
I have run the ‘vagrant up’ and VM was created. but with multiple errors. I can even connect with
‘vagrant ssh’

But no mongodb installed , no shared folder (both created, but not shared).
Here is some errors:

==> mongodb-m042: A newer version of the box 'centos/7' is available! You currently
==> mongodb-m042: have version '1708.01'. The latest is version '1905.1'. Run
==> mongodb-m042: `vagrant box update` to update.

Should I run this upgrade?

Not the main problem:>

Uncompressing VirtualBox 5.1.28 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.
An error occurred during installation of VirtualBox Guest Additions 5.1.28. Some functionality may not work as intended.

In most cases it is OK that the "Window System drivers" installation failed.
Redirecting to /bin/systemctl start vboxadd.service
Job for vboxadd.service failed because the control process exited with error code. See "systemctl status vboxadd.service
" and "journalctl -xe" for details.
==> mongodb-m042: Checking for guest additions in VM...
    mongodb-m042: No guest additions were detected on the base box for this VM! Guest
    mongodb-m042: additions are required for forwarded ports, shared folders, host only
    mongodb-m042: networking, and more. If SSH fails on this machine, please install
    mongodb-m042: the guest additions and repackage the box to continue.
    mongodb-m042:

The share folder is not set, because guest addition was not installed, but why mongodb is not installed?

[vagrant@m042 ~]$ mongod --fork --logpath mongod.log
-bash: mongod: command not found
[vagrant@m042 ~]$

Hello torus_ot,

Thanks for the note. The provisioning file should download MongoDB to the Vagrant box.

Can you please try leaving the Vagrant box, and from the directory m042-vagrant-env, run:

vagrant provision

Let me know if this helps.

Matt

Yep, it is working now:

==> mongodb-m042: Welcome to M042 Vagrant Box
==> mongodb-m042: + set +e
==> mongodb-m042: + echo '
==> mongodb-m042: Welcome to M042 Vagrant Box
==> mongodb-m042: '

and I can start mongod now.
The shared folder is still not working…

Hello torus_ot,

Thanks for the reply! Another student had an issue with the shared folder earlier as well. They were able to solve the problem with the following steps:

mXXX-vagrant-env$ vagrant plugin update vagrant-vbguest
mXXX-vagrant-env$ vagrant destroy
mXXX-vagrant-env$ vagrant up --provision

Let me know if this helps!

Best,
Matt

I am getting [mongodb-m042] No Virtualbox Guest Additions installation found. error. Please help.
C:\m042\m042-vagrant-env>vagrant vbguest --status
[mongodb-m042] No Virtualbox Guest Additions installation found.

C:\m042\m042-vagrant-env>vagrant plugin install vagrant-vbguest
Installing the ‘vagrant-vbguest’ plugin. This can take a few minutes…
Installed the plugin ‘vagrant-vbguest (0.19.0)’!

C:\m042\m042-vagrant-env>vagrant version
Installed Version: 2.2.5
Latest Version: 2.2.5

You’re running an up-to-date version of Vagrant!

C:\m042\m042-vagrant-env>

C:\m042\m042-vagrant-env>vagrant up --provision
Bringing machine ‘mongodb-m042’ up with ‘virtualbox’ provider…
==> mongodb-m042: Importing base box ‘centos/7’…
==> mongodb-m042: Matching MAC address for NAT networking…
==> mongodb-m042: Checking if box ‘centos/7’ version ‘1710.01’ is up to date…
==> mongodb-m042: Setting the name of the VM: mongodb-m042
==> mongodb-m042: Clearing any previously set network interfaces…
==> mongodb-m042: Preparing network interfaces based on configuration…
mongodb-m042: Adapter 1: nat
mongodb-m042: Adapter 2: hostonly
==> mongodb-m042: Forwarding ports…
mongodb-m042: 22 (guest) => 2222 (host) (adapter 1)
==> mongodb-m042: Running ‘pre-boot’ VM customizations…
==> mongodb-m042: Booting VM…
==> mongodb-m042: Waiting for machine to boot. This may take a few minutes…
mongodb-m042: SSH address: 127.0.0.1:2222
mongodb-m042: SSH username: vagrant
mongodb-m042: SSH auth method: private key
mongodb-m042:
mongodb-m042: Vagrant insecure key detected. Vagrant will automatically replace
mongodb-m042: this with a newly generated keypair for better security.
mongodb-m042:
mongodb-m042: Inserting generated public key within guest…
mongodb-m042: Removing insecure key from the guest if it’s present…
mongodb-m042: Key inserted! Disconnecting and reconnecting using new SSH key…
==> mongodb-m042: Machine booted and ready!
[mongodb-m042] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”

Thanks In advance
Karunakaran

Hello kgaddam0212,

Thanks for the note. We found earlier that vagrant plugin install vagrant-vbguest doesn’t always download the latest version of the vagrant-vbguest plugin. Can you try running the following command:

vagrant plugin update vagrant-vbguest

Then I would suggest running:

vagrant destroy
vagrant up --provision

Let me know if this helps!

Matt

Hi Matt,

still same issue

C:\m042\m042-vagrant-env>vagrant plugin update vagrant-vbguest
Updating plugins: vagrant-vbguest. This may take a few minutes…
All plugins are up to date.

C:\m042\m042-vagrant-env>vagrant reload mongodb-m042
==> mongodb-m042: Attempting graceful shutdown of VM…
==> mongodb-m042: Checking if box ‘centos/7’ version ‘1710.01’ is up to date…
==> mongodb-m042: Clearing any previously set forwarded ports…
==> mongodb-m042: Clearing any previously set network interfaces…
==> mongodb-m042: Preparing network interfaces based on configuration…
mongodb-m042: Adapter 1: nat
mongodb-m042: Adapter 2: hostonly
==> mongodb-m042: Forwarding ports…
mongodb-m042: 22 (guest) => 2222 (host) (adapter 1)
==> mongodb-m042: Running ‘pre-boot’ VM customizations…
==> mongodb-m042: Booting VM…
==> mongodb-m042: Waiting for machine to boot. This may take a few minutes…
mongodb-m042: SSH address: 127.0.0.1:2222
mongodb-m042: SSH username: vagrant
mongodb-m042: SSH auth method: private key
==> mongodb-m042: Machine booted and ready!
[mongodb-m042] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror

One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
==> mongodb-m042: Checking for guest additions in VM…
mongodb-m042: No guest additions were detected on the base box for this VM! Guest
mongodb-m042: additions are required for forwarded ports, shared folders, host only
mongodb-m042: networking, and more. If SSH fails on this machine, please install
mongodb-m042: the guest additions and repackage the box to continue.
mongodb-m042:
mongodb-m042: This is not an error message; everything may continue to work properly,
mongodb-m042: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

yum install -y centos-release

Stdout from the command:

Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”

Stderr from the command:

One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

C:\m042\m042-vagrant-env>vagrant provision mongodb-m042
==> mongodb-m042: Running provisioner: shell…
mongodb-m042: Running: C:/Users/kgadd/AppData/Local/Temp/vagrant-shell20190815-17136-1fe7jir
mongodb-m042: + ip_config
mongodb-m042: ++ ifconfig
mongodb-m042: /tmp/vagrant-shell: line 9: ifconfig: command not found
mongodb-m042: ++ grep ‘inet addr:’
mongodb-m042: ++ cut -d: -f2
mongodb-m042: ++ awk ‘{ print $1}’
mongodb-m042: ++ grep -v 127.0.0.1
mongodb-m042: ++ tail -1
mongodb-m042: + export CLIENT_IP_ADDR=
mongodb-m042: + CLIENT_IP_ADDR=
mongodb-m042: ++ hostname
mongodb-m042: + export CLIENT_FQDN=localhost.localdomain
mongodb-m042: + CLIENT_FQDN=localhost.localdomain
mongodb-m042: ++ hostname
mongodb-m042: ++ cut -d. -f 1
mongodb-m042: ++ tr ‘[:upper:]’ ‘[:lower:]’
mongodb-m042: Configuring /etc/hosts …
mongodb-m042: + export CLIENT_NAME=localhost
mongodb-m042: + CLIENT_NAME=localhost
mongodb-m042: + echo ‘Configuring /etc/hosts …’
mongodb-m042: + echo ‘127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ’
mongodb-m042: + echo ‘::1 localhost localhost.localdomain localhost6 localhost6.localdomain6’
mongodb-m042: + echo ‘fe00::0 ip6-localnet’
mongodb-m042: + echo ‘ff00::0 ip6-mcastprefix’
mongodb-m042: + echo ‘ff02::1 ip6-allnodes’
mongodb-m042: + echo ‘ff02::2 ip6-allrouters’
mongodb-m042: + echo ‘ff02::3 ip6-allhosts’
mongodb-m042: + echo ’ localhost.localdomain localhost’
mongodb-m042: + user_setup
mongodb-m042: + sudo mkdir -p /data/db
mongodb-m042: + sudo chown vagrant:vagrant /data/db
mongodb-m042: + sudo sh -c ‘killall mongod; true’
mongodb-m042: sh: killall: command not found
mongodb-m042: + sudo mkdir -p /var/mongodb/db/db1 /var/mongodb/db/db2 /var/mongodb/db/db3
mongodb-m042: + sudo mkdir -p /var/mongodb/logs
mongodb-m042: + sudo mkdir -p /var/mongodb/certs
mongodb-m042: + sudo chown -R vagrant:vagrant /var/mongodb
mongodb-m042: + sudo mkdir -p /downloads/
mongodb-m042: Set LC_ALL=C to .profile
mongodb-m042: + echo ‘Set LC_ALL=C to .profile’
mongodb-m042: + sudo echo ‘export LC_ALL=C’
mongodb-m042: + sudo echo ‘function get_certificate_password() {
mongodb-m042: echo -n ‘’‘m042password’’’
mongodb-m042: }
mongodb-m042:
mongodb-m042: export -f get_certificate_password
mongodb-m042: ’
mongodb-m042: + install_mongod
mongodb-m042: + sudo echo ’
mongodb-m042: [mongodb-enterprise]
mongodb-m042: name=MongoDB Enterprise Repository
mongodb-m042: baseurl=https://repo.mongodb.com/yum/redhat/7/mongodb-enterprise/4.1/x86_64/
mongodb-m042: gpgcheck=1
mongodb-m042: enabled=1
mongodb-m042: gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
mongodb-m042: ’
mongodb-m042: + sudo yum install -y mongodb-enterprise-unstable
mongodb-m042: Loaded plugins: fastestmirror
mongodb-m042:
mongodb-m042:
mongodb-m042: One of the configured repositories failed (Unknown),
mongodb-m042: and yum doesn’t have enough cached data to continue. At this point the only
mongodb-m042: safe thing yum can do is fail. There are a few ways to work “fix” this:
mongodb-m042:
mongodb-m042: 1. Contact the upstream for the repository and get them to fix the problem.
mongodb-m042:
mongodb-m042: 2. Reconfigure the baseurl/etc. for the repository, to point to a working
mongodb-m042: upstream. This is most often useful if you are using a newer
mongodb-m042: distribution release than is supported by the repository (and the
mongodb-m042: packages for the previous distribution release still work).
mongodb-m042:
mongodb-m042: 3. Run the command with the repository temporarily disabled
mongodb-m042: yum --disablerepo= …
mongodb-m042:
mongodb-m042: 4. Disable the repository permanently, so yum won’t use it by default. Yum
mongodb-m042: will then just ignore the repository until you permanently enable it
mongodb-m042: again or use --enablerepo for temporary usage:
mongodb-m042:
mongodb-m042: yum-config-manager --disable
mongodb-m042: or
mongodb-m042: subscription-manager repos --disable=
mongodb-m042:
mongodb-m042: 5. Configure the failing repository to be skipped, if it is unavailable.
mongodb-m042: Note that yum will try to contact the repo. when it runs most commands,
mongodb-m042: so will have to try and fail each time (and thus. yum will be be much
mongodb-m042: slower). If it is a very temporary problem though, this is often a nice
mongodb-m042: compromise:
mongodb-m042:
mongodb-m042: yum-config-manager --save --setopt=.skip_if_unavailable=true
mongodb-m042:
mongodb-m042: Cannot find a valid baseurl for repo: base/7/x86_64
mongodb-m042: Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
mongodb-m042: 14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

C:\m042\m042-vagrant-env>

Thanks
Karunakaran

Hi Matt,

Just wanted to update you. I was able to create vagrant virtual machine for all previous classes. I have updated virtualbox version to 6.0.10. That is the only change. I tried with virtualbox 5.2.32 after reinstalling it. Still same issue. current I have virtualbox 6.0.10 and vagrant 2.2.5. is there anything I need to change provision_m042 and vagrantfile to make this work?

Thanks
Karunakaran

Matt,
Indeed, updating vbquest plugin helped.
The shared folder is now in sync between host and VM.

Thanks!

in new version vargan add this plugin. $
vagrant plugin install vagrant-vbguest
vagrant vbguest

1 Like