我有一个求助的问题,我已经找不到任何这些主题了。
我正在尝试对我预先存在的虚拟框实施vagrant。目前在线的大多数主题都是指使用来自流浪云的盒子,或者从头开始构建一个等等。我的问题是我有一个已经构建的虚拟盒,使用Virtualbox作为提供者,特别是1.4.3作为版本。盒子是124GB,所以改造它并不完全理想。我将vagrant配置文件设置为在路径/users/desktop/foldername/filename.vbox中找到虚拟框。每次尝试添加框时我都会收到错误
"The box failed to unpackage properly. Please verify that the box file you're trying to add is not corrupted and try again. The output from attemtping to unpackage (if any):
Bsdtar: Error opening archive: Unrecognized archive format."
我的知识是,这是因为Vagrant正在寻找添加.tar文件而该文件不是tar扩展名。
您应该能够配置vagrant文件以识别我已经完成的提供程序。我的目标是
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
但无论我尝试什么,我总是得到上面的错误。 需要注意的一点是,我不确定如何提供metadata.json文件,或者我如何找到它来编辑它。也许那是我的问题?我有最新版本的流浪汉,所以这不是问题。
我尝试过流浪汉包,下面是我的错误我收到了请查看您是否可以提供进一步的帮助。
我尝试了你建议的内容,这是我收到的错误消息。我非常感谢你的帮助。
nokeys$ vagrant package --base Dev_Clonea --output /users/nokeys/desktop/Dev_Clone/Dev_Clone.vbox
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:306:in `id=': undefined method `children' for nil:NilClass (NoMethodError)
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:438:in `state'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/created.rb:11:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/call.rb:43:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:196:in `action_raw'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:173:in `block in action'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:83:in `package_vm'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:66:in `package_base'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:42:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/cli.rb:42:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:252:in `cli'
from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:166:in `<main>'
答案 0 :(得分:2)
vagrant package --base <name of vm> --output <path>.box
让我们假设你的虚拟机名为&#39; my_vm&#39;并且您想将其放入主目录
vagrant package --base my_vm --output ~/my_vm.box
Vagrant会将您的虚拟机打包到一个基本框中。无论您使用输出标志命名该框,都将是您在vagrantfile中使用的名称。