This is a quick guide on how to fix issues with vagrant plugins that can happen when upgrading from an older vagrant version on Mac.

Most of my work today is either in Ping One Advanced Identity Cloud or in a kubernetes based ForgeOps deployment. But every now and then, all I need is a VM running some software, for example, a standalone PingAM. I find the easiest way to manage VMs is by using vagrant. It’s been a while since I last used it, so I ran an update to the latest version and tried to initiate a box.

The issue

You want to create a new linux box using vagrant, so you run:

1
vagrant init bento/rockylinux-9.5

But instead of initialising a Vagrant file, I got an error message:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
    Vagrant failed to initialize at a very early stage:
    The plugins failed to initialize correctly. This may be due to manual
    modifications made within the Vagrant home directory. Vagrant can
    attempt to automatically correct this issue by running:
      vagrant plugin repair
    If Vagrant was recently updated, this error may be due to incompatible
    versions of dependencies. To fix this problem please remove and re-install
    all plugins. Vagrant can attempt to do this automatically by running:
      vagrant plugin expunge --reinstall 
    Or you may want to try updating the installed plugins to their latest
    versions:
      vagrant plugin update
    Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-disksize (= 0.1.3)'

The error message gives some good suggestions on resolving the issue, so I tried following them one by one up to:

1
    Vagrant plugin expunge --reinstall

This would still throw an error, albeit a different one:

1
2
3
4
5
    Vagrant failed to properly resolve required dependencies. These
    errors can commonly be caused by misconfigured plugin installations
    or transient network issues. The reported error is:
     
    Unable to resolve dependency: user requested 'vagrant-vbguest (= 0.30.0)'

Why does this error happen

When Vagrant upgrades, its internal Ruby‑gem ecosystem can end up with mismatched plugin versions. The expunge command clears out old gems; vbguest or disksize then must be reinstalled to resolve dependencies.

The fix

So to resolve this, I had to run the plugin expunge --reinstall command, then install the failing vagrant-vbguest plugin and then again run the plugin expunge --reinstall command

  1. Backup existing plugins (optional):
1
cp -r ~/.vagrant.d ~/.vagrant.d.backup
  1. Expunge and reinstall everything:bashCopyEdit
1
vagrant plugin expunge --reinstall
  1. Install any failing plugin manually:bashCopyEdit
1
vagrant plugin install vagrant-vbguest`
  1. Re‑verify:
1
2
vagrant plugin list
vagrant init bento/rockylinux-9.5

The vagrant box should now initialise just fine.

Hope this helps if someone comes across the same error.