Vagrant: Plugins fail to initialize at a very early stage after the update to Vagrant 1.9.0 on OSX El Capitan

Created on 29 Nov 2016  ·  16Comments  ·  Source: hashicorp/vagrant

Vagrant version

Vagrant 1.9.0

Host operating system

OSX 10.11.6

Guest operating system

Ubutuntu 16.04 amd64

Vagrantfile

I tried with my install of trellis, the vagrant file is pasted beneath. I also tried one install with drupalvm which had actually the very same error.

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'yaml'

ip = '192.168.50.5' # pick any local IP
cpus = 1
memory = 1024 # in MB

ANSIBLE_PATH = __dir__ # absolute path to Ansible directory

# Set Ansible paths relative to Ansible directory
ENV['ANSIBLE_CONFIG'] = ANSIBLE_PATH
ENV['ANSIBLE_CALLBACK_PLUGINS'] = "~/.ansible/plugins/callback_plugins/:/usr/share/ansible_plugins/callback_plugins:#{File.join(ANSIBLE_PATH, 'lib/trellis/plugins/callback')}"
ENV['ANSIBLE_FILTER_PLUGINS'] = "~/.ansible/plugins/filter_plugins/:/usr/share/ansible_plugins/filter_plugins:#{File.join(ANSIBLE_PATH, 'lib/trellis/plugins/filter')}"
ENV['ANSIBLE_LIBRARY'] = "/usr/share/ansible:#{File.join(ANSIBLE_PATH, 'lib/trellis/modules')}"
ENV['ANSIBLE_ROLES_PATH'] = File.join(ANSIBLE_PATH, 'vendor', 'roles')
ENV['ANSIBLE_VARS_PLUGINS'] = "~/.ansible/plugins/vars_plugins/:/usr/share/ansible_plugins/vars_plugins:#{File.join(ANSIBLE_PATH, 'lib/trellis/plugins/vars')}"

config_file = File.join(ANSIBLE_PATH, 'group_vars', 'development', 'wordpress_sites.yml')

def fail_with_message(msg)
  fail Vagrant::Errors::VagrantError.new, msg
end

if File.exists?(config_file)
  wordpress_sites = YAML.load_file(config_file)['wordpress_sites']
  fail_with_message "No sites found in #{config_file}." if wordpress_sites.to_h.empty?
else
  fail_with_message "#{config_file} was not found. Please set `ANSIBLE_PATH` in your Vagrantfile."
end

if !Dir.exists?(ENV['ANSIBLE_ROLES_PATH']) && !Vagrant::Util::Platform.windows?
  fail_with_message "You are missing the required Ansible Galaxy roles, please install them with this command:\nansible-galaxy install -r requirements.yml"
end

Vagrant.require_version '>= 1.8.5'

Vagrant.configure('2') do |config|
  config.vm.box = 'bento/ubuntu-16.04'
  config.ssh.forward_agent = true

  config.vm.post_up_message = post_up_message

  # Fix for: "stdin: is not a tty"
  # https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
  config.ssh.shell = %{bash -c 'BASH_ENV=/etc/profile exec bash'}

  # Required for NFS to work
  config.vm.network :private_network, ip: ip, hostsupdater: 'skip'

  site_hosts = wordpress_sites.flat_map { |(_name, site)| site['site_hosts'] }

  site_hosts.each do |host|
    if !host.is_a?(Hash) or !host.has_key?('canonical')
      fail_with_message File.read(File.join(ANSIBLE_PATH, 'roles/common/templates/site_hosts.j2')).sub!('{{ env }}', 'development').gsub!(/com$/, 'dev')
    end
  end

  main_hostname, *hostnames = site_hosts.map { |host| host['canonical'] }
  config.vm.hostname = main_hostname

  redirects = site_hosts.flat_map { |host| host['redirects'] }.compact

  if Vagrant.has_plugin? 'vagrant-hostmanager'
    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.aliases = hostnames + redirects
  else
    fail_with_message "vagrant-hostmanager missing, please install the plugin with this command:\nvagrant plugin install vagrant-hostmanager"
  end

  if Vagrant::Util::Platform.windows? and !Vagrant.has_plugin? 'vagrant-winnfsd'
    wordpress_sites.each_pair do |name, site|
      config.vm.synced_folder local_site_path(site), remote_site_path(name, site), owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
    end
    config.vm.synced_folder File.join(ANSIBLE_PATH, 'hosts'), File.join(ANSIBLE_PATH.sub(__dir__, '/vagrant'), 'hosts'), mount_options: ['dmode=755', 'fmode=644']
  else
    if !Vagrant.has_plugin? 'vagrant-bindfs'
      fail_with_message "vagrant-bindfs missing, please install the plugin with this command:\nvagrant plugin install vagrant-bindfs"
    else
      wordpress_sites.each_pair do |name, site|
        config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs'
        config.bindfs.bind_folder nfs_path(name), remote_site_path(name, site), u: 'vagrant', g: 'www-data', o: 'nonempty'
      end
    end
  end

  if Vagrant::Util::Platform.windows?
    config.vm.provision :shell do |sh|
      sh.path = File.join(ANSIBLE_PATH, 'windows.sh')
      sh.args = [Vagrant::VERSION]
      sh.keep_color = true
    end
  else
    config.vm.provision :ansible do |ansible|
      ansible.playbook = File.join(ANSIBLE_PATH, 'dev.yml')
