Guest OS Packer 中 Windows 10 的类型无效
Guest OS Type invalid for Windows 10 in Packer
我们正在尝试使用 vag运行t 为我们的一个内部项目创建 windows 10 个虚拟框图像。作为其中的一部分,我得到了 windows 10 64 位光盘映像,并研究了如何使用我们自己的 OS 光盘创建自定义映像。 Hashicorp 有 Packer 应用程序和 vag运行t,它有助于使用自定义图像创建虚拟框。
使用加壳器,我已经创建了我的 json 文件、模板文件,并验证了它和 运行 构建命令来创建一个虚拟框,但是在 guest OS 类型下构建失败无法弄清楚 windows 10 的正确来宾 OS 类型名称是什么。我附上了我的 json 文件、模板文件和构建日志供您参考。任何想法都将不胜感激!!
Windows-10.json
{
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "2m",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "windows-10",
"disk_size": 61440,
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
],
"post-processors":[
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_10_{{.Provider}}.box",
"vagrantfile_template": "windows10.template"
}
],
"variables": {
"iso_url":
"C:/ABC/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso",
"iso_checksum_type": "md5",
"iso_checksum": "bd09dc56c51a6ce137b8c0eb7c4369ea",
"autounattend": "./answer_files/10/Autounattend.xml"
}
}
我的 windows 10 模板如下所示
Windows10.template
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.2"
Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-10"
config.vm.box = "windows_10"
config.vm.communicator = "winrm"
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true
config.vm.provider :virtualbox do |v, override|
#v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
config.vm.provider :vmware_fusion do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
end
config.vm.provider :vmware_workstation do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
end
end
Windows10.json 已成功验证,当我 运行 打包程序构建时,下面是我得到的错误
packer build windows10.json
virtualbox-iso output will be in this color.
==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying:
file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: file:///C:/ABC/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
==> virtualbox-iso: VBoxManage.exe: error: Details: code
VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
==> virtualbox-iso: VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Error creating VM: VBoxManage error:
VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> Builds finished but no artifacts were created.
请参阅文档 Packer 文档 guest_os_type。只是 运行 VBoxManage list ostypes
你会发现你应该使用 Windows10_64
.
我们正在尝试使用 vag运行t 为我们的一个内部项目创建 windows 10 个虚拟框图像。作为其中的一部分,我得到了 windows 10 64 位光盘映像,并研究了如何使用我们自己的 OS 光盘创建自定义映像。 Hashicorp 有 Packer 应用程序和 vag运行t,它有助于使用自定义图像创建虚拟框。
使用加壳器,我已经创建了我的 json 文件、模板文件,并验证了它和 运行 构建命令来创建一个虚拟框,但是在 guest OS 类型下构建失败无法弄清楚 windows 10 的正确来宾 OS 类型名称是什么。我附上了我的 json 文件、模板文件和构建日志供您参考。任何想法都将不胜感激!!
Windows-10.json
{
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "2m",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "windows-10",
"disk_size": 61440,
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
],
"post-processors":[
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_10_{{.Provider}}.box",
"vagrantfile_template": "windows10.template"
}
],
"variables": {
"iso_url":
"C:/ABC/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso",
"iso_checksum_type": "md5",
"iso_checksum": "bd09dc56c51a6ce137b8c0eb7c4369ea",
"autounattend": "./answer_files/10/Autounattend.xml"
}
}
我的 windows 10 模板如下所示 Windows10.template
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.2"
Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows-10"
config.vm.box = "windows_10"
config.vm.communicator = "winrm"
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true
config.vm.provider :virtualbox do |v, override|
#v.gui = true
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
end
config.vm.provider :vmware_fusion do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
end
config.vm.provider :vmware_workstation do |v, override|
#v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
end
end
Windows10.json 已成功验证,当我 运行 打包程序构建时,下面是我得到的错误
packer build windows10.json
virtualbox-iso output will be in this color.
==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying:
file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: file:///C:/ABC/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
==> virtualbox-iso: VBoxManage.exe: error: Details: code
VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
==> virtualbox-iso: VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Error creating VM: VBoxManage error:
VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage.exe: error: Guest OS type 'windows-10' is invalid
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 273 of file VBoxManageMisc.cpp
==> Builds finished but no artifacts were created.
请参阅文档 Packer 文档 guest_os_type。只是 运行 VBoxManage list ostypes
你会发现你应该使用 Windows10_64
.