使用包装机1.4.3时遇到问题。 最初,我遇到了一个问题,该问题在#8085(https://circleci.com/gh/hashicorp/packer/12207#artifacts/containers/0版本)中有所描述。通过下载提到的打包程序版本已成功修复。
当前,我正在使用打包程序在Google Cloud Platform中构建Windows-2019和Windows-2016。当我提到“ winrm_username”:“ packer_user”时,它以正确的方式工作,如果我使用“ winrm_username”:“ Adminitstator”或“ winrm_username”:“ administator”,则出现以下错误:
==> Windows-2019:等待实例开始运行... Windows-2019:内部IP:10.154.21.58 Windows-2019:IP:10.154.21.58 ==> Windows-2019:使用Winrm通信器进行连接:10.154.21.58 ==> Windows-2019:等待WinRM可用... ==> Windows-2019:等待WinRM超时。 ==> Windows-2019:正在删除实例... Windows-2019:实例已删除! ==> Windows-2019:删除磁盘... Windows-2019:磁盘已删除!生成“ windows-2019”错误:等待WinRM超时。
我还尝试为等待的实例“ winrm_timeout”添加超时:“ 7m”
下面您可以找到我的用于使用打包程序构建Windows图像的json文件:
{
"name": "windows-2016",
"type": "googlecompute",
"project_id": "myProject",
"zone": "{{user zone}}",
"source_image_family": "windows-2016",
"communicator": "winrm",
"winrm_username": "Adminitstrator",
"image_name": "test-image",
"machine_type": "n1-standard-2",
"disk_size": 50,
"network_project_id": "build-test",
"subnetwork": "mynetwork",
"omit_external_ip": true,
"use_internal_ip": true,
"tags": [
"project-test
],
"winrm_insecure": true,
"winrm_use_ssl": true,
"metadata": {
"windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add Adminitstrator & net localgroup administrators Adminitstrator /add & net user /add Adminitstrator & winrm set winrm/config/service/auth @{Basic="true"}"
}
}
在centos-7上安装了打包程序。
这是packer_log = 1的输出
2019/09/24 09:48:31 Build debug mode: true
2019/09/24 09:48:31 Force build: false
2019/09/24 09:48:31 On error: abort
2019/09/24 09:48:31 Preparing build: windows-2016
2019/09/24 09:48:31 Debug enabled, so waiting for build to finish: windows-2016
2019/09/24 09:48:31 Starting build run: windows-2016
2019/09/24 09:48:31 Running builder: googlecompute
2019/09/24 09:48:31 [INFO] (telemetry) Starting builder googlecompute
2019/09/24 09:48:31 packer: 2019/09/24 09:48:31 [INFO] Requesting Google token via GCE API Default Client Token Source...
2019/09/24 09:48:31 packer: 2019/09/24 09:48:31 [INFO] Instantiating GCE client...
2019/09/24 09:48:32 packer: 2019/09/24 09:48:32 Error asking for input: no available tty
2019/09/24 09:48:32 packer: 2019/09/24 09:48:32 Error asking for input: no available tty
2019/09/24 09:48:38 packer: 2019/09/24 09:48:38 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:40 packer: 2019/09/24 09:48:40 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:43 packer: 2019/09/24 09:48:43 Error asking for input: no available tty
2019/09/24 09:48:44 packer: 2019/09/24 09:48:44 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:46 packer: 2019/09/24 09:48:46 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Error asking for input: no available tty
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Error asking for input: no available tty
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Waiting for WinRM, up to timeout: 30m0s
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 [INFO] Attempting WinRM connection...
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [INFO] Attempting WinRM connection...
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [INFO] Attempting WinRM connection...
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [INFO] Attempting WinRM connection...
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [INFO] Attempting WinRM connection...
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [INFO] Attempting WinRM connection...
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [INFO] Attempting WinRM connection...
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [INFO] Attempting WinRM connection...
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] WinRM connection err: http response error: 401 - invalid content type
有人遇到这种情况吗?
关于, 伊霍尔
答案 0 :(得分:0)
GCP提供的Windows映像已经有一个名为Administrator
的本地用户,但是默认情况下它被禁用。因此,使用Administrator
以外的用户名是正确的方法。