Open D4d0s opened 5 months ago
Please fix it.
For anyone looking for a fix, see this fork: https://github.com/dheerapat/vagrant-vbguest
For anyone looking for a fix, see this fork: https://github.com/dheerapat/vagrant-vbguest
Works on my machine (Ubuntu 24.04, Vagrant 2.4.2, VirtualBox 7.0.16)!
I can confirm that this behavior reproduces with Vagrant 2.4.3, during a vagrant up
operation, when it tries to install the Guest Additions for VirtualBox 7.0.22:
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 6.1.18
default: VirtualBox Version: 7.0
==> default: Attempting graceful shutdown of VM...
==> default: Destroying VM and associated drives...
C:/Users/z003txkv/.vagrant.d/gems/3.3.6/gems/vagrant-vbguest-0.32.0/lib/vagrant-vbguest/hosts/virtualbox.rb:84:in 'block in guess_local_iso': undefined method 'exists?' for class File (NoMethodError)
path && File.exists?(path)
^^^^^^^^
[...]
FATAL vagrant up failed
Guest OS is CentOS 7.
rismanma1 commented 12 hours ago I can confirm that this behavior reproduces with Vagrant 2.4.3, during a
vagrant up
operation, when it tries to install the Guest Additions for VirtualBox 7.0.22:
I suppose this means that we cannot use Vagrant 2.4.3 or higher (and I think 2.4.2 either) with this vbguest plugin any longer, unless we edit the plugin's code (to remove the "exists" call)?
This isn't a vagrant issue this is a deprecated call that is now removed from newer ruby 3.x versions. This essentially is a bug in the plugin and since the owner has archived the repo for the plugin I don't see it getting fixed anytime soon. you'll have to either fork it and update the plugin yourself or use someone else's fork that fixed it like @dangra mentioned he created a few comments back.
Just to clarify, the fork isn't mine but @dheerapat's who I don't know. I checked his fork and the commits were sane as of today.
My approach to ship the fix for my dev environment is to compile the gem and distribute it along the Vagrantfile like in:
# vagrant-vbguest plugin workaround for https://github.com/dotless-de/vagrant-vbguest/issues/332
ENV["VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT"] = "1"
Vagrant.configure('2') do |config|
# the official vagrant-vbguest plugin was archived, it fails to run on ruby 3.2+.
# The gem referenced here was compiled from https://github.com/dheerapat/vagrant-vbguest
config.vagrant.plugins = {
'vagrant-vbguest' => {
'sources' =>[
'vagrant-vbguest-0.32.1.gem',
'https://rubygems.org/', # needed but used
],
}
}
# ... the rest of your vagrant file
end
dheerapat/vagrant-vbguest works for me with:
Debug output
Expected behavior
Vagrant up bring up a vm
Actual behavior
vagrant fails bringing up a vm when is trying to update vbguest
Reproduction information
Vagrant version
Vagrant 2.3.7
Host operating system
opensuse tumbleweed VERSION=20240521
Guest operating system
Centos7 (a box of)
Steps to reproduce
So i fixed it by editing the file /usr/share/vagrant/gems/gems/vagrant-vbguest-0.32.0/lib/vagrant-vbguest/hosts/virtualbox.rb:
The NoMethodError give me the clue. And the ^^^^^ :-) Is easy to fix but it is annoying anyway.
1. 2. 3.
Vagrantfile