急にvagrantのフォルダがmountできなくなった時があった。
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 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
それまでの設定は、
config.vm.synced_folder "./", "/vagrant", type: "virtualbox"
type: 'virtualbox'
を外すと、ファイルをローカルで編集した時に、その変更が反映されないから、この方法は個人的には使えない。
いろんなサイトにあるように、kernelに原因がある例があったことからアップデートをしたり、
sudo yum update -y kernel
vbguestのプラグインをインストールしたり
vagrant plugin install vagrant-vbguest
mountオプションを加えたり
config.vm.synced_folder "./", "/vagrant", type: "virtualbox", mount_options: ['dmode=777','fmode=755']
VirtualBoxの最新版にバグがあるっぽいので、
https://www.virtualbox.org/wiki/Downloads
Update Nov 3 2017: The Guest Additions image with the 5.2.0 release had problems with a number of Linux guest systems. Please try this image which we believe fixes several of these.
新しいイメージも試そうと色々試した。
再度、vagrantのドキュメントのページに行き、他のtypeを試してみる。今回はnfs。
config.vm.synced_folder "./", "/vagrant", type: "nfs"
あ、できた。