プログラマーの調べ物

プログラマーが調べ物をするときに役に立つサイトを作ります。

vagrant upを実行したら"VirtualBox is complaining that the kernel module is not loaded."というエラーが出た

vagrant upでエラーが出た。

VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.

指示通りにrootで

VBoxManage --version

を実行。 すると、以下のようなメッセージが出現した。

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.10.0-514.el7.x86_64) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.
5.1.22r115126
/sbin/vboxconfig

を実行すると、以下のようなモジュールをインストールせい、と怒られた。

This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

  yum install kernel-devel-3.10.0-514.el7.x86_64
(The last command may fail if your system is not fully updated.)
  yum install kernel-devel
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

  yum install kernel-devel-3.10.0-514.el7.x86_64
(The last command may fail if your system is not fully updated.)
  yum install kernel-devel

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.

yumでインストール。

# yum install kernel-devel-3.10.0-514.el7.x86_64

インストール後にもう一度vboxconfigを実行すると、リビルドしてくれたっぽい。

# /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.

次にvagrant upすると別のエラーが出た。

No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.

とりあえずVirtualBoxをremoveして、バージョンを下げて入れ直してみる。

# yum remove VirtualBox-5.1
# yum update
# yum install VirtualBox-4.3

やっとvagrant upが通った…。