

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Chef 日志
<a name="troubleshoot-debug-log"></a>

**重要**  
该 AWS OpsWorks Stacks 服务于 2024 年 5 月 26 日终止，新客户和现有客户均已禁用。我们强烈建议客户尽快将其工作负载迁移到其他解决方案。如果您对迁移有疑问，请通过 re [AWS : Post 或通过 Pre](https://repost.aws/) mium Su [AWS pp](https://aws.amazon.com/support) ort 与 AWS 支持 团队联系。

Chef 日志是您的关键故障排除资源之一，尤其是在调试配方方面。 OpsWorks Stacks 会捕获每个命令的 Chef 日志，并保留实例最近 30 个命令的日志。由于运行处于调试模式，因此该日志包含 Chef 运行的详细描述，包括发送到 `stdout` 和 `stderror` 的文本。如果配方失败，则该日志将包含 Chef 堆栈跟踪。

OpsWorks Stacks 为你提供了几种查看 Chef 日志的方法。拥有该日志信息后，您可用它来调试失败的配方。

**注意**  
您还可以通过使用 SSH 连接到实例并运行代理 CLI `show_log` 命令，来查看指定日志的结尾。有关更多信息，请参阅 [显示 Chef 日志](troubleshoot-debug-cli.md#troubleshoot-debug-cli-log)。

**Topics**
+ [使用控制台查看 Chef 日志](#troubleshoot-debug-log-console)
+ [使用 CLI 或 API 查看 Chef 日志](#troubleshoot-debug-log-cli)
+ [在实例上查看 Chef 日志](#troubleshoot-debug-log-instance)
+ [解释 Chef 日志](#troubleshoot-debug-log-interpret)
+ [常见 Chef 日志错误](#troubleshoot-debug-log-errors)

## 使用控制台查看 Chef 日志
<a name="troubleshoot-debug-log-console"></a>

查看 Chef 日志最简单的方法是，转到实例的详细信息页面。对于每个事件和**执行配方**命令，[日志](workingstacks-commands.md)章节均包含一个条目。下面显示了实例的 **Logs** 部分，该实例使用了 **configure** 和 **setup** 命令，分别对应于 Configure 和 Setup 生命周期事件。

![\[Logs section showing configure and setup commands with timestamps and durations.\]](http://docs.aws.amazon.com/zh_cn/opsworks/latest/userguide/images/gs11.png)


单击相应命令**日志**列中的**显示**，可查看对应的 Chef 日志。如果发生错误， OpsWorks Stacks 会自动打开错误日志，该日志通常位于文件末尾。

## 使用 CLI 或 API 查看 Chef 日志
<a name="troubleshoot-debug-log-cli"></a>

您可以使用 OpsWorks Stacks CLI [https://docs.aws.amazon.com/cli/latest/reference/opsworks/describe-commands.html](https://docs.aws.amazon.com/cli/latest/reference/opsworks/describe-commands.html)命令或 [https://docs.aws.amazon.com/opsworks/latest/APIReference/API_DescribeCommands.html](https://docs.aws.amazon.com/opsworks/latest/APIReference/API_DescribeCommands.html)API 操作来查看存储在 Amazon S3 存储桶中的日志。以下过程演示了如何使用 CLI 来查看指定实例的任何当前日志文件。使用 `DescribeCommands` 的过程基本类似。

**使用 OpsWorks 堆栈查看实例的 Chef 日志**

1. 打开实例的详细信息页面并复制其 **OpsWorksID** 值。

1. 使用该 ID 值运行 `describe-commands` CLI 命令，如下所示：

   ```
   aws opsworks describe-commands --instance-id 67bf0da2-29ed-4217-990c-d895d51812b9
   ```

   该命令返回一个 JSON 对象，其中包含一个 OpsWorks Stacks 在实例上执行的每个命令的嵌入式对象，最新的命令排在最前面。在本示例中，`Type` 参数包含每个命令嵌入式对象的命令类型、`configure` 命令和 `setup` 命令。

   ```
   {
       "Commands": [
           {
               "Status": "successful",
               "CompletedAt": "2013-10-25T19:38:36+00:00",
               "InstanceId": "67bf0da2-29ed-4217-990c-d895d51812b9",
               "AcknowledgedAt": "2013-10-25T19:38:24+00:00",
               "LogUrl": "https://s3.amazonaws.com/prod_stage-log/logs/b6c402df-5c23-45b2-a707-ad20b9c5ae40?AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
   &Expires=1382731518&Signature=YkqS5IZN2P4wixjHwoC3aCMbn5s%3D&response-cache-control=private&response-content-encoding=gzip&response-content-
   type=text%2Fplain",
               "Type": "configure",
               "CommandId": "b6c402df-5c23-45b2-a707-ad20b9c5ae40",
               "CreatedAt": "2013-10-25T19:38:11+00:00",
               "ExitCode": 0
           },
           {
               "Status": "successful",
               "CompletedAt": "2013-10-25T19:31:08+00:00",
               "InstanceId": "67bf0da2-29ed-4217-990c-d895d51812b9",
               "AcknowledgedAt": "2013-10-25T19:29:01+00:00",
               "LogUrl": "https://s3.amazonaws.com/prod_stage-log/logs/2a90e862-f974-42a6-9342-9a4f03468358?AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
   &Expires=1382731518&Signature=cxKYHO8mCCd4MvOyFb6ywebeQtA%3D&response-cache-control=private&response-content-encoding=gzip&response-content-
   type=text%2Fplain",
               "Type": "setup",
               "CommandId": "2a90e862-f974-42a6-9342-9a4f03468358",
               "CreatedAt": "2013-10-25T19:26:01+00:00",
               "ExitCode": 0
           }
       ]
   }
   ```

1. 将 `LogUrl` 值复制到您的浏览器以查看日志。

如果实例具有多个命令，您可以向 `describe-commands` 中添加参数，来筛选响应对象应包含的命令。有关更多信息，请参阅 [describe-commands](https://docs.aws.amazon.com/cli/latest/reference/opsworks/describe-commands.html)。

## 在实例上查看 Chef 日志
<a name="troubleshoot-debug-log-instance"></a>

**注意**  
该部分中的主题适用于 Chef 12。有关 Chef 11.10 及更低版本的 Chef 日志的位置信息，请参阅[为 Linux 进行 Chef 11.10 和早期版本的故障排除](https://docs.aws.amazon.com/opsworks/latest/userguide/troubleshooting-chef-11-linux.html)。

### Linux 实例
<a name="troubleshoot-debug-log-instance-linux"></a>

OpsWorks 堆栈将每个实例的 Chef 日志存储在其`/var/chef/runs`目录中。(对于 Linux 实例，此目录还包括相关的[数据包](data-bags.md)，存储为 JSON 格式的文件。) 您需要 [sudo 权限](opsworks-security-users.md)来访问此目录。每个运行的日志位于各个运行的子目录内名为 `chef.log` 的文件中。

OpsWorks Stacks 将其内部日志存储在实例的`/var/log/aws/opsworks`文件夹中。通常，该信息在故障排除时不是很有帮助。但是，这些日志对 OpsWorks Stacks支持很有用，如果您遇到服务问题，可能会要求您提供这些日志。Linux 日志有时也能提供有用的故障排除数据。

### Windows 实例
<a name="troubleshoot-debug-log-instance-windows"></a>

**代理日志**  
在 Windows 实例上， OpsWorks 日志存储在如下`ProgramData`路径中。其中的 number 包含时间戳。

```
C:\ProgramData\OpsWorksAgent\var\logs\number
```

**注意**  
默认情况下，`ProgramData` 是一个隐藏文件夹。要取消隐藏该文件夹，请导航到 **Folder Options**。在 **View** 下，选择该选项来显示隐藏的文件。

以下示例显示的是 Windows 实例上的代理日志。

```
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         5/24/2015  11:59 PM     127277 command.20150524.txt
-a---         5/25/2015  11:59 PM     546772 command.20150525.txt
-a---         5/26/2015  11:59 PM     551514 command.20150526.txt
-a---         5/27/2015   9:43 PM     495181 command.20150527.txt
-a---         5/24/2015  11:59 PM      24353 keepalive.20150524.txt
-a---         5/25/2015  11:59 PM     106232 keepalive.20150525.txt
-a---         5/26/2015  11:59 PM     106208 keepalive.20150526.txt
-a---         5/27/2015   8:54 PM      92593 keepalive.20150527.txt
-a---         5/24/2015   7:19 PM       3891 service.20150524.txt
-a---         5/27/2015   8:54 PM       1493 service.20150527.txt
-a---         5/24/2015  11:59 PM     112549 wire.20150524.txt
-a---         5/25/2015  11:59 PM     501501 wire.20150525.txt
-a---         5/26/2015  11:59 PM     499640 wire.20150526.txt
-a---         5/27/2015   8:54 PM     436870 wire.20150527.txt
```

**Chef 日志**  
在 Windows 实例上，Chef 日志存储在 `ProgramData` 路径下，如下所示。其中的 number 包含时间戳。

```
C:\ProgramData\OpsWorksAgent\var\commands\number
```

**注意**  
此目录仅包含第一次（OpsWorks 自有）Chef 运行的输出。

以下示例显示了 Windows 实例上 OpsWorks 拥有的 Chef 日志。

```
 Mode                LastWriteTime            Name
 ----                -------------            ----
 d----         5/24/2015   7:23 PM            configure-7ecb5f47-7626-439b-877f-5e7cb40ab8be
 d----         5/26/2015   8:30 PM            configure-8e74223b-d15d-4372-aeea-a87b428ffc2b
 d----         5/24/2015   6:34 PM            configure-c3980a1c-3d08-46eb-9bae-63514cee194b
 d----         5/26/2015   8:32 PM            grant_remote_access-70dbf834-1bfa-4fce-b195-e50e85402f4c
 d----         5/26/2015  10:30 PM            revoke_remote_access-1111fce9-843a-4b27-b93f-ecc7c5e9e05b
 d----         5/24/2015   7:21 PM            setup-754ec063-8b60-4cd4-b6d7-0e89d7b7aa78
 d----         5/26/2015   8:27 PM            setup-af5bed36-5afd-4115-af35-5766f88bc039
 d----         5/24/2015   6:32 PM            setup-d8abeffa-24d4-414b-bfb1-4ad07319f358
 d----         5/24/2015   7:13 PM            shutdown-c7130435-9b5c-4a95-be17-6b988fc6cf9a
 d----         5/26/2015   8:25 PM            sync_remote_users-64c79bdc-1f6f-4517-865b-23d2def4180c
 d----         5/26/2015   8:48 PM            update_custom_cookbooks-2cc59a94-315b-414d-85eb-2bdea6d76c6a
```

**用户 Chef 日志**  
Chef 运行的日志可在名为 `logfile.txt` 的文件中找到，该文件位于以带编号的 Chef 命令命名的文件夹中，如下图所示。

 C:/chef └── `runs` └── `command-12345` ├── `attribs.json` ├── `client.rb` └── `logfile.txt` 

## 解释 Chef 日志
<a name="troubleshoot-debug-log-interpret"></a>

日志的开头主要包含内部 Chef 日志记录。

```
# Logfile created on Thu Oct 17 17:25:12 +0000 2013 by logger.rb/1.2.6
[2013-10-17T17:25:12+00:00] INFO: *** Chef 11.4.4 ***
[2013-10-17T17:25:13+00:00] DEBUG: Building node object for php-app1.localdomain
[2013-10-17T17:25:13+00:00] DEBUG: Extracting run list from JSON attributes provided on command line
[2013-10-17T17:25:13+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2013-10-17T17:25:13+00:00] DEBUG: Applying attributes from json file
[2013-10-17T17:25:13+00:00] DEBUG: Platform is amazon version 2013.03
[2013-10-17T17:25:13+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2013-10-17T17:25:13+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute]
[2013-10-17T17:25:13+00:00] INFO: Starting Chef Run for php-app1.localdomain
[2013-10-17T17:25:13+00:00] INFO: Running start handlers
[2013-10-17T17:25:13+00:00] INFO: Start handlers complete.
[2013-10-17T17:25:13+00:00] DEBUG: No chefignore file found at /opt/aws/opsworks/releases/20131015111601_209/cookbooks/chefignore no files will be ignored
[2013-10-17T17:25:13+00:00] DEBUG: Cookbooks to compile: ["gem_support", "packages", "opsworks_bundler", "opsworks_rubygems", "ruby", "ruby_enterprise", "dependencies", "opsworks_commons", "scm_helper", :opsworks_custom_cookbooks]
[2013-10-17T17:25:13+00:00] DEBUG: Loading cookbook gem_support's library file: /opt/aws/opsworks/releases/20131015111601_209/cookbooks/gem_support/libraries/current_gem_version.rb
[2013-10-17T17:25:13+00:00] DEBUG: Loading cookbook packages's library file: /opt/aws/opsworks/releases/20131015111601_209/cookbooks/packages/libraries/packages.rb
[2013-10-17T17:25:13+00:00] DEBUG: Loading cookbook dependencies's library file: /opt/aws/opsworks/releases/20131015111601_209/cookbooks/dependencies/libraries/current_gem_version.rb
[2013-10-17T17:25:13+00:00] DEBUG: Loading cookbook opsworks_commons's library file: /opt/aws/opsworks/releases/20131015111601_209/cookbooks/opsworks_commons/libraries/activesupport_blank.rb
[2013-10-17T17:25:13+00:00] DEBUG: Loading cookbook opsworks_commons's library file: /opt/aws/opsworks/releases/20131015111601_209/cookbooks/opsworks_commons/libraries/monkey_patch_chefgem_resource.rb
...
```

文件的这一部分对 Chef 专家非常有用。请注意，运行列表仅包含两个配方，尽管大多数命令会涉及更多配方。这两个配方负责处理加载和执行所有其他内置和自定义配方的任务。

文件最相关的部分通常在文件末尾。如果运行成功结束，您应看到与以下类似的内容：

```
...
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: STDERR: 
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: ---- End output of /sbin/service mysqld restart ----
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: Ran /sbin/service mysqld restart returned 0
[Tue, 11 Jun 2013 16:00:50 +0000] INFO: service[mysql]: restarted successfully
[Tue, 11 Jun 2013 16:00:50 +0000] INFO: Chef Run complete in 84.07096 seconds
[Tue, 11 Jun 2013 16:00:50 +0000] INFO: cleaning the checksum cache
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: removing unused checksum cache file /var/chef/cache/checksums/chef-file--tmp-chef-rendered-template20130611-4899-8wef7e-0
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: removing unused checksum cache file /var/chef/cache/checksums/chef-file--tmp-chef-rendered-template20130611-4899-1xpwyb6-0
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: removing unused checksum cache file /var/chef/cache/checksums/chef-file--etc-monit-conf
[Tue, 11 Jun 2013 16:00:50 +0000] INFO: Running report handlers
[Tue, 11 Jun 2013 16:00:50 +0000] INFO: Report handlers complete
[Tue, 11 Jun 2013 16:00:50 +0000] DEBUG: Exiting
```

**注意**  
您可以使用代理 CLI 以在运行过程中或运行之后显示日志的结尾。有关更多信息，请参阅 [显示 Chef 日志](troubleshoot-debug-cli.md#troubleshoot-debug-cli-log)。

如果配方失败，您应查找 ERROR 级别的输出，该输出将包含异常信息，后跟 Chef 堆栈跟踪，如下所示：

```
...
Please report any problems with the /usr/scripts/mysqlbug script!

[  OK  ]
MySQL Daemon failed to start.
Starting mysqld:  [FAILED]STDERR: 130611 15:07:55 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
130611 15:07:56 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
---- End output of /sbin/service mysqld start ----

/opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/mixin/command.rb:184:in `handle_command_failures'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/mixin/command.rb:131:in `run_command'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/provider/service/init.rb:37:in `start_service'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/provider/service.rb:60:in `action_start'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource.rb:406:in `send'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource.rb:406:in `run_action'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/runner.rb:53:in `run_action'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/runner.rb:89:in `converge'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/runner.rb:89:in `each'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/runner.rb:89:in `converge'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/runner.rb:84:in `converge'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/client.rb:268:in `converge'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/client.rb:158:in `run'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/application/solo.rb:190:in `run_application'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/application/solo.rb:181:in `loop'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/application/solo.rb:181:in `run_application'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/application.rb:62:in `run'
  /opt/aws/opsworks/releases/20130605160141_122/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/chef-solo:25
  /opt/aws/opsworks/current/bin/chef-solo:16:in `load'
  /opt/aws/opsworks/current/bin/chef-solo:16
```

文件的末尾是 Chef 堆栈跟踪。您还应检查异常信息前面的输出内容，通常包含系统错误 (如 `package not available`)，该信息在确定故障原因时也很有用。在本例中，MySQL 守护程序启动失败。

## 常见 Chef 日志错误
<a name="troubleshoot-debug-log-errors"></a>

下面是一些常见的 Chef 日志错误，并介绍了如何解决这些问题。

找不到日志  
在 Chef 运行开始时，实例会收到一个预签名 Amazon S3 URL，该 URL 可让您在 Chef 运行完成后在网页上查看日志。由于此 URL 将在两小时后过期，因此，如果 Chef 运行时间超过两个小时，即使 Chef 运行期间没有出现任何问题，日志也不会上传到 Amazon S3 站点。创建日志的命令会成功，但仅可在实例上查看日志，而不能在预签名 URL 上查看。

日志意外结束  
如果 Chef 日志意外结束，没有指示成功或显示错误信息，您可能遇到内存不足的状态，从而阻止了 Chef 完成日志。您最好使用更大的实例重新尝试。

缺少说明书或配方  
如果 Chef 运行遇到说明书缓存内没有说明书或配方，您将看到与以下类似的内容：  

```
DEBUG: Loading Recipe mycookbook::myrecipe via include_recipe  
ERROR: Caught exception during execution of custom recipe: mycookbook::myrecipe:
   Cannot find a cookbook named mycookbook; did you forget to add metadata to a cookbook?
```
此条目表示说明书缓存中没有 `mycookbook` 说明书。使用 Chef 11.4，如果您没有在 `metadata.rb` 中正确声明依赖关系，也可能遇到此错误。  
OpsWorks Stacks 从实例的食谱缓存中运行食谱。它会在实例启动时将说明书从您的存储库下载到此缓存中。但是，如果您随后修改存储库中的食谱， OpsWorks Stacks 不会自动更新在线实例上的缓存。如果您在实例启动后，修改了说明书或添加了新的说明书，请执行以下步骤：  

1. 确保您已将更改提交到存储库。

1. 运行 [Update Cookbooks 堆栈命令](workingstacks-commands.md)以使用存储库中最新版本更新说明书缓存。

本地命令失败  
如果 Chef `execute` 资源无法执行指定的命令，您将看到与以下类似的内容：  

```
DEBUG: ---- End output of ./configure --with-config-file-path=/ returned 2 
ERROR: execute[PHP: ./configure] (/root/opsworks-agent/site-cookbooks/php-fpm/recipes/install.rb line 48) had an error:
   ./configure --with-config-file-path=/
```
向上滚动日志，您应该可以看到命令的 `stderr` 和 `stdout` 输出，该信息有助于您确定命令失败的原因。

软件包故障  
如果软件包安装失败，您将看到与以下类似的内容：  

```
ERROR: package[zend-server-ce-php-5.3] (/root/opsworks-agent/site-cookbooks/zend_server/recipes/install.rb line 20)
   had an error: apt-get -q -y --force-yes install zend-server-ce-php-5.3=5.0.4+b17 returned 100, expected 0
```
向上滚动日志，您应该可以看到命令的 STDOUT 和 STDERROR 输出，该信息有助于您确定软件包安装失败的原因。