Vagrant 起動時の共有フォルダ周りで Protocol error

症状

vagrant up で起動時に、共有フォルダを設定するところで、以下のようなエラーとなる。

==> default: Mounting shared folders...
default: /vagrant => /Users/kazu/Documents/workspace/foo
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

環境

  • Host: Mac
  • Guest: Linux (Ubuntu 14.4)
  • Vagrant 2.2.2

原因と解決方法

エラーメッセージでググると、色々な原因でこのエラーが発生しうるが、自分の場合、`/home/vagrant` 以下に `vagrant` という名前で `/vagrant` へのシンボリックエラーがあったのが原因。

vagrant@vagrant-ubuntu-trusty-64:~$ ls -l /home/vagrant/vagrant
lrwxrwxrwx 1 vagrant vagrant 8 Dec 28 15:18 /home/vagrant/vagrant -> /vagrant

このシンボリックリンクを削除して `vagrant reload` で問題は解消した。

Vagrant のこの issue が参考になった。

このエラーがでるその他の可能性

  • VirtualBox Guest Addition が正しくインストールされていない、壊れている
  • 共有フォルダの設定が間違っている
  • などなど

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です