#      ansible.verbose = 'vvvv'
      ansible.groups = {
        'web' => ['default'],
        'development' => ['default']
      }

      ansible.extra_vars = {'vagrant_version' => Vagrant::VERSION}
      if vars = ENV['ANSIBLE_VARS']
        extra_vars = Hash[vars.split(',').map { |pair| pair.split('=') }]
        ansible.extra_vars.merge(extra_vars)
      end
    end
  end

  # Virtualbox settings
  config.vm.provider 'virtualbox' do |vb|
    vb.name = config.vm.hostname
    vb.customize ['modifyvm', :id, '--cpus', cpus]
    vb.customize ['modifyvm', :id, '--memory', memory]

    # Fix for slow external network connections
    vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
    vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
  end

  # VMware Workstation/Fusion settings
  ['vmware_fusion', 'vmware_workstation'].each do |provider|
    config.vm.provider provider do |vmw, override|
      vmw.name = config.vm.hostname
      vmw.vmx['numvcpus'] = cpus
      vmw.vmx['memsize'] = memory
    end
  end

  # Parallels settings
  config.vm.provider 'parallels' do |prl, override|
    prl.name = config.vm.hostname
    prl.cpus = cpus
    prl.memory = memory
  end

end

def local_site_path(site)
  File.expand_path(site['local_path'], ANSIBLE_PATH)
end

def nfs_path(site_name)
  "/vagrant-nfs-#{site_name}"
end

def post_up_message
  msg = 'Your Trellis Vagrant box is ready to use!'
  msg << "\n* Composer and WP-CLI commands need to be run on the virtual machine."
  msg << "\n* You can SSH into the machine with `vagrant ssh`."
  msg << "\n* Then navigate to your WordPress sites at `/srv/www`."

  msg
end

def remote_site_path(site_name, site)
  "/srv/www/#{site_name}/#{site['current_path'] || 'current'}"
end

Please note, if you are using Homestead or a different Vagrantfile format, we
may be unable to assist with your issue. Try to reproduce the issue using a
vanilla Vagrantfile first.

Debug output

https://gist.github.com/rpkoller/ed9bf4f6d3d1f01b93b29d573897e4a0

Expected behavior

The vagrant plugins should be recognized and vagrant up should fire up the VM.

Actual behavior

With 1.8.7 I had the the curl issue like everybody else. I've upgraded with the dmg to 1.9. After the update i ran vagrant -v which properly returned Vagrant 1.9.0.. Afterwards I tried to fire up a Trellis install with vagrant up. But got the following output instead:

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

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-vbguest (> 0)'

The exact same output comes with the drupalvm install.

Steps to reproduce

  1. Update to Vagrant 1.9.0
  2. Run vagrant up

If you need any further informations let me know. Thanks Ralf

Most helpful comment

@rpkoller it looks to be an issue with the Vagrantfile you are using. Try going to your home directory and running the command there.

All 16 comments

The plugin system within vagrant was updated in 1.9.0 and plugins need to be reinstalled after installation of vagrant 1.9.0. As the message output notes, vagrant can remove existing plugins and attempt to re-install them using: vagrant plugin expunge --reinstall. Cheers!

thanks for the fast reply @chrisroberts ! But i tried the suggested step reinstalling with vagrant plugin expunge --reinstall right now (over read it) and it gives me:

