首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用打包程序构建RancherOS时,SSH失败

使用打包程序构建RancherOS时,SSH失败
EN

Stack Overflow用户
提问于 2016-07-27 15:10:19
回答 1查看 1.1K关注 0票数 4

我对帕克和RancherOS有意见。我正在尝试使用cloud-config文件构建一个自定义的rancherOS镜像。我正在研究MacOSX。

我有这个build.json文件

代码语言:javascript
复制
{
    "variables": {
        "vm_name" : ""
    },
    "builders": [
        {
            "type": "vmware-iso",
            "iso_url": "rancheros.iso",
            "guest_os_type": "other",
            "iso_checksum_type": "md5",
            "iso_checksum": "467caa8394684ba54e8731aed8480652",
            "output_directory": "output_rancheros",
            "ssh_wait_timeout": "30s",
            "shutdown_command": "sudo shutdown -h now",
            "disk_size": 20000,
            "ssh_username": "rancher",
            "ssh_password": "rancher",
            "ssh_port": 22,
            "ssh_wait_timeout": "90m",
            "vm_name": "{{ user `vm_name` }}",
            "boot_wait": "10s",
            "vmx_data": {
                "memsize": "4096"
            }
        }
    ],
    "provisioners": [
        {
            "type":"file",
            "source": "cloud-config.yml",
            "destination": "/tmp/cloud-config.yml"
        },
        {
            "type": "shell",
            "inline": [
                "sudo ros install -d /dev/sda -f -t generic -c /tmp/cloud-config.yml"
            ]
        }
    ]
}

此外,我还有一个只包含我的SSH密钥的cloud-config.yml

代码语言:javascript
复制
#cloud-config
ssh_authorized_keys:
    - ssh-rsa AAAA....d admin@example.com

当我启动构建命令packer build build.json

我得到了

代码语言:javascript
复制
    vmware-iso: + umount /mnt/new_img
    vmware-iso: time="2016-07-27T05:52:35Z" level=fatal msg=EOF
    vmware-iso: Continue with reboot [y/N]:
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 1

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 1

==> Builds finished but no artifacts were created.

如果我没理解错的话。我的脚本正在工作,但是当VM重新启动时,新的SSH密钥不起作用。

我不知道怎么解决这个问题。也许有人会帮我。

诚挚的问候

EN

回答 1

Stack Overflow用户

发布于 2016-08-01 23:30:28

我找到了一个解决方案

只需在sudo ros install -d /dev/sda -f -t generic -c /tmp/cloud-config.yml命令上添加一个-no-reboot标志即可完成此任务。

因此,在生成过程中不会进行重新启动。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38606092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档