あいつの日誌β

働きながら旅しています。

vagrant で遭遇したエラーまとめ

自分のためにまとめた

vagrant up でエラー

vagrant up すると以下のエラーが表示される

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

たぶんこうなっている

$ sudo /etc/init.d/vboxadd setup
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.el6.x86_64

Building the main Guest Additions module                   [失敗]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [  OK  ]

解決方法

http://little-braver.com/536/ こちらを参考にしました。

Vagrantvagrant-vbguest を使ってたら共有フォルダのマウントに失敗している模様。

% vagrant ssh
$ sudo yum -y update kernel
$ yes | sudo yum -y install kernel-devel kernel-headers dkms gcc gcc-c++
$ exit
% vagrant halt
% vagrant up

provision しようとするとエラー

site-cookbooks がゲストOSに転送されていない

config.berkshelf.enabled = false にしないと Vagrant Berkshelf plugin が有効にならないらしい...

provision しようとするとエラー2

Guest-specific operations were attempted on a machine that is not
ready for guest communication. This should not happen and a bug
should be reported.

vagrant reload すると動作した(これ、ちょっとよく原因わかっていない)

provision しようとするとエラー3

Shared folders that Chef requires are missing on the virtual machine.
This is usually due to configuration changing after already booting the
machine. The fix is to run a `vagrant reload` so that the proper shared
folders will be prepared and mounted on the VM.

バグらしいので下記で回避

% rm .vagrant/machines/default/virtualbox/synced_folders
% vagrant reload --provision