【问题标题】:Vagrant Error, The box failed to unpackage properlyVagrant 错误,盒子未能正确解包
【发布时间】:2014-08-29 20:38:51
【问题描述】:

我有一个关于这些主题的帮助问题,但我已经找不到。

我正在尝试针对我预先存在的虚拟框实施 vagrant。现在网上的大多数主题都是指使用 vagrant cloud 的盒子,或者从头开始构建一个等等。我的问题是我已经使用 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 文件,或者如何找到它来编辑它。也许这是我的问题?我有最新版本的 vagrant,所以这不是问题。

我们将不胜感激。

我已经尝试了 vagrant 包,下面是我遇到的错误请查看您是否可以提供进一步的帮助。

我尝试了您的建议,这是我收到的错误消息。我非常感谢您的帮助。

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>'

【问题讨论】:

    标签: database vb.net vagrant virtualbox


    【解决方案1】:
    vagrant package --base <name of vm> --output <path>.box
    

    假设您的虚拟机名为“my_vm”,您希望将其放入主目录

    vagrant package --base my_vm --output ~/my_vm.box
    

    Vagrant 会将您的虚拟机打包到一个基本盒子中。无论您使用输出标志为框命名,都将是您在 vagrantfile 中使用的名称。

    【讨论】:

    • 感谢您的回答我已经尝试过了,但我收到了一个新错误。我无法将其粘贴到此评论中,因此我将其添加到了最重要的问题中。关于我可以从这里尝试什么的任何想法?感谢您的帮助
    • 在我的脑海中,我建议仔细检查 VM 的名称作为 --base 参数。运行此命令:VBoxManage list vms 并确保“Dev_Clonea”在该列表中。如果不是,那么您的问题是“base”参数应该与该输出上的 VM 同名。
    • 我看到我的问题是我将 --base 作为我的新名称,而不是在 -- 输出上使用了新名称,所以我把它颠倒了。它仍在运行,但考虑到它的 124 GB。我会更新,一旦我确认它已经完全运行,我会进行绿色检查。感谢您的帮助,自从您发布此消息以来,我似乎走在了正确的轨道上。
    • 很高兴听到这个消息!无论如何,package 命令都需要一段时间,即使在我的小型 Linux 机器上,我也只能想象这样大小的 VM 需要多长时间。祝你好运。
    • 所以盒子已经启动并运行了。我很感激你对我很有帮助。但是,现在当我进入它时。它要求输入密码。我需要弄清楚如何设置 SSH 密码。据我所知,其他人的答案在这个问题上相当混乱。你有这方面的经验吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    • 1970-01-01
    • 2012-03-30
    • 2017-08-18
    • 2014-10-18
    • 1970-01-01
    相关资源
    最近更新 更多