ある日、vagrant upするとエラーが出るようになっていました。
環境
Vagrant 1.9.5
VirtualBox 5.1.22 r115126 (Qt5.6.2)
CentOS 6.8 (ゲストOS)
macOS Sierra 10.12.5
現象
vagrant upすると、最後にこんなエラーが出てしまいます。
1 2 3 4 5 6 7 8 9 10 11 12 |
Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was: mount -t vboxsf -o uid=500,gid=500 vagrant /vagrant The error output from the command was: /sbin/mount.vboxsf: mounting failed with the error: No such device |
原因
yum updateでカーネルをアップデートしたことで、VitualBoxのGuestAdditionが動かなくなってしまったようです。
参考:Vagrant: vagrant-vbguest プラグインで仮想マシンの Guest Additions を最新に保つ | CUBE SUGAR CONTAINER
参考:Failed to mount folders in Linux guest. This is usually because the “vboxsf” file system is not available.を直す方法 | Qiita
解決方法
vagrant-vbguestプラグインをインストールします。
1 2 3 4 5 |
$ vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Fetching: micromachine-2.0.0.gem (100%) Fetching: vagrant-vbguest-0.14.2.gem (100%) Installed the plugin 'vagrant-vbguest (0.14.2)'! |
次に、vagrant vbguestを実行します。
1 |
$ vagrant vbguest |
終わったら、次のコマンドでOKになれば成功です!
1 2 |
$ vagrant vbguest --status [default] GuestAdditions 5.1.22 running --- OK. |
最後にreloadします。
1 |
$ vagrant reload |
これでエラーが出なくなりました!