我为Hyper-V提供程序创建了一个新的虚拟机。当我尝试添加这个虚拟机时,会出现以下错误:
PS C:\> vagrant box add sbx-misc-app01 .\img-misc-w2k16.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'sbx-misc-app01' (v0) for provider:
box: Unpacking necessary files from: file://C:/img-misc-w2k16.box
box:
C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:156:in `block (3 levels) in add': undefined method `to_sym' for nil:NilClass (NoMethodError)
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:461:in `with_temp_dir'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:134:in `block (2 levels) in add'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:461:in `with_temp_dir'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:115:in `block inadd' from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:448:in `block in with_collection_lock'
from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:447:in `with_collection_lock'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/box_collection.rb:104:in `add'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/builtin/box_add.rb:357:in `box_add'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/builtin/box_add.rb:146:in `add_direct'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/builtin/box_add.rb:120:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/warden.rb:34:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/builder.rb:116:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/runner.rb:66:in `block in run'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/util/busy.rb:19:in `busy'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/action/runner.rb:66:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/plugins/commands/box/command/add.rb:78:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/plugins/commands/box/command/root.rb:66:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/cli.rb:46:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/lib/vagrant/environment.rb:269:in `cli'
from C:/HashiCorp/Vagrant/embedded/gems/2.0.3/gems/vagrant-2.0.3/bin/vagrant:151:in `<main>'
问题:
- 是否有元数据文件参考?我已经搜索了,但就是找不到。
- 为什么会收到“box:未检测到Box文件作为元数据”的消息?我的归档文件中有metadata.json文件。
- "undefined method `to_sym'"错误的意思是什么?
环境...
- 虚拟化操作系统:Microsoft Windows 10 Enterprise (10.0.15063)
- 客户机操作系统:Windows Server 2016 Standard (64位)
- 提供程序:Hyper-V Vagrant 2.0.3
- 使用Bash on Ubuntu on Windows中的tar创建的Box归档文件
- 从Powershell窗口添加的Box
Box的内容...
C:\img-misc-w2k16\Virtual Hard Disks
C:\img-misc-w2k16\Virtual Machines
C:\img-misc-w2k16\metadata.json
C:\img-misc-w2k16\Virtual Hard Disks\img-misc-w2k16.vhdx
C:\img-misc-w2k16\Virtual Machines\AB56D8F5-4F71-4CCD-97E6-237713B79FD8....
C:\img-misc-w2k16\Virtual Machines\AB56D8F5-4F71-4CCD-97E6-237713B79FD8....
metadata.json的内容...
{
"name": "foo/windowsServer2016x64",
"description": "This box contains Windows Server 2016 64-bit standard edition.",
"versions": [
{
"version": "1.0.0",
"providers": [
{
"name": "hyperv"
}
]
}
]
}