Autoupdating VirtualBox Guest Additions with vagrant-vbguest

If you’re a fan of Vagrant and VirtualBox like me, you’ve probably got lots of resources you use it for. We get into the habit of bringing systems up and down thanks to the ease of Vagrant and VirtualBox working together, but one thing we often forget to do is to keep everything up to date because that’s not part of the day-to-day process.

When we upgrade VirtualBox, we will get prompted to update the guest additions. That means that the installed version updates with the base version of VirtualBox itself. It does not automatically go back and retrofit the existing machines with the updated guest additions though.

Keeping Guest Additions Up to Date with the vagrant-vbguest Plugin

If you run vagrant up after you’ve updated VirtualBox, this is what will show up to indicate you have a mismatch in your guest additions:

vagrant-guest-additions-out-of-date

Luckily, there is a better way to keep things up to date when using Vagrant for provisioning with VirtualBox. You can install a nifty, but very effective plugin called vagrant-vbguest which will check and update the VirtualBox guest additions every time you run a vagrant up command.

First, let’s shutdown the machine we are using using the vagrant halt command:

vagrant-halt

Next, we install the vagrant-vbguest plugin using the vagrant plugin install vagrant-vbguest command:

vagrant-install-plugin-vagrant-vbguest

It was as simple as that! Now, every time you run a vagrant up command to provision or relaunch a machine.

Let’s relaunch the machine that had the guest additions mismatch and see what happens:

vagrant-up-addition-update

Now we are all up to date, and the guest additions will be updated every time we vagrant up to ensure we are always synced up.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.