解決方法
$ vagrant ssh
でマシンに接続。
/etc/yum.conf
にexclude=kernel*
があればコメントアウト。
その後、
$ sudo yum -y update kernel
$ sudo yum -y install kernel-devel
そして、vagrant reload
で再起動。
以上で、カーネルが新しくなりvirtual box guest additionsがビルドされるはずです。
概要
- vagrant-vbguest pluginをインストールしている
- CentOSのvirtual box用vagrant boxを使用している
以上の条件下でvagrant up
すると
Building the main Guest Additions module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.18. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Restarting VM to apply changes...
というエラーが出力され
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
共有フォルダをマウントするところでこのエラーが出力される。
原因
- virtualbox guest additionsのビルドに失敗しているのが原因
- virtualbox guest additionsのビルドにはkernelソースが必要
- CentOSにはkernelソースがインストールされていない
- その結果、ビルドが失敗する
- yumでkernelをアップデートしてkernel_develをインストールすればよい
感想
vagrant up
で一発で仮想環境が構築できるとやったぜーと思っているところでエラーが発生すると残念な感じが半端ない。
(組み合わせで発生する問題 なので、vagrantが悪いわけでも、CentOSが悪いわけでも、virtual boxが悪いわけでもないですが。。。)
0 件のコメント:
コメントを投稿