diff --git a/CHANGELOG.md b/CHANGELOG.md index a8534b3c0..d615f41c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.9.4 (unreleased) - Match VM names that have parens, brackets, etc. + - Detect when the VirtualBox kernel module is not loaded and error. [GH-677] ## 0.9.3 (January 24, 2012) diff --git a/lib/vagrant/driver/virtualbox.rb b/lib/vagrant/driver/virtualbox.rb index 10ce51cc0..8a37f4e0b 100644 --- a/lib/vagrant/driver/virtualbox.rb +++ b/lib/vagrant/driver/virtualbox.rb @@ -117,7 +117,12 @@ module Vagrant # Note: We split this into multiple lines because apparently "".split("_") # is [], so we have to check for an empty array in between. - parts = execute("--version").split("_") + output = execute("--version") + if output =~ /vboxdrv kernel module is not loaded/ + raise Errors::VirtualBoxKernelModuleNotLoaded + end + + parts = output.split("_") return nil if parts.empty? parts[0].split("r")[0] end diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 3d3ccc1ff..5e928f07b 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -343,6 +343,11 @@ module Vagrant error_key(:virtualbox_not_detected) end + class VirtualBoxKernelModuleNotLoaded < VagrantError + status_code(70) + error_key(:virtualbox_kernel_module_not_loaded) + end + class VMBaseMacNotSpecified < VagrantError status_code(47) error_key(:no_base_mac, "vagrant.actions.vm.match_mac") diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 65797eb36..59f15b5ba 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -166,6 +166,10 @@ en: listed below to use Vagrant: %{supported_versions} + virtualbox_kernel_module_not_loaded: |- + VirtualBox is complaining that the kernel module is not loaded. Please + run `VBoxManage --version` to see the error message which should contain + instructions on how to fix this error. virtualbox_not_detected: |- Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed. Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires