Virtualbox 握手失败:ssh:无法进行身份验证,尝试的方法[无密码键盘交互],没有支持的方法保留
这个问题的问题类似于 然而,我的包装工的行为是不同的。我明白了Virtualbox 握手失败:ssh:无法进行身份验证,尝试的方法[无密码键盘交互],没有支持的方法保留,virtualbox,packer,rancher,Virtualbox,Packer,Rancher,这个问题的问题类似于 然而,我的包装工的行为是不同的。我明白了 ==> virtualbox-iso: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password keyboard- interactive], no supported methods remain 我不知道为什么Packer不能ssh到VM中。我可以看到Virtua
==> virtualbox-iso: Error waiting for SSH: ssh: handshake failed: ssh:
unable to authenticate, attempted methods [none password keyboard-
interactive], no supported methods remain
我不知道为什么Packer不能ssh到VM中。我可以看到VirtualBox控制台屏幕位于登录输入上。然后它超时并被packer的进程丢弃
packer.json
{
"variables": {
"ros_version" : "v1.1.4",
"iso_md5" : "b1f395a86c7c040702ec77fe87abb2e2",
"vm_name" : "rancher_image"
},
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "https://releases.rancher.com/os/{{ user `ros_version` }}/rancheros.iso",
"guest_os_type": "Linux_64",
"guest_additions_mode": "disable",
"iso_checksum_type": "md5",
"iso_checksum": "{{ user `iso_md5` }}",
"output_directory": "output_rancheros",
"ssh_wait_timeout": "120s",
"shutdown_command": "sudo shutdown -h now",
"disk_size": 8000,
"ssh_username": "rancher",
"ssh_password": "rancher",
"headless" : false,
"ssh_port": 22,
"ssh_host_port_min": 2222,
"ssh_host_port_max": 4444,
"ssh_skip_nat_mapping": true,
"vm_name": "{{ user `vm_name` }}",
"boot_wait": "30s",
"vboxmanage":[
["modifyvm", "{{.Name}}", "--memory","4096"]
]
}
],
"provisioners": [
{
"type":"file",
"source": "cloud-config.yml",
"destination": "/tmp/cloud-config.yml"
},
{
"type": "shell",
"inline": [
"ifconfig",
"sudo ros install -d /dev/sda -f -c /tmp/cloud-config.yml -i rancher/os:{{ user `ros_version` }} --no-reboot"
]
}
]
}
云配置.yml
#cloud-config
rancher:
ssh_authorized_keys:
- ssh-rsa AAA ... some VALID RSA email@email.com
network:
interfaces:
eth0:
dhcp: true
dns:
nameservers:
-8.8.8.8
-8.8.4.4
编辑:
在生成器中添加这些行,并从Provisioniers中删除它们的等效项。这仍然不能解决我想要的其他步骤,但至少可以上传云配置并完成配置
"http_directory":"http",
"boot_command":[
"<esc><esc><enter><wait>",
"wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/cloud-config.yml <enter>",
"sudo ros install -d /dev/sda -f -c cloud-config.yml -i rancher/os:{{ user `ros_version` }}",
"<enter>"],
“http\u目录”:“http”,
“启动命令”:[
"",
“wget http://{{.HTTPIP}}:{{{.HTTPPort}}/cloud-config.yml”,
“sudo ros install-d/dev/sda-f-c cloud-config.yml-i rancher/os:{{user`ros_version`}”,
""],
RancherOS在默认情况下没有启用ssh密码。看这对我来说很有效
{
“变量”:{
“vCPU”:“1”,
“磁盘大小”:“30000”,
“ftp_代理”:“{{env`ftp_代理`}”,
“无头”:“假”,
“iso_校验和”:“sha256:d70520b1edd51d3f45a407fbffd820ec4b5cc4a6b7a73d822a687facd9c07e92”,
“iso_url”:https://github.com/rancher/os/releases/download/v1.5.6/rancheros.iso",
“内存”:“2048”,
“ssh_密码”:“rancher”,
“ssh_用户名”:“牧场主”,
“版本”:“0.1.0”,
“环境”:“主人”,
“vm_名称”:“{{user`ENVIRONMENT`}-牧场主”,
“格式”:“ovf”,
“http_服务器”:“http://{{.HTTPIP}}:{{{.HTTPPort}}/”,
“输出路径”:“输出-{{user`vm\u name`}”
},
“建筑商”:[
{
“启动命令”:[
"",
“wget http://{{.HTTPIP}}:{{.HTTPPort}/{{user`vm_name`}}-cloud-config.yml”,
“sudo ros install-d/dev/sda-f-c{{user`vm_name`}}-cloud-config.yml-无需重新启动”,
"",
“sudo关机”
],
“开机等待”:“30秒”,
“通信器”:“无”,
“CPU”:“{user`vcpus`}”,
“磁盘大小”:“{user`disk\u size`}”,
“来宾操作系统类型”:“Linux 64”,
“headless”:“{user`headless`}}”,
“http_目录”:“http”,
“iso_校验和”:“{{user`iso_校验和`}}”,
“iso_url”:“{{user`iso_url`}”,
“内存”:“{user`memory`}}”,
“格式”:“{user`format`}}”,
“输出目录”:“{user`output\u path`}”,
“禁用_关机”:真,
“关机超时”:“5m”,
“类型”:“virtualbox iso”,
“vm_name”:“{{user`vm_name`}”,
“来宾添加模式”:“禁用”,
“virtualbox\u版本\u文件”:”
}
]
}
谢谢,在通过packer进行ssh之前,我不清楚如何设置密码。cloud-config或provisioners在之后才会执行。只需将cloud-config.yml放在http目录中,并使用boot_命令将其用于配置。您是否有一个链接,指向如何使用http服务器拉取cloud-config.yml的示例?我已经用Debian安装完成了,但我认为我不能重用这些代码。Debian示例:“preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}/{{userpreeseed_file
}”最后,我根据您的建议添加了http目录和boot命令。Rickard,我想接受您的答案作为答案,但您能否查看我的解决方案并对其进行改进,或者将其复制粘贴到您的答案中?一句话很优雅,但仍然比答案更适合评论:)