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
原因はカーネルがバージョンアップしてしまい、buildディレクトリのリンクが切れてしまっているのかなぁ。
以下のコマンドで解決。
$ vagrant ssh
$ uname -r
$ ls -ltr /lib/modules/
$ sudo yum install ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.7/x86_64/updates/security/kernel-devel-2.6.32-573.12.1.el6.x86_64.rpm
ここまでで、カーネルがインストールされる。
このあと、リンク切れを確認する。
$ cd /lib/modules/2.6.32-358.23.2.el6.x86_64/
$ ls -ltr
のちに、下記のような表示で、リンク元が点滅しているのがわかる。
lrwxrwxrwx. 1 root root 51 Jan 17 2014 build -> ../../../usr/src/kernels/2.6.32-358.23.2.el6.x86_64
このリンクを張り替えてあげればおけ。
$ mv build build.org
$ ln -s /usr/src/kernels/2.6.32-573.12.1.el6.x86_64 build
張り替え完了。
これでvagrantの再起動を行えば解決。
※ ディレクトリ階層がひとによって違うようでしたら申し訳ないです。
以上!!!!