我有以下流浪文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = 4
#storage
end
config.vm.provision "shell",
path: "vagrant_files/setup_script.sh"
config.vm.provision :reload
config.vm.provision "shell",
path: "vagrant_files/setup_script_2.sh"
config.vm.provision :reload
config.vm.provision "shell",
path: "vagrant_files/setup_script_3.sh"
config.vm.synced_folder ".", "/vagrant"
end
在我的设置 setup_script 我有 vagrant install Virtual Box Guest Additions 这是让同步文件夹功能为 vagrant 工作的要求。
不幸的是,即使我将同步文件夹的行放在 Vagrantfile 的最后,它仍然会首先尝试执行该任务,从而导致错误:
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:
mount: unknown filesystem type 'vboxsf'
我知道我需要先安装 Virtual Box Guest Additions。还有其他人遇到这个问题吗?你们都是怎么解决这个问题的?