画竜点睛を衝く@mapyo

日々やった事をつらつらと書くブログです

vagrantで共有フォルダがmountされない時にゴニョゴニョやったメモ(無駄な作業あり)

vagrant upしても共有フォルダがmountされなくなった。。。

Vagrant 1.3.4 

以下は導入済み

vagrant plugin install vagrant-vbguest

起動時のメッセージ

[web] Booting VM...
[web] Waiting for machine to boot. This may take a few minutes...
[web] Machine booted and ready!
GuestAdditions 4.2.16 running --- OK.
[web] Setting hostname...
[web] Configuring and enabling network interfaces...
No error message

正常に起動しているっぽいvmのメッセージ

[hogehoge] Booting VM...
[hogehoge] Waiting for machine to boot. This may take a few minutes...
[hogehoge] Machine booted and ready!
Ghogehogedditions 4.2.16 running --- OK.
[hogehoge] Setting hostname...
[hogehoge] Configuring and enabling network interfaces...
[hogehoge] Mounting shared folders...
[hogehoge] -- /vagrant

見比べてみると。。。

No error messageが。。。 Mounting shared folders出来ていないっぽい。 その部分で何らかの状態が起きてエラーメッセージ出さずに落ちている。

適当にググって見つけた内容を試してみる

http://blog.mizoshiri.com/archives/1390 ここを参考にする。

vboxのリビルドをしているっぽい。

$ vagrant ssh web
[vagrant@local ~]$ 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                         [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
You should restart your guest to make sure the new modules are actually used

再度halt&up

$ vagrant halt web
$ vagrant up web

[web] Booting VM...
[web] Waiting for machine to boot. This may take a few minutes...
[web] Machine booted and ready!
GuestAdditions 4.2.16 running --- OK.
[web] Setting hostname...
[web] Configuring and enabling network interfaces...
No error message

なんだとっ!!!

ログを出力して調査してみる

http://d.hatena.ne.jp/tbpg/20131115/1384543585 vagrant up 時にログを出力させてみる

VAGRANT_LOG=debug vagrant up web

ログが激しく出まくって何がなんやら。。。 いろいろ見てみると、

DEBUG ssh: stdout: Error, some other host already uses address 192.168.0.101

エラーの1つの既にこのIP使われているよって感じのやつがあったので、 別のvagrantが起動していた!ので落とす。

上手く動くようになった!

それだけだったのか!!!!

結論

適当に当たりをつけるんじゃなくて、ログを出して調べましょう。

最後に

vagrant plugin uninstall vagrant-vbguest 

何となくこれをやった。