gpt4 book ai didi

linux - Packer Amazon EBS Chef - 抱歉,您必须有 tty 才能运行 sudo

转载 作者:太空狗 更新时间:2023-10-29 11:27:07 25 4
gpt4 key购买 nike

我想使用 Packer用于使用 Chef 为亚马逊 ebs 配置图像。

我收到以下错误消息:

sudo: sorry, you must have a tty to run sudo

例子.json

{
"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": [ ]
}]
}

输出

$ 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.

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

sudo: sorry, you must have a tty to run sudo

有人有想法吗?

最佳答案

您可以使用 ssh_pty : true 来获得 TTY。

{
"builders": [{
...
"ssh_pty" : true,
...
}],
...
}

关于linux - Packer Amazon EBS Chef - 抱歉,您必须有 tty 才能运行 sudo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33067768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com