発生したエラー
vagrantでCentOS7.4を起動したところ、下記の"vboxsf" is not availableエラーが出る。
$ vagran init bento/centos-7.4
$ vagrant up
...
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=1000,gid=1000 opt_app /opt/app
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
対処方法
ホストOSから、下記のコマンドを実行してゲストOSのLinuxカーネルを更新する。
(kernelのアップデートは失敗するとvagrantの起動ができなくなるリスクがあるので、失敗しても良い環境で一度試す)
vagrant ssh -c "sudo yum -y update kernel"
その後、ゲストOSを再起動すればOK。
vagrant reload
vagrant ssh -c "mount | grep vboxsf"
こちらもおススメ