在 Mac OS X 10.9.3 上
从中挑选了一个盒子VagrantCloud
初始化 vagrant box
$ vagrant init chef/freebsd-9.2-i386
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
列出文件
$ ls -al
-rw-r--r-- 1 joel staff 4831 Jun 5 17:17 Vagrantfile
Vagrantfile 内容
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/freebsd-9.2-i386"
end
启动我的虚拟盒导致错误
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'chef/freebsd-9.2-i386' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'chef/freebsd-9.2-i386'
default: URL: https://vagrantcloud.com/chef/freebsd-9.2-i386
==> default: Adding box 'chef/freebsd-9.2-i386' (v1.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/chef/freebsd-9.2-i386/version/1/provider/virtualbox.box
==> default: Successfully added box 'chef/freebsd-9.2-i386' (v1.0.0) for 'virtualbox'!
==> default: Importing base box 'chef/freebsd-9.2-i386'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'chef/freebsd-9.2-i386' is up to date...
==> default: Setting the name of the VM: freebsd92-i386_default_1401982167145_49633
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2201 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2201
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
Sorry, don't know how to check guest version of Virtualbox Guest Additions on this platform. Stopping installation.
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.16
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => /Users/joel/Code/anybots/operations/robot/freebsd92-i386
Vagrant attempted to execute the capability 'mount_virtualbox_shared_folder'
on the detect guest OS 'freebsd', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
请注意,我最近安装了最新版本的 VirtualBox,但不知何故我找不到 Guest Additions。
答案1
出现该错误的原因是 Vagrant 尝试使用 VirtualBox 共享文件夹,但 FreeBSD 不支持该功能。请将 Vagrant 配置为使用 NFS:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/freebsd-10.0"
config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
end