运行vagrant up的时候遇到错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
==> default: Mounting shared folders...
default: /vagrant => /Users/mazhibin/project/learn/vagrant/ubuntu
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

stdin: is not a tty
mount: unknown filesystem type 'vboxsf'

这是在vagrant尝试挂载共享文件夹时遇到了问题,这个一般是box里的VirtualBox Guest Additions插件版本不对,可以使用vagrant-vbguest这个vagrant插件,来保证插件总是最新。

安装vagrant插件:

1
$ vagrant plugin install vagrant-vbguest

安装过程中会有些黄字错误,那个不用管,没影响。

安装完后不需要任何配置,再次vagrant upvagrant-vbguest就会自动更新系统里的VirtualBox Guest Additions了。

enjoy it!

参考资料