我有一些Vagrant共享文件夹的问题,我的基本系统是Ubuntu 13.10桌面 .
我不明白为什么我有这个错误是没有正确配置的东西?是NFS问题还是Virtualbox Guest Additions?我试过不同的很多盒子,但同样的问题 .
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
这是 vagrant up
之后的完整流程:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'u131032'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant_default_1396020504136_46442
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Error: Connection timeout. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
default: Error: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions versions on your host (4.3.10) and guest (4.2.16) do not match.
* Stopping VirtualBox Additions
...done.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
dkms libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1
libgl1-mesa-dri libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0
libsm6 libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3
libxfont1 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6
x11-common x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils
xserver-common xserver-xorg-core
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 11.1 MB disk space will be freed.
(Reading database ... 65615 files and directories currently installed.)
Removing virtualbox-guest-dkms ...
-------- Uninstall Beginning --------
Module: virtualbox-guest
Version: 4.2.16
Kernel: 3.11.0-18-generic (i686)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
vboxguest.ko:
- Uninstallation
- Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
vboxsf.ko:
- Uninstallation
- Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
vboxvideo.ko:
- Uninstallation
- Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall completed.
------------------------------
Deleting module version: 4.2.16
completely from the DKMS tree.
------------------------------
Done.
Removing virtualbox-guest-x11 ...
Purging configuration files for virtualbox-guest-x11 ...
Removing virtualbox-guest-utils ...
Purging configuration files for virtualbox-guest-utils ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
dkms set to manually installed.
linux-headers-3.11.0-18-generic is already the newest version.
linux-headers-3.11.0-18-generic set to manually installed.
The following packages were automatically installed and are no longer required:
libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1 libgl1-mesa-dri
libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0 libsm6
libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3 libxfont1
libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6 x11-common
x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
xserver-xorg-core
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting read-only
Installing Virtualbox Guest Additions 4.3.10 - guest version is 4.2.16
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.10. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
nfsd running
sudo: /usr/bin/exportfs: command not found
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
default: /vagrant => /home/me/Documents/Work/project/vagrant
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
我的Vagrantfile配置是:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
personalization = File.expand_path("../Personalization", __FILE__)
load personalization
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = $base_box
config.vm.box_url = $base_box_url
config.vm.hostname = $vhost + ".dev"
config.hostsupdater.aliases = ["api." + $vhost + ".dev", "mysql." + $vhost + ".dev"]
config.hostsupdater.remove_on_suspend = true
# set auto_update to ture to check the correct
# additions version when booting the machine
config.vbguest.auto_update = true
config.vbguest.auto_reboot = true
config.vm.network :private_network, ip: $ip
config.vm.synced_folder "../", "/srv/www/vhosts/" + $vhost + ".dev", type: "nfs"
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", "1"]
v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
v.customize ["modifyvm", :id, "--ioapic", "off"]
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
config.vm.provision "shell" do |s|
s.path = "vagrant-bootstrap.sh"
s.args = $vhost + " " + $mysql_password + " " + $application_database
end
end
个性化文件是:
# Name of the vhost to create
$vhost = "project"
# Use the Ubunut 32bit or 64bit
$base_box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-i386-vagrant-disk1.box"
# VM IP
$ip = "192.168.7.7"
# Base box name
$base_box = "u131032"
# MySQL
$mysql_password = "admin"
$application_database = "project"
Vagrant中启用了以下插件:
$ vagrant plugin list
vagrant-hostsupdater (0.0.11)
vagrant-login (1.0.1, system)
vagrant-share (1.0.1, system)
vagrant-vbguest (0.10.0)
21 回答
我相信这是现在最新的答案,它对我有用(
Guest Additions Version: 5.0.6
,VirtualBox Version: 4.3.16
,Ubuntu 14.04 LTS
)https://github.com/mitchellh/vagrant/issues/3341#issuecomment-144271026
基本上我说:
仅供将来参考,当我在
/
中配置共享文件夹并创建到我的主文件夹的符号链接时,使用Vagrant 1.7.4和VirtualBox 5.0.10 r104061发生了这个问题 . 像这样的东西:显然,出于安全目的,Vagrant不允许此操作并抛出所描述的错误 .
我通过将所需的文件夹直接配置到我的主目录(例如
/home/vagrant/folder
)来解决它 .在我的情况下,在以前工作的Ubuntu 16.04映像上,在为不同的vagrant图像安装vagrant-vbguest之后启动错误,然后启动Ubuntu VM . 它将guest虚拟机添加升级到5.1.20,从那时起,挂载开始失败 . 更新了盒子,apt更新升级,同样,vbguest将安装较新的5.1.20版本 .
它通过手动运行解决:
并且还禁用此VM的
config.vbguest.auto_update = false
(可能没有必要) .插件vagrant-vbguest
解决了我的问题:
输出:
只需确保您运行的是最新版本的VirtualBox
我在这里找到了这个问题vagrant issues.有两种方法可以做到:
vagrant ssh
ssh进入vbox之后)然后运行
vagrant reload
以正确安装文件夹 .更新(16may2014)
由于iso不再可用,您可以使用4.3.12 one(http://dlc.sun.com.edgesuite.net/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12.iso)
注意:os X的二进制vbox4.3.12目前不可用
我在找到相同的错误消息时到达此页面 . 对我来说原因是不同的:我在安装了新内核的系统上运行了
yum update
. 客户添加过时,因此无法加载它们 .我用它重建了它们
并且
vagrant reload
后来我的客人又回来了 .我只是在这里添加它,以防其他人像我一样来到这里 .
编辑(根据KCD的评论):
您可能会收到错误消息:
这可以通过安装
kernel-devel
(yum install kernel-devel
)来解决Fix Step by step:
如果您没有vbguest插件,请安装它:
运行Vagrant
它显示错误 .
登录VM
Fix!
在guest虚拟机中(VM已记录) .
回到主机上,重新加载Vagrant
Update February 2016
这花了我几个小时独立解决 . 是的,最新的Vagrant和Virtual Box安装仍然存在此问题:
我的症状是这样的消息:
Checking for guest additions in VM... The guest additions on this VM do not match the installed version of VirtualBox!
然后无法挂载NFS驱动器 .
1) . 安装
vagrant-vbguest
插件 .根据您使用的Vagrant版本,发出以下命令之一:
接下来,做
vagrant halt
,然后是vagrant up
- 你有机会遇到问题 .2) . ssh到您的访客并设置一个软链接到正确版本的Guest Additions(这里,5.0.14) .
你应该都很好 . 默认情况下,guest虚拟机上安装的驱动器位于
/vagrant
Final comment:
如果您仍然遇到与安装NFS驱动器相关的问题,那么这是一个适合我的解决方法 . 我有一个
vagrantfile
配置如下:只需删除mount type信息,然后减小mount_options设置,使它们普遍适用 . Vagrant现在将自动为您的环境选择最佳的同步文件夹选项 .
运行此命令安装vagrant-vbguest插件:
我遇到了与Centos 7相同的问题,我假设由于过时的内核与VirtualBox的更新版本相结合 . 基于Blizz的更新,这对我有用(已经安装了vagrant-vbguest插件):
对我来说,使用VBoxGuestAdditions 5.1.20,问题是
/sbin/mount.vboxsf
指向了错误的位置 .sudo ln -sf /opt/VBoxGuestAdditions-5.1.20/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf
为我修好了
如Vagrant issue #3341中所述,这是Virtualbox bug #12879 .
它仅影响VirtualBox 4.3.10并在4.3.12中完全修复 .
(从我上面的评论)
关注问题的根源:特别是评论中的部分说:
在这之后,我和所有人一样照常营业虚拟机(当然还有它们当前的Vagrantfiles)
当您必须在新创建的虚拟机中执行某些操作时,要使其正常工作,就会出现问题 .
在windows是主机的配置中,linux是访客,我在其他地方找到了同样问题的解决方案 .
所以再次,错误消息是"Failed to mount folders in Linux guest. This is usually because the " vboxsf " file system is not available."(...)
这是因为我在guest虚拟机系统中将符号链接从/ vagrant转到/ home / vagrant / vagrant时犯了错误 . 关键是,目录/ vagrant是一个普通的linux目录,它有一个符号链接(所以一切正常),但是当通过“vagrant up”启动时,它试图在那个地方挂载windows目录,并且windows目录不能用作符号链接 . Windows主机不支持linux符号链接 .
那么你可以做的就是ssh into guest,删除符号链接,无论你拥有它,然后重新加载机器 .
在我的配置中它是:Vagrant 1.7.2,VBoxGuestAdditions 4.3.28和VBox 4.3.28 .
这是2017年 . 万一有人面临同样的问题 .
对于bento / centos-6.7,我得到同样的错误 . 通过添加插件vagrant-vbguest(0.13.0)解决了这个问题 . c:> vagrant插件安装vagrant-vbguest
方框网址:http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box
这个centos-7版本给了我同样的错误
错误:
我的配置:
由于我已经有vagrant-vbguest插件,当它看到Host 5.0.10和guest 4.3.20中安装了不同版本的VBGuestAddition时,它会尝试更新centos-7中的VBoxGuestAdditions .
我甚至检查过符号链接是否存在 .
这不符合user3006381的建议
centos-7的解决方案:由psychok7提供的工作
Diabled自动更新 .
config.vbguest.auto_update = false
然后vagrant destroy --force
和vagrant up
结果:
您的日志抱怨没有找到exportfs:
sudo: /usr/bin/exportfs: command not found
exportfs使本地目录可供NFS客户端装入 .
这似乎是由于与vbguest vagrant插件和最新版本的vagrant不兼容 . 它正在尝试更新guest虚拟机添加内容并且无法完全/正确地执行此操作 .
试试吧:
在Vagrantfile中添加:
跑:
我用VirtualBox 5.1.X运行Vagrant,不得不降级到VirtualBox 5.0.40,并安装vbguest插件来解决这个问题 .
我的步骤是:
卸载VirtualBox 5.1.X
安装Vagrant 5.0.40
重新启动我的机器
为我的流浪者跑
vagrant up
. 它会失败 .在我的VM运行时运行
vagrant plugin install vagrant-vbguest
,安装vagrant插件 . 这管理在主机和来宾之间同步VirtualBox Guest版本 .运行
vagrant reload
以重新加载我的虚拟机魔术!
到目前为止安装工作在一些机器(ubuntu)和一些没有(centos 7),但安装插件解决了它
只是,不需要做任何其他事情
在完成kenzie的第一个建议之后,我必须完成的另一个步骤是从Ubuntu命令行[14.04 Server]运行带有
sudo
的错误消息中列出的mount
命令 . 在那之后,一切都很好!