hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.16k stars 4.43k forks source link

Vagrant upgrade always breaks plugins #13180

Closed giner closed 1 year ago

giner commented 1 year ago

Vagrant upgrade always breaks plugins and given by Vagrant suggestions on how to fix the issue (vagrant plugin repair, vagrant plugin expunge --reinstall or vagrant plugin update) don't work

Non-obvious workarounds:

Debug output

...
DEBUG manager: Enabling localized plugins
 INFO manager: Plugins:
 INFO manager:   - vagrant-disksize = [installed: 0.1.3 constraint: > 0]
DEBUG solution_file: new solution file instance plugin_file=/.vagrant/plugins.json solution_file=/.vagrant/bundler/local.sol
DEBUG solution_file: reading solution file - /.vagrant/bundler/local.sol
DEBUG solution_file: solution validation check CHECKSUM 01cae3e6caeaed66f9cd0df775ce05f32edb80658f44c9d084c24c5980827295 <-> 01cae3e6caeaed66f9cd0df775ce05f32edb80658f44c9d084c24c5980827295 VERSION 2.3.6 <-> 2.3.4
DEBUG bundler: solution file in use for init: <Vagrant::Bundler::SolutionFile:/.vagrant/plugins.json:/.vagrant/bundler/local.sol:invalid>
DEBUG bundler: Generating new builtin set instance.
DEBUG bundler: Generating new plugin set instance. Skip gems - []
DEBUG bundler: generating solution set for configured plugins
DEBUG bundler: Current generated plugin dependency list: [<Gem::Dependency type=:runtime name="vagrant-disksize" requirements="= 0.1.3">]
DEBUG bundler: resolving solution from available specification set
ERROR manager: Plugin initialization error - Gem::UnsatisfiableDependencyError: Unable to resolve dependency: user requested 'vagrant-disksize (= 0.1.3)'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:233:in `search_for'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:288:in `block in sort_dependencies'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:282:in `each'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:282:in `sort_by'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:282:in `with_index'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:282:in `sort_dependencies'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:288:in `push_initial_state'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:210:in `start_resolution'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:168:in `resolve'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:43:in `resolve'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/resolver.rb:190:in `resolve'
DEBUG manager: /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/request_set.rb:411:in `resolve'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/lib/vagrant/bundler.rb:301:in `init!'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/lib/vagrant/plugin/manager.rb:102:in `bundler_init'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/lib/vagrant/plugin/manager.rb:69:in `localize!'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/lib/vagrant/environment.rb:180:in `initialize'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/bin/vagrant:211:in `new'
DEBUG manager: /opt/vagrant/embedded/gems/gems/vagrant-2.3.6/bin/vagrant:211:in `<main>'
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::PluginInitError: 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:
...

Expected behavior

An upgraded or downgraded version of Vagrant handles update of plugins is necessary

Actual behavior

Vagrant fails on checking dependencies and gives suggestions how to fix the issue which don't work

Reproduction information

Vagrant version

Vagrant 2.3.6

Host operating system

Ubuntu 22.04

Guest operating system

Irrelevant

Steps to reproduce

  1. Install Vagrant 2.3.4 show status
dpkg -i vagrant_2.3.4-1_amd64.deb
vagrant status
  1. Install plugin on request
Vagrant has detected project local plugins configured for this
project which are not installed.

  vagrant-disksize
Install local plugins (Y/N) [N]: y
Installing the 'vagrant-disksize' plugin. This can take a few minutes...
Fetching vagrant-disksize-0.1.3.gem
Installed the plugin 'vagrant-disksize (0.1.3)'!

Vagrant has completed installing local plugins for the current Vagrant
project directory. Please run the requested command again.
  1. Upgrade Vagrant to 2.3.6 and show status
dpkg -i vagrant_2.3.6-1_amd64.deb
vagrant status
  1. Output
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)'

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/jammy64"
  config.vagrant.plugins = ["vagrant-disksize"]
end
chrisroberts commented 1 year ago

Hi there,

Thanks for reporting this issue. I have some work in progress on this that I am hoping to have included in the next release. Closing this issue as a duplicate of #13029.

Cheers!