発生原因
とりあえずvagrantでVM起動して yum update
からでしょってんでupdateかけると
次回からvagrant up
した時にこんなかんじのメッセージが表示されて、共有ディレクトリのマウントに失敗したりする。(起動自体は成功してSSHで入れる)
原因は多分なんかのkernel系パッケージのversionが上がったからだと思う。あとこれ起こるのVirtualBox環境かだけかも
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
復旧方法(ゲストOSでの作業)
で、調べてみると「ゲストOS側」でこのコマンド使うと復旧できるっぽい
$ /etc/init.d/vboxadd setup
実行してみるけど失敗する
$ /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.17.1.el6.x86_64
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 ]
yumでパッケージ入れろと指示が出てるから実行してからもう一度チャレンジ
今度は成功、ゲストOSでの作業はここまで
$ yum install -y kernel-devel-2.6.32-431.17.1.el6.x86_64
$ /etc/init.d/vboxadd setup
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module [ OK ]
Building the shared folder support module [ OK ]
Building the OpenGL support module [ OK ]
Doing non-kernel setup of the Guest Additions [ OK ]
Starting the VirtualBox Guest Additions [ OK ]
あとはvagrant halt
してvagrant up
してやればいつもの様にマウントされるはず