I'm creating a Red Hat Enterprise Linux 7 VM in VirtualBox with vagrant. If I have a base box that both doesn't have the VirtualBox guest additions, and isn't registered, then I'd manually need to do the following:
The reason that I'd need to perform registration first, is that to install guest additions, I'd need to install some extra packages.
Now, there are 3rd-party vagrant plugins for both of these tasks: vagrant-registration and vagrant-vbguest.
The issue that I'm having is that the vagrant-vbguest
plugin will always try to run first, and will fail to download the packages that it needs, because the vagrant-registration
plugin hasn't yet had a chance to register the system.
Is there a way to force one of them to be run before the other? Or any other alternative solution that I haven't thought of yet (I'm not a vagrant wizard (or is that just called a vagrant?) yet)?
vagrant-vbguest is a Vagrant plugin which automatically installs the host's VirtualBox Guest Additions on the guest system.
Updating. Plugins can be updated by running vagrant plugin update . This will update every installed plugin to the latest version. You can update a specific plugin by calling vagrant plugin update NAME .
in the spirit of my comments but it should be in a more automatic way
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vbguest.auto_update = false
if Vagrant.has_plugin?("vagrant-registration")
system "vagrant vbguest --auto-reboot --no-provision" if ARGV[0] == 'up'
end
not sure though that it will run in the correct order (did not try myself)
Edit the issue with this code is that it will try to run the vbguest right when the command is launched so before the vm is running so vbguest cannot install the necessary libs.
the other possibility I see is to use the vagrant trigger plugin (https://github.com/emyl/vagrant-triggers), you can define to run specific script after specific command has been run
config.vbguest.auto_update = false
config.trigger.after :up do
run "vagrant vbguest --auto-reboot --no-provision"
end
the vbguest is correctly run after the machine is booted (so I am assuming after vagrant-registration did its own stuff)
the output (interesting part) of running vagrant up
:
==> default: Machine booted and ready!
==> 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: 4.2.0
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => /Users/fhenri/project/examples/vagrant/precise
==> default: Running triggers after up...
==> default: Executing command "vagrant vbguest --auto-reboot --no-provision"...
==> default: GuestAdditions versions on your host (4.3.16) and guest (4.2.0) do not match.
installation of the guest additions goes on and machine rebooted ok
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With