Vagrant: VirtualBox and GuestAdditions version

One last thing about Vagrant (setup and installation) I want to share with you guys is, syncing the VirtualBox and GuestAdditions versions. I hope you’re here after going through the previous Vagrant posts ‘Installing Vagrant on CentOS 7‘ and ‘Vagrant 101‘ – on setting up the first VM (i.e. precise64), when you executed the ‘vagrant up’ for the first time, you may end up getting the following warning message:

$ vagrant up
....
....
default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 5.1
.....
.....
The screenshot:
VirtualBox version
This post is about resolving this difference of versions. No need to worry, it’s just about executing one more command i.e. installing the vagrant-vbguest plug-in. Shutdown the machine ‘vagrant halt‘ and then execute the following command in the project directory i.e. where the Vagrantfile is located:
$ vagrant plugin install vagrant-vbguest
vagrant vbguest
We can verify the current version of Guest Additions, using the ‘vbguest’ command:
$ vagrant vbguest
[default] GuestAdditions 5.1.6 running --- OK.
The screenshot:
 dpy_7.4

Verification: on next ‘vagrant up‘ after the ‘Machine booted and ready!‘ it will start downloading the missing packages:
GuestAdditions
[nahmed@localhost ~]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
== default: Checking if box 'hashicorp/precise64' is up to date...
== default: Clearing any previously set forwarded ports...
== default: Clearing any previously set network interfaces...
== default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
== default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
== default: Booting VM...
== default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
== default: Machine booted and ready!
[default] GuestAdditions 5.1.6 running --- OK.
== default: Checking for guest additions in VM...
== default: Mounting shared folders...
default: /vagrant => /home/nahmed
== default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
== default: flag to force provisioning. Provisioners marked to run always will still run.
The screenshot, to share the exact stdout I got:
vagrant up
And that’s it. It hasn’t just fixed the version conflict for just this VM, but also for any provisioning i.e. ‘vagrant up‘ it’ll will check & install the correct guest additions right after booting.

Leave a Reply

Your email address will not be published. Required fields are marked *