首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Packer Amazon EBS主厨-对不起,你必须有个tty来运行sudo。

Packer Amazon EBS主厨-对不起,你必须有个tty来运行sudo。
EN

Stack Overflow用户
提问于 2015-10-11 17:09:00
回答 1查看 1.3K关注 0票数 2

我想使用封隔器为amazon提供图像,使用厨师。

我收到以下错误消息:

代码语言:javascript
复制
sudo: sorry, you must have a tty to run sudo

example.json

代码语言:javascript
复制
{
  "builders": [{
    "type": "amazon-ebs",
    "access_key": "...",
    "secret_key": "...",
    "region": "eu-central-1",
    "source_ami": "ami-daaeaec7",
    "instance_type": "t2.micro",
    "ssh_username": "ec2-user",
    "ami_name": "packer-example {{timestamp}}"
  }],
  "provisioners": [{
    "type": "chef-solo",
    "cookbook_paths": ["cookbooks", "site-cookbooks"],
    "run_list": [  ]
  }]
}

输出

代码语言:javascript
复制
$ packer build example.json
amazon-ebs output will be in this color.

==> amazon-ebs: Prevalidating AMI Name...
==> amazon-ebs: Inspecting the source AMI...
==> amazon-ebs: Creating temporary keypair: packer ...
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 22 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
    amazon-ebs: Instance ID: i-...
==> amazon-ebs: Waiting for instance (i-...) to become ready...
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Connected to SSH!
==> amazon-ebs: Provisioning with chef-solo
    amazon-ebs: Installing Chef...
    amazon-ebs: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    amazon-ebs: Dload  Upload   Total   Spent    Left  Speed
    amazon-ebs: 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0sudo: sorry, you must have a tty to run sudo
    amazon-ebs: 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (23) Failed writing body (0 != 16086)
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: No AMIs to cleanup
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Error installing Chef: Install script exited with non-zero exit status 1

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error installing Chef: Install script exited with non-zero exit status 1

==> Builds finished but no artifacts were created.

我认为有关的错误信息是:

代码语言:javascript
复制
sudo: sorry, you must have a tty to run sudo

有谁有主意吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-11 20:05:15

您可以使用ssh_pty : true拥有TTY。

代码语言:javascript
复制
{
   "builders": [{
      ...
      "ssh_pty" : true,
      ...
    }],
    ...
}
票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33067768

复制
相关文章

相似问题

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