使用打包程序构建Winddows 2012R2图像:无效的内容类型

时间:2018-06-25 11:01:14

标签: vagrant vagrantfile packer vagrant-windows

我正在尝试使用打包程序来构建Windows 2012 R2映像,并且不断出现以下错误

==> virtualbox-iso: Waiting for WinRM to become available...
2018/06/25 06:43:59 packer: 2018/06/25 06:43:59 [INFO] Attempting WinRM connection...
2018/06/25 06:43:59 packer: 2018/06/25 06:43:59 [DEBUG] connecting to remote shell using WinRM
2018/06/25 06:45:14 packer: 2018/06/25 06:45:14 [ERROR] connection error: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52038->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:45:14 packer: 2018/06/25 06:45:14 [ERROR] WinRM connection err: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52038->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:45:19 packer: 2018/06/25 06:45:19 [INFO] Attempting WinRM connection...
2018/06/25 06:45:19 packer: 2018/06/25 06:45:19 [DEBUG] connecting to remote shell using WinRM
2018/06/25 06:46:34 packer: 2018/06/25 06:46:34 [ERROR] connection error: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52040->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:46:34 packer: 2018/06/25 06:46:34 [ERROR] WinRM connection err: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52040->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:46:39 packer: 2018/06/25 06:46:39 [INFO] Attempting WinRM connection...
2018/06/25 06:46:39 packer: 2018/06/25 06:46:39 [DEBUG] connecting to remote shell using WinRM
2018/06/25 06:47:54 packer: 2018/06/25 06:47:54 [ERROR] connection error: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52044->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:47:54 packer: 2018/06/25 06:47:54 [ERROR] WinRM connection err: unknown error Post http://127.0.0.1:4174/wsman: read tcp 127.0.0.1:52044->127.0.0.1:4174: read: connection reset by peer
2018/06/25 06:47:59 packer: 2018/06/25 06:47:59 [INFO] Attempting WinRM connection...
2018/06/25 06:47:59 packer: 2018/06/25 06:47:59 [DEBUG] connecting to remote shell using WinRM
2018/06/25 06:48:42 packer: 2018/06/25 06:48:42 [ERROR] connection error: http response error: 401 - invalid content type

这是我的json文件,可从https://github.com/mwrock/packer-templates

获得
{
  "builders": [
    {
      "type": "virtualbox-iso",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--memory", "2048" ],
        [ "modifyvm", "{{.Name}}", "--vram", "48" ],
        [ "modifyvm", "{{.Name}}", "--cpus", "2" ]
      ],
      "guest_additions_mode": "{{ user `guest_additions_mode` }}",
      "guest_additions_path": "C:/users/vagrant/VBoxGuestAdditions.iso",
      "guest_os_type": "Windows2012_64",
      "headless": "{{ user `headless` }}",
      "iso_url": "{{ user `iso_url` }}",
      "iso_checksum": "{{ user `iso_checksum` }}",
      "iso_checksum_type": "sha1",
      "communicator": "winrm",
      "winrm_username": "vagrant",
      "winrm_password": "vagrant",
      "winrm_timeout": "12h",
      "winrm_port" : "5985",
      "shutdown_command": "a:/PackerShutdown.bat",
      "shutdown_timeout": "15m",
      "floppy_files": [
        "answer_files/2012_r2{{user `core`}}/Autounattend.xml",
        "scripts/postunattend.xml",
        "scripts/boxstarter.ps1",
        "scripts/PackerShutdown.bat",
        "scripts/package.ps1",
        "scripts/SetupComplete-2012.cmd",
        "scripts/Test-Command.ps1"
      ]
    },
    {
      "name": "virtualbox-iso-atlas",
      "type": "virtualbox-iso",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--memory", "2048" ],
        [ "modifyvm", "{{.Name}}", "--vram", "36" ],
        [ "modifyvm", "{{.Name}}", "--cpus", "2" ]
      ],
      "guest_os_type": "Windows2012_64",
      "headless": "{{ user `headless` }}",
      "iso_url": "{{ user `iso_url` }}",
      "iso_checksum": "{{ user `iso_checksum` }}",
      "iso_checksum_type": "sha1",
      "communicator": "winrm",
      "winrm_username": "vagrant",
      "winrm_password": "vagrant",
      "winrm_port": 55985,
      "winrm_timeout": "12h",
      "shutdown_command": "a:/PackerShutdown.bat",
      "shutdown_timeout": "15m",
      "floppy_files": [
        "answer_files/2012_r2{{user `core`}}/Autounattend.xml",
        "scripts/postunattend.xml",
        "scripts/boxstarter.ps1",
        "scripts/PackerShutdown.bat",
        "scripts/package.ps1",
        "scripts/SetupComplete-2012.cmd",
        "scripts/Test-Command.ps1"
      ]
    }
  ],
  "provisioners": [
    {
      "type": "powershell",
      "script": "scripts/provision.ps1"
    }
  ],
  "post-processors": [
    [{
      "type": "vagrant",
      "keep_input_artifact": true,
      "output": "windows2012r2min-{{.Provider}}.box",
      "vagrantfile_template": "vagrantfile-windows.template"
    },
    {
      "type": "atlas",
      "only": ["virtualbox-iso-atlas"],
      "artifact": "mwrock/Windows2012R2{{user `core`}}",
      "artifact_type": "vagrant.box",
      "metadata": {
        "provider": "virtualbox",
        "version": "0.5.2"
      }
    }]
  ],
  "variables": {
    "core": "",
    "guest_additions_mode": "attach",
    "headless": "false",
    "iso_checksum": "849734f37346385dac2c101e4aacba4626bb141c",
    "iso_url": "http://care.dlservice.microsoft.com/dl/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO"
  }
}

我的打包程序版本为v1.2.4,无业游民的版本为Vagrant 2.1.1

0 个答案:

没有答案