现有连接被强制关闭-Packer

时间:2019-01-14 03:39:14

标签: virtualbox packer

我正在使用打包程序创建VM映像,但是遇到了这个问题。 我正在使用Windows 8.1,并使用Packer为VM创建Ubuntu-16.04映像。

2019/01/14 12:55:54 packer.exe: 2019/01/14 12:55:54 [DEBUG] reconnecting to TCP connection for SSH
2019/01/14 12:55:54 packer.exe: 2019/01/14 12:55:54 [DEBUG] handshaking with SSH
2019/01/14 12:55:54 packer.exe: 2019/01/14 12:55:54 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:51307->127.0.0.1:3538: wsarecv: An existing connection was forcibly closed by the remote host.
2019/01/14 12:56:01 packer.exe: 2019/01/14 12:56:01 [INFO] Attempting SSH connection...
2019/01/14 12:56:01 packer.exe: 2019/01/14 12:56:01 [DEBUG] reconnecting to TCP connection for SSH
2019/01/14 12:56:01 packer.exe: 2019/01/14 12:56:01 [DEBUG] handshaking with SSH
2019/01/14 12:56:01 packer.exe: 2019/01/14 12:56:01 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:51309->127.0.0.1:3538: wsarecv: An established connection was aborted by the software in your hostmachine.
2019/01/14 12:56:08 packer.exe: 2019/01/14 12:56:08 [INFO] Attempting SSH connection...
2019/01/14 12:56:08 packer.exe: 2019/01/14 12:56:08 [DEBUG] reconnecting to TCP connection for SSH
2019/01/14 12:56:08 packer.exe: 2019/01/14 12:56:08 [DEBUG] handshaking with SSH
2019/01/14 12:56:08 packer.exe: 2019/01/14 12:56:08 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:51311->127.0.0.1:3538: wsarecv: An established connection was aborted by the software in your hostmachine.

这是我的json文件:

    "builders": [{
        "type": "virtualbox-iso",
        "guest_os_type": "Ubuntu_64",
        "iso_url": "C:\\Users\\user\\Documents\\Projects\\ubuntu-16.04.5-desktop-amd64.iso",
        "iso_checksum": "c71d27a86a168f28097bc30004b54c1f",
        "iso_checksum_type": "md5",
        "output_directory": "output-ubuntu16.04",
        "vm_name": "ubuntu16.04-amd64",
        "disk_size": 20000,
        "headless": "false",
        "http_directory": "http",
        "boot_wait": "2m",
        "boot_command": [
            "<enter><wait>",
            "<f6><esc>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
            "<bs><bs><bs>",
            "/install/vmlinuz ",
            "initrd=/install/initrd.gz ",
            "net.ifnames=0 ",
            "auto-install/enable=true ",
            "debconf/priority=critical ",
            "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg",
            "<enter>"
        ],
        "ssh_timeout": "60m",
        "ssh_username": "ubuntu",
        "ssh_password": "ubuntu",
        "ssh_port": 22,
        "shutdown_command": "sudo systemctl poweroff",
        "vboxmanage": [
            ["modifyvm", "{{.Name}}", "--memory", 2048],
            ["modifyvm", "{{.Name}}", "--cpus", 4]
        ]
    }],
    "provisioners": [{
            "type": "shell",
            "scripts": [
                    "scripts/install.sh"
    ],
    "override": {
        "virtualbox-iso": {
            "execute_command": "echo 'vagrant' | sudo -S sh '{{ .Path }}'"
                }
            }
    }],
    "post-processors": [
            "vagrant"
    ]
}

尝试2台计算机,但错误相同。 有人遇到过吗? 欢迎任何意见和想法。

0 个答案:

没有答案