我有一些问题,Vagrant共享文件夹,我的基本系统是Ubuntu 13.10桌面。
我不明白为什么我有这个错误是什么是不正确的配置?是NFS问题还是VirtualBox访客添加?我试过不同的盒子,但同样的问题。
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 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","--cpus","1"] v.customize ["modifyvm","--cpuexecutioncap","100"] v.customize ["modifyvm","--ioapic","off"] v.customize ["modifyvm","--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)
插件vagrant-vbguest
解决了我的问题:
原文链接:https://www.f2er.com/ubuntu/354076.html$ vagrant plugin install vagrant-vbguest
输出:
$ vagrant reload ==> default: Attempting graceful shutdown of VM... ... ==> default: Machine booted and ready! GuestAdditions 4.3.12 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Exporting NFS shared folders... ==> default: Preparing to edit /etc/exports. Administrator privileges will be required... ==> default: Mounting NFS shared folders... ==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it
只是确保你运行的是最新版本的VirtualBox