我有以下流浪文件:
# -*- 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安装了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。还有其他人遇到过这个问题吗?你们都是怎么解决这个问题的?
发布于 2016-01-13 07:01:43
这是一个有趣的问题。我使用相同的基本机箱启动了一个CentOS 7虚拟机,如下所示...
vagrant init centos/7
vagrant up...and来宾添加安装失败。以下是Vagrant的相关输出...
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.0.10 - guest version is
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
./install.sh: line 345: bzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
./install.sh: line 358: bzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors因此,这个基本设备没有安装bzip2包,这会导致失败。出于好奇,我创建了一个新的Ubuntu从ubuntu/trusty64基本盒子和来宾添加安装没有任何问题。正如您可能猜到的那样,bzip2包已经安装在Ubuntu中。
我会将其归类为基础框本身的问题。CentOS项目应该将bzip2烘焙到与VirtualBox一起使用的所有Vagrant基框中。
当然,这现在对你没有帮助,但幸运的是你有many more options for CentOS base boxes,我希望他们中的大多数人不会受到这个问题的影响。
发布于 2016-01-20 08:12:08
为了解决我的问题,我只是加载了Centos机器。然后,我继续安装Virtual Box Guest Additions,然后重新打包该计算机
这解决了我的问题。
发布于 2017-02-26 18:10:04
我在https://github.com/mitchellh/vagrant/issues/6769上使用了luvejo tip,它对我也很有效:
你也可以安装vagrant-
插件,这样它就会为你添加VirtualBox来宾插件。
漫游插件安装漫游-vbguest漫游销毁&&漫游上行
这对我很有效。
https://stackoverflow.com/questions/34751037
复制相似问题