FS#75660 - [vagrant] Missing Dependency 'delegate'

Attached to Project: Community Packages
Opened by Jared Baldridge (jrb) - Sunday, 21 August 2022, 18:25 GMT
Last edited by Jonathan Steel (jsteel) - Saturday, 24 September 2022, 07:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jonathan Steel (jsteel)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

After upgrading from vagrant 2.2.19-2 to vagrant 2.3.0-2, vagrant is unable to find the 'delegate' gem and immediately exits.

Additional info:
* vagrant 2.3.0-2

Steps to reproduce:
1) Install vagrant 2.3.0-2
2) Attempt to run any vagrant command
3) Watch ruby exit with:

$ vagrant
/usr/lib/ruby/3.0.0/rubygems/specification.rb:1453:in `rescue in block in activate_dependencies': Could not find 'delegate' (>= 0) among 99 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/opt/vagrant/embedded/gems/2.3.0' at: /usr/lib/ruby/gems/3.0.0/specifications/weakref-0.1.1.gemspec, execute `gem env` for more information
from /usr/lib/ruby/3.0.0/rubygems/specification.rb:1450:in `block in activate_dependencies'
from /usr/lib/ruby/3.0.0/rubygems/specification.rb:1439:in `each'
from /usr/lib/ruby/3.0.0/rubygems/specification.rb:1439:in `activate_dependencies'
from /usr/lib/ruby/3.0.0/rubygems/specification.rb:1421:in `activate'
from /usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb:68:in `block in gem'
from /usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb:68:in `synchronize'
from /usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb:68:in `gem'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:73:in `require'
from /opt/vagrant/embedded/gems/2.3.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/active_call.rb:16:in `<top (required)>'
from /opt/vagrant/embedded/gems/2.3.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc.rb:25:in `require_relative'
from /opt/vagrant/embedded/gems/2.3.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc.rb:25:in `<top (required)>'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb.rb:4:in `<top (required)>'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/kernel_v2/config/vm.rb:17:in `<top (required)>'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/kernel_v2/plugin.rb:39:in `block in <class:Plugin>'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/registry.rb:27:in `get'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/registry.rb:49:in `block in each'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/registry.rb:48:in `each'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/registry.rb:48:in `each'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/config/v2/root.rb:46:in `finalize!'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/config/v2/loader.rb:21:in `finalize'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/config/loader.rb:200:in `load'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/vagrantfile.rb:31:in `initialize'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/environment.rb:817:in `new'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/environment.rb:817:in `vagrantfile'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/environment.rb:998:in `process_configured_plugins'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/environment.rb:189:in `initialize'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/bin/vagrant:211:in `new'
from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/bin/vagrant:211:in `<main>'
This task depends upon

Closed by  Jonathan Steel (jsteel)
Saturday, 24 September 2022, 07:27 GMT
Reason for closing:  Fixed
Comment by Massimiliano Torromeo (mtorromeo) - Monday, 22 August 2022, 07:42 GMT
This broke with the de-vendoring of ruby-delegate in ruby-3.0.4-7

Also, ruby-3.0.4-6 broke the vagrant-libvirt plugin:
```
❯ vagrant up
[fog][DEPRECATION] Unable to require fog/libvirt/compute
[fog][DEPRECATION] Falling back to deprecated path fog/compute/libvirt. The preferred file path format has changed from service/provider to provider/service. Please update this service provider to use the preferred format.
[fog][WARNING] Error while loading provider libvirt: cannot load such file -- fog/compute/libvirt
Error while connecting to Libvirt: libvirt has no compute service
```

Downgrading to ruby-3.0.4-5 works fine. Not sure if there is something to fix in the vagrant package due to the de-vendoring of multiple libraries in ruby or if this is purely a ruby issue.
Comment by Jonathan Steel (jsteel) - Tuesday, 23 August 2022, 07:09 GMT
I'm afraid I cannot replicate this issue. I did just fix something else in 2.3.0-3, so could you try that in case it is related and if you continue to have an issue, find a way that I might be able to replicate this, eg what plugins have you got installed?

[edit] Sorry just noticed my ruby is a little behind, I'm updating now and will re-test this [/edit]

[edit] Yes I can replicate this with the latest ruby [/edit]
Comment by Jonathan Steel (jsteel) - Tuesday, 23 August 2022, 07:27 GMT
Please try 2.3.0-4 and check this resolves the issues mentioned here. If that looks good, I think we should just get this dependency added to the vagrant.gemspec file upstream.
Comment by Massimiliano Torromeo (mtorromeo) - Tuesday, 23 August 2022, 07:46 GMT
The delegate issue is resolved but vagrant-libvirt is still not working.

To reproduce the error you just need to `vagrant plugin install vagrant-libvirt` and try starting a libvirt box. E.g.:

vagrant init almalinux/8
vagrant up --provider libvirt

It will fail right after fetching the box image.
Comment by Massimiliano Torromeo (mtorromeo) - Tuesday, 23 August 2022, 08:01 GMT
I modified the libvirt plugin to not suppress some exceptions and found this error that was getting masked: "Could not find 'cgi' (>= 0) among 120 total gem(s) (Gem::MissingSpecError)"

This matches with what was de-vendored in ruby-3.0.4-6.
Comment by Massimiliano Torromeo (mtorromeo) - Tuesday, 23 August 2022, 08:08 GMT
I just did a rebuild of vagrant adding cgi to the installed gems and confirmed that it was the only missing dependency.

These issues are very weird though since both ruby-delegate and ruby-cgi are installed on the system and I would think they should be found by vagrant...

Comment by Jared Baldridge (jrb) - Tuesday, 23 August 2022, 13:43 GMT
2.3.0-4 resolves issues with Vagrant itself.

The broken `cgi` dependency in `vagrant-libvirt` probably needs to be mitigated by `fog` adding it as a dependency, instead of directly adding it to the `vagrant` package.

A workaround I found is to use `vagrant plugin install cgi` to manually install the gem along side the `vagrant-libvirt` gem that depends on it.
Comment by Jonathan Steel (jsteel) - Tuesday, 23 August 2022, 14:08 GMT
Vagrant doesn't use the system gems, so I've added cgi to the vagrant installation, please try 2.3.0-5.
Comment by Massimiliano Torromeo (mtorromeo) - Tuesday, 23 August 2022, 15:51 GMT
2.3.0-5 works fine, thanks!

> The broken `cgi` dependency in `vagrant-libvirt` probably needs to be mitigated by `fog` adding it as a dependency

I am no ruby expert but isn't stdlib, and consequently cgi, just expected to be present?

Loading...