vagrant-hostmanager missing, please install the plugin with this command:
vagrant plugin install vagrant-hostmanager

:/

p.s. did a quick debug for the command: https://gist.github.com/rpkoller/6eeca47ab05784f8399425ccb70771f9

@rpkoller it looks to be an issue with the Vagrantfile you are using. Try going to your home directory and running the command there.

@chrisroberts thank you thank you thank you!!! that did the trick. plugins reinstalled flawlessly and the bootup in the particular vm works now again too. curl is also back to normal. ;) THANKS!

@chrisroberts it'd be great to add this info to the error information - running from home directory does the trick

I had the same problem after upgrading vagrant to 1.9.1 I got

✗ vagrant info    
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

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-vsphere (> 0)'

✗ vagrant plugin expunge --reinstall

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [Y/N]:Y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'mini_portile' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-triggers (> 0)'

running the same command from home solved the problem

~ vagrant plugin expunge --reinstall

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [Y/N]:Y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.

Hit this just now - I expunged plugins from my home directory, when I go into the directory with my Vagrantfile I keep getting the same error.

```$ vagrant up
Installing Vagrant plugin vagrant-cucumber
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-share (> 0)'
```

Update
Fixed this myself by manually running vagrant plugin install vagrant-cucumber

I kept receiving a similar error with plugin vagrant-login. I finally was able to get past it by uninstalling vbguest: vagrant plugin uninstall vagrant-vbguest

I still have this issue when trying to install plugin 'vagrant-disksize', but this may be due to an outdated plugin.

$ vagrant plugin install vagrant-disksize
Installing the 'vagrant-disksize' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-bindfs (= 0.4.14)'

I ended up adding

vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-share
vagrant plugin install vagrant-hostmanager

and then running
vagrant plugin expunge --reinstall

that was after getting this message

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'vagrant-bindfs' plugin. This can take a few minutes...
Fetching: vagrant-bindfs-1.0.9.gem (100%)
Fetching: vagrant-hostmanager-1.8.7.gem (100%)
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.0.gem (100%)
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-hostmanager (= 1.8.5)'

After adding the other dependencies I was able to expunge

➜  Configs vagrant plugin expunge --reinstall

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [N]: y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'vagrant-bindfs' plugin. This can take a few minutes...
Fetching: vagrant-bindfs-1.0.9.gem (100%)
Fetching: vagrant-hostmanager-1.8.7.gem (100%)
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.0.gem (100%)
Installed the plugin 'vagrant-bindfs (1.0.9)'!
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Installed the plugin 'vagrant-hostmanager (1.8.7)'!
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vbguest (0.15.0)'!
➜  Configs

tried what you suggest

Sathias-iMac2-819:~ sathia$ vagrant plugin expunge --reinstall

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [N]: Y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'vagrant-gatling-rsync' plugin. This can take a few minutes...
Fetching: vagrant-gatling-rsync-0.9.0.gem (100%)
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.0.gem (100%)
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-vbguest (= 0.13.0)'
Sathias-iMac2-819:~ sathia$

Vagrant version is 2.0.0

@sathio I received that error as well. What ended up working for me was to uninstall/expunge all plugins without auto-reinstalling them. Afterwards, when I ran vagrant up the required plugins were successfully re-installed.

Replying because this is the first relevant issue I found when Googling.

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Unable to resolve dependency: user requested 'vagrant-vbguest (= 0.13.0)'


Ashrafs-MBP: debugacademy.com ashrafabed$ vagrant plugin expunge
Would you like Vagrant to attempt to reinstall current plugins? [N]: n

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [N]: y

All user installed plugins have been removed from this Vagrant environment!


Ashrafs-MBP: debugacademy.com ashrafabed$ cd academyvm/

Ashrafs-MBP:academyvm ashrafabed$ vagrant up
Installing plugin vagrant-vbguest
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.1.gem (100%)
Installing plugin vagrant-hostsupdater
Fetching: vagrant-hostsupdater-1.0.2.gem (100%)
`vagrant up` must be re-run now that plugins are installed

@ashabed, this worked for me as well. Thanks for suggesting it.

@Artistan this worked for me as well

I'm coming from the Windows WSL world with Ubuntu. If you're using something like trellis for WordPress development, then you have to install plugins in both: WSL AND Windows using PowerShell.

  1. vagrant plugin install vagrant-vbguest
  2. vagrant plugin install vagrant-hostmanager

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings