Opsworks 实例无法启动:状态:start_failed:没有这样的食谱:apt

Posted

技术标签:

【中文标题】Opsworks 实例无法启动:状态:start_failed:没有这样的食谱:apt【英文标题】:Opsworks instance fails to start : Status: start_failed: No such cookbook: apt 【发布时间】:2017-04-29 20:53:41 【问题描述】:

我创建了一个创建 opsworks 资源的 cloudformation 模板:堆栈、层、应用程序和实例。我将我的食谱添加到 S3 并测试了我的模板,除了 opsworks 实例之外的所有资源都已成功创建,我收到此错误:

CREATE_FAILED   AWS::OpsWorks::Instance     MyInstance  ff45a8d0-9adf-40a4-a049-f2329a9fa1f0 failed. Status=start_failed

谁能告诉我应该在哪里检查,这是什么原因? 另外,我尝试了很多实例类型,内存优化但仍然出现错误。请帮忙。非常感谢。

这里是日志:

[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 92)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/nodes] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 97)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/nodes] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/nodes
[2016-12-15T13:58:12+00:00] INFO: Processing template[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/client.rb] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 106)
[2016-12-15T13:58:12+00:00] INFO: template[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/client.rb] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/client.rb
[2016-12-15T13:58:12+00:00] INFO: template[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/client.rb] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/client.rb
[2016-12-15T13:58:12+00:00] INFO: Processing file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/attribs.json] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 114)
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/attribs.json] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/attribs.json
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/attribs.json] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/attribs.json
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_app] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_app] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_app
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance
[2016-12-15T13:58:12+00:00] INFO: Processing file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance/script.json] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 208)
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance/script.json] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance/script.json
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance/script.json] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_instance/script.json
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer
[2016-12-15T13:58:12+00:00] INFO: Processing file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer/node.json] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 208)
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer/node.json] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer/node.json
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer/node.json] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_layer/node.json
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack
[2016-12-15T13:58:12+00:00] INFO: Processing file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack/a0dc4b91-63dc-4947-95c2-f28d2fae00fb.json] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 208)
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack/a0dc4b91-63dc-4947-95c2-f28d2fae00fb.json] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack/a0dc4b91-63dc-4947-95c2-f28d2fae00fb.json
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack/a0dc4b91-63dc-4947-95c2-f28d2fae00fb.json] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_stack/a0dc4b91-63dc-4947-95c2-f28d2fae00fb.json
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command
[2016-12-15T13:58:12+00:00] INFO: Processing file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f.json] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 208)
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f.json] created file /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f.json
[2016-12-15T13:58:12+00:00] INFO: file[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f.json] updated file contents /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_command/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f.json
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_user] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_user] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_user
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_elastic_load_balancer] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_elastic_load_balancer] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_elastic_load_balancer
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_rds_db_instance] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_rds_db_instance] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_rds_db_instance
[2016-12-15T13:58:12+00:00] INFO: Processing directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_ecs_cluster] action create (/var/lib/aws/opsworks/cache.internal/cookbooks/aws_opsworks_custom_run/providers/default.rb line 124)
[2016-12-15T13:58:12+00:00] INFO: directory[/var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_ecs_cluster] created directory /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags/aws_opsworks_ecs_cluster
[2016-12-15T13:58:12+00:00] WARN: Skipping final node save because override_runlist was given
[2016-12-15T13:58:12+00:00] INFO: Chef Run complete in 30.522850769 seconds
[2016-12-15T13:58:12+00:00] INFO: Skipping removal of unused files from the cache
[2016-12-15T13:58:12+00:00] INFO: Running report handlers
[2016-12-15T13:58:12+00:00] INFO: Report handlers complete

[2016-12-15T13:58:13+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef
One version per cookbook
data_bags at /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/data_bags
nodes at /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/nodes

[2016-12-15T13:58:13+00:00] INFO: Forking chef instance to converge...
[2016-12-15T13:58:13+00:00] INFO: *** Chef 12.16.42 ***
[2016-12-15T13:58:13+00:00] INFO: Platform: x86_64-linux
[2016-12-15T13:58:13+00:00] INFO: Chef-client pid: 3500
[2016-12-15T13:58:14+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/script.localdomain
[2016-12-15T13:58:14+00:00] INFO: Setting the run_list to ["recipe[cassandra-php-driver::setup]", "recipe[security::setup]"] from CLI options
[2016-12-15T13:58:14+00:00] INFO: Run List is [recipe[cassandra-php-driver::setup], recipe[security::setup]]
[2016-12-15T13:58:14+00:00] INFO: Run List expands to [cassandra-php-driver::setup, security::setup]
[2016-12-15T13:58:14+00:00] INFO: Starting Chef Run for script.localdomain
[2016-12-15T13:58:14+00:00] INFO: Running start handlers
[2016-12-15T13:58:14+00:00] INFO: Start handlers complete.
[2016-12-15T13:58:14+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: 
[2016-12-15T13:58:14+00:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: apt

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: apt

Expanded Run List:
------------------
* cassandra-php-driver::setup
* security::setup

Platform:
---------
x86_64-linux

[2016-12-15T13:58:14+00:00] ERROR: Running exception handlers
[2016-12-15T13:58:14+00:00] ERROR: Exception handlers complete
[2016-12-15T13:58:14+00:00] FATAL: Stacktrace dumped to /var/chef/runs/a679dc7b-3cbf-4d43-9bc8-5ae0223d3b5f/local-mode-cache/cache/chef-stacktrace.out
[2016-12-15T13:58:14+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-12-15T13:58:14+00:00] ERROR: 412 "Precondition Failed"
[2016-12-15T13:58:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

【问题讨论】:

使云形成模板在开始失败时不回滚..在高级下你会找到这个选项。然后通过 SSH 连接到未正确构建的服务器,并找到 opsworks/chef 日志进行读取。或在没有发生模板回滚的情况下从 opsworks UI 区域查看日志。 @PaulDunlop 实际上,我成功地使用说明书手动创建了实例。但是当我使用模板时它总是在启动/启动时失败。我添加了日志有人知道如何解决这个问题吗? 【参考方案1】:

从错误消息来看,您的说明书存储库中似乎不存在您的可传递说明书依赖项 (apt)。

AWS OpsWorks 的 Berkshelf 支持显然在不同版本之间发生了变化。只有 Chef 11.10 OpsWorks 版本具有 built-in Berkshelf support,但随后从 Chef 12 OpsWorks 版本中删除。

如果您的 CloudFormation 管理的 OpsWorks 堆栈使用的是 Chef 版本 12,并且您没有在其他地方使用 Berkshelf 打包您的说明书依赖项,我建议您指定 Chef 版本 11.10,或者按照Packaging Cookbook Dependencies Locally 文档中指定的流程将您的说明书依赖项打包到本地,并将打包的说明书存储库用作您的自定义说明书源。

【讨论】:

以上是关于Opsworks 实例无法启动:状态:start_failed:没有这样的食谱:apt的主要内容,如果未能解决你的问题,请参考以下文章

启动实例的 OpsWorks 角色

实例的 AWS OpsWorks setup_failed - 无法部署_branch

我的 OpsWorks 实例在关闭五分钟后自行启动 - 为啥?

是否可以使用 AWS CLI 等到实例“在线”并完成 opsworks 的设置/配置步骤?

如何启动基于负载的 opsworks 实例?

从 EC2 上的自定义 AMI 创建 AWS Opsworks 实例时未启动