edo1z blog

プログラミングなどに関するブログです

Vagrant mountエラー2

以前、mountエラーがあったときに、Vagrant mountエラーここに書いた方法で解決できたが、これをやっても解決できない。

vagrant reloadしても下記エラーがでる。

Failed to mount folders in Linux guest. This is usually beacuse 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


あと、もう一つ解決策がのってた。 vagrantでmountエラーの解決方法

vboxをリビルドする必要があるということで、vagrant sshして、下記を実行する。

sudo /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                         [失敗]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [  OK  ]

exit

でも、これは以前の解決策でも、vagrant reload中に勝手に実行してくれる内容と一緒っぽい。上記は、Building the main Guest Additions moduleが成功しているが、現在自分の環境だと失敗する。

下記で、ログを見ると下記のようになっている。

vi /var/log/vboxadd-install.log

Creating user for the Guest Additions. Creating udev rule for the Guest Additions kernel module. /tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

もう一つ、解決策につながりそうなサイトがあった。 ヾ(o゚ω゚o)ノ゙Vagrantの共有ディレクトリ設定でものすっごい躓いた!

vagrant-vbguestというプラグインがあると、vbguestコマンドが使えるようになる。

$ vagrant vbguest --status
GuestAdditions versions on your host (4.3.6) and guest (4.3.4) do not match.
$ vagrant vbguest --auto-reboot

これでも、Building the main Guest Additions module[FAILED]になる。

参考:CentOSへGuest Additionsをインストールしたときのエラー対処方法

カーネルと必要なパッケージをインストールします。

$ yum -y update kernel
$ yum -y install kernel-devel kernel-headers dkms gcc gcc-c++

インストール後にOSを再起動します。

これで、vagrant reloadしたらmountエラーがなくなった。