

支援終止通知：2026 年 10 月 7 日 AWS 將停止 的支援 AWS IoT Greengrass Version 1。2026 年 10 月 7 日之後，您將無法再存取 AWS IoT Greengrass V1 資源。如需詳細資訊，請造訪[從 遷移 AWS IoT Greengrass Version 1](https://docs.aws.amazon.com/greengrass/v2/developerguide/migrate-from-v1.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# IDT 故障 AWS IoT Greengrass 診斷
<a name="idt-troubleshooting"></a>

IDT for 會根據錯誤類型將這些錯誤 AWS IoT Greengrass 寫入各種位置。錯誤會寫入主控台、日誌檔和測試報告。

## 錯誤代碼
<a name="bk-error-codes"></a>

下表列出由 IDT for AWS IoT Greengrass產生的錯誤代碼。


| 錯誤碼 | 錯誤代碼名稱 | 可能的根本原因 | 疑難排解 | 
| --- | --- | --- | --- | 
| 101 | InternalError | 發生內部錯誤。 | 檢查 `{{<device-tester-extract-location>}}/results` 目錄下的日誌。如果您無法偵錯問題，請聯絡 [AWS 開發人員支援](https://aws.amazon.com/premiumsupport/plans/developers/)。 | 
| 102 | TimeoutError | 無法在限定的時間範圍內完成測試。可能發生這種情況的原因：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)  | 
| 103 | PlatformNotSupportError | 在 `device.json` 中指定了不正確的作業系統/架構組合。 | 變更組態為其中一項支援的組合：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)<br />如需詳細資訊，請參閱[設定 device.json](set-config.md#device-config)。 | 
| 104 | VersionNotSupportError | 您使用的 IDT 版本不支援 AWS IoT Greengrass 核心軟體版本。 | 使用 **device\_tester\_bin version**命令來尋找 AWS IoT Greengrass Core 軟體的支援版本。例如，如果您使用的是 macOS，請使用 **./devicetester\_mac\_x86\_64 version**。<br />若要尋找您正在使用 AWS IoT Greengrass 的核心軟體版本：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)<br />您可以測試不同版本的 AWS IoT Greengrass 核心軟體。如需詳細資訊，請參閱[入門 AWS IoT Greengrass](gg-gs.md)。 | 
| 105 | LanguageNotSupportError | IDT 僅支援適用於 AWS IoT Greengrass 程式庫和 SDKs Python。 | 請確定：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) | 
| 106 | ValidationError | `device.json` 或 `config.json` 中的某些欄位無效。 | 請查看報告中錯誤代碼右側的錯誤訊息。[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) | 
| 107 | SSHConnectionFailed | 測試機器無法連接到設定的裝置。 | 確認 `device.json` 檔案中的以下欄位正確：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)<br />如需詳細資訊，請參閱[設定 device.json](set-config.md#device-config)。 | 
| 108 | RunCommandError | 測試無法在待測裝置上執行命令。 | 確認允許 `device.json` 中的設定使用者進行根存取。<br />執行具有根存取的命令時，某些裝置必須輸入密碼。確定允許在沒有密碼的情況下進行根存取。如需更多詳細資訊，請參閱您的裝置文件。<br />在裝置上嘗試手動執行失敗的命令，以查看是否發生錯誤。 | 
| 109 | PermissionDeniedError | 無根存取。 | 在裝置上為設定的使用者設定根存取。 | 
| 110 | CreateFileError | 無法建立檔案。 | 檢查裝置的磁碟空間和目錄許可。 | 
| 111 | CreateDirError | 無法建立目錄。 | 檢查裝置的磁碟空間和目錄許可。 | 
| 112 | InvalidPathError | Core AWS IoT Greengrass 軟體的路徑不正確。 | 請確認錯誤訊息中的路徑有效。請勿編輯 `devicetester_greengrass_{{<os>}}` 目錄下的任何檔案。 | 
| 113 | InvalidFileError | 檔案無效。 | 確認錯誤訊息中的檔案有效。 | 
| 114 | ReadFileError | 無法讀取指定的檔案。 | 請確認下列內容：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)<br />如果您是在 MacOS 上測試，請提高開啟檔案限制。預設限制為 256，這對測試而言已足夠。 | 
| 115 | FileNotFoundError | 找不到需要的檔案。 | 請確認下列內容：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) | 
| 116 | OpenFileFailed | 無法開啟指定的檔案。 | 請確認下列內容：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)<br />如果您是在 MacOS 上測試，請提高開啟檔案限制。預設限制為 256，這對測試而言已足夠。 | 
| 117 | WriteFileFailed | 無法寫入檔案 (可以是 DUT 或測試機器)。 | 確認錯誤訊息中指定的目錄存在，而且您具有寫入許可。 | 
| 118 | FileCleanUpError | 測試無法移除指定檔案或目錄，或無法在遠端裝置上卸載指定檔案。 | 如果二進位檔案仍在執行，檔案可能會鎖定。結束程序並刪除指定檔案。 | 
| 119 | InvalidInputError | 無效的組態。 | 確認您的 `suite.json` 檔案是否有效。 | 
| 120 | InvalidCredentialError | 無效的 AWS 登入資料。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)  | 
| 121 | AWSSessionError | 無法建立 AWS 工作階段。 | 如果 AWS 登入資料無效或網際網路連線不穩定，可能會發生此錯誤。嘗試使用 AWS CLI 呼叫 AWS API 操作。 | 
| 122 | AWSApiCallError | 發生 AWS API 錯誤。 | 此錯誤可能是網路問題造成的。請檢查您的網路，然後再重試測試群組。 | 
| 123 | IpNotExistError | IP 地址未包含於連線資訊。 | 請檢查您的網際網路連線。您可以使用 AWS IoT Greengrass 主控台來檢查測試所使用之 AWS IoT Greengrass 核心物件的連線資訊。如果連線資訊中包含 10 個端點，您可以移除一些或全部，再重新執行測試。如需詳細資訊，請參閱[連線資訊](https://docs.aws.amazon.com/cli/latest/reference/greengrass/get-connectivity-info.html)。 | 
| 124 | OTAJobNotCompleteError | OTA 任務未完成。 | 請檢查網際網路連線並重試 OTA 測試群組。 | 
| 125 | CreateGreengrassServiceRoleError | 發生以下其中一項：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) | 設定 AWS IoT Greengrass 服務角色。如需詳細資訊，請參閱[Greengrass 服務角色](service-role.md)。 | 
| 126 | DependenciesNotPresentError | 特定測試所需的一或多個相依性不存在裝置上。 | 檢查測試日誌以查看裝置上缺少哪些相依性：`{{<device-tester-extract-location>}}/results/{{<execution-id>}}/logs/{{<test-case-name.log>}}` | 
| 127 | InvalidHSMConfiguration | 提供的 HSM/PKCS 組態不正確。 | 在您的 `device.json` 檔案中，使用 PKCS\#11 提供與 HSM 互動所需的正確組態。 | 
| 128 | OTAJobNotSuccededError | OTA 任務未成功。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html)  | 
| 129 | NoConnectivityError | 主機代理程式無法連線到網際網路。 | 檢查您的網路連線和防火牆設定。解決連線問題之後，請重試測試群組。 | 
| 130 | NoPermissionError | 您用來執行 IDT for 的 IAM 使用者 AWS IoT Greengrass 沒有建立執行 IDT 所需 AWS 資源的許可。 | 請參閱[授予](https://docs.aws.amazon.com/greengrass/latest/developerguide/policy-template.html)執行 IDT for 所需許可的政策範本的許可政策範本 AWS IoT Greengrass。 | 
| 131 | LeftoverAgentExistError | 當您嘗試啟動 IDT for 時，您的裝置正在執行 AWS IoT Greengrass 程序 AWS IoT Greengrass。 | 請確定沒有現有的 Greengrass 協助程式正在您的裝置上執行。[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/greengrass/v1/developerguide/idt-troubleshooting.html) 如果您使用的是 AWS IoT Greengrass 設定為在重新啟動後自動啟動的現有 安裝，您必須在重新啟動後和執行測試套件之前停止協助程式。  | 
| 132 | DeviceTimeOffsetError | 裝置的時間不正確。 | 請將裝置設定為正確的時間。 | 
| 133 | InvalidMLConfiguration | 提供的 ML 組態不正確。 | 在您的 `device.json` 檔案中，提供執行 ML 推論測試所需的正確組態。如需詳細資訊，請參閱[選用：設定您的裝置以取得 ML 資格](idt-ml-qualification.md)。 | 

## 解決 IDT 的 AWS IoT Greengrass 錯誤
<a name="idt-gg-resolve-errors"></a>

使用 IDT 時，您必須先取得正確的組態檔案，才能執行 IDT for AWS IoT Greengrass。如果您遇到剖析和組態錯誤，您的第一個步驟是找到並使用適合您的環境的組態範本。

如果您仍然有問題，請參閱下列除錯程序。

**Topics**
+ [哪裡可以尋找錯誤？](#where-to-look)
+ [剖析錯誤](#parse-error)
+ [遺漏必要參數錯誤](#param-missing)
+ [無法開始測試錯誤](#could-not-start-test)
+ [未授權存取資源錯誤](#not-authorized-to-access-resource)
+ [拒絕許可錯誤](#pwd-sudo)
+ [SSH 連線錯誤](#ssh-connect-errors)
+ [逾時錯誤](#test-timeout)
+ [測試時發生找不到錯誤命令](#cmd-not-found)
+ [macOS 上的安全例外狀況](#macos-notarization-exception)

### 哪裡可以尋找錯誤？
<a name="where-to-look"></a>

執行期間會在主控台顯示高階錯誤，當所有測試完成時，將會顯示含有錯誤的失敗測試的摘要。`awsiotdevicetester_report.xml` 包含造成測試失敗的所有錯誤的摘要。每次執行完測試的日誌檔會存放在以測試執行的 UUID (在測試執行期間顯示於主控台) 所命名的目錄中。

測試日誌目錄位於 `{{<device-tester-extract-location>}}/results/{{<execution-id>}}/logs/`。此目錄包含下列檔案，有助於除錯。


| 檔案 | Description | 
| --- | --- | 
| test\_manager.log | 測試執行期間寫入主控台的所有日誌。結果摘要位於這個檔案的尾端，其中包含失敗測試的清單。<br />這個檔案中的警告和錯誤日誌提供有關失敗的一些資訊。 | 
| {{<test-group-id>}}\_\_{{<test-name>}}.log | 特定測試的詳細日誌。 | 
| {{<test-name>}}\_ggc\_logs.tar.gz | 測試期間產生之 AWS IoT Greengrass 核心協助程式的所有日誌壓縮集合。如需詳細資訊，請參閱[疑難排解 AWS IoT Greengrass](https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-troubleshooting.html)。 | 
| {{<test-name>}}\_ota\_logs.tar.gz | 測試期間 OTA AWS IoT Greengrass 代理程式產生的日誌壓縮集合。僅適用於 OTA 測試。 | 
| {{<test-name>}}\_basic\_assertion\_publisher\_ggad\_logs.tar.gz |  AWS IoT 發佈者裝置在測試期間所產生之日誌的壓縮集合。 | 
| {{<test-name>}}\_basic\_assertion\_subscriber\_ggad\_logs.tar.gz |  AWS IoT 訂閱者裝置在測試期間所產生之日誌的壓縮集合。 | 

### 剖析錯誤
<a name="parse-error"></a>

JSON 組態中的錯字有時會導致剖析錯誤。在大部分的情況下，問題是出在 JSON 檔案中省略了括弧、逗號或引號。IDT 會執行 JSON 驗證並列印除錯資訊。該工具會印出發生錯誤的行、行號和語法錯誤的欄號。此資訊應該足以協助您修正錯誤，但如果仍找不到錯誤，則您可以在 IDE、文字編輯器 (例如 Atom 或 Sublime) 或透過線上工具 (如 JSONLint) 手動執行驗證。

### 遺漏必要參數錯誤
<a name="param-missing"></a>

由於新功能會新增到 IDT，可能需要變更組態檔案。使用舊的組態檔案可能會破壞組態。如果發生這種情況，`/results/{{<execution-id>}}/logs` 下的 `{{<test_case_id>}}.log` 檔案會明確列出所有遺漏的參數。IDT 也會驗證您的 JSON 組態檔案結構描述，以確保使用最新支援的版本。

### 無法開始測試錯誤
<a name="could-not-start-test"></a>

您可能遇到錯誤，指向測試開始期間發生的失敗。有數種可能的原因，因此，請執行下列動作：
+ 確定您在執行命令中包含的集區名稱實際存在。集區名稱是直接從您的 `device.json` 檔案參考。
+ 確保您集區中的裝置都有正確的組態參數。

### 未授權存取資源錯誤
<a name="not-authorized-to-access-resource"></a>

您可能會在終端機輸出或 `/results/{{<execution-id>}}/logs` 下方的 `test_manager.log` 檔案中看到 `<user or role> is not authorized to access this resource` 錯誤訊息 。若要解決這個問題，請將 `AWSIoTDeviceTesterForGreengrassFullAccess` 受管政策連接到您的測試使用者。如需詳細資訊，請參閱[建立和設定 AWS 帳戶](dev-tst-prereqs.md#config-aws-account-for-idt)。

### 拒絕許可錯誤
<a name="pwd-sudo"></a>

IDT 會在待測裝置的各種目錄和檔案上執行操作。這些操作中有些需要根存取。IDT 必須能夠在不輸入密碼的情況下使用 sudo 執行命令，才能自動化這些操作。

依照以下步驟，在不輸入密碼的情況下允許 sudo 存取。

**注意**  
`user` 和 `username` 是指 IDT 存取待測裝置時所使用的 SSH 使用者。

1. 使用 **sudo usermod -aG sudo {{<ssh-username>}}** 將您的 SSH 使用者新增至 sudo 群組。

1. 登出後再登入，以使變更生效。

1. 開啟 `/etc/sudoers` 檔案，然後在檔案結尾處新增以下一行：`{{<ssh-username>}} ALL=(ALL) NOPASSWD: ALL`
**注意**  
最佳實務為建議您在編輯 `/etc/sudoers` 時使用 **sudo visudo**。

### SSH 連線錯誤
<a name="ssh-connect-errors"></a>

當 IDT 無法連接到待測裝置時，會在 `/results/{{<execution-id>}}/logs/{{<test-case-id>}}.log` 中記錄連線失敗。SSH 失敗訊息會出現在此日誌檔的頂端，因為連線到待測裝置是 IDT 最先執行的其中一個操作。

大多數的 Windows 設定會使用 PuTTy 終端機應用程式連線到 Linux 主機。此應用程式要求標準的 PEM 私有金鑰檔案轉換為專屬的 Windows 格式，稱為 PPK。在 `device.json` 檔案中設定 IDT，請只使用 PEM 檔案。如果您使用 PPK 檔案，IDT 無法與 AWS IoT Greengrass 裝置建立 SSH 連線，也無法執行測試。

### 逾時錯誤
<a name="test-timeout"></a>

您可以指定逾時乘數 (套用到每次測試的逾時預設值)，以延長每次測試的逾時。此旗標設定的任何值必須大於或等於 1.0。

若要使用逾時乘數，請在執行測試時使用旗標 `--timeout-multiplier`。例如：

```
./devicetester_linux run-suite --suite-id GGQ_1.0.0 --pool-id DevicePool1 --timeout-multiplier 2.5
```

如需詳細資訊，請執行 `run-suite --help`。

### 測試時發生找不到錯誤命令
<a name="cmd-not-found"></a>

您需要較舊版本的 OpenSSL 程式庫 (libssl1.0.0)，才能在 AWS IoT Greengrass 裝置上執行測試。目前的 Linux 發行版本大多使用 libssl 版本 1.0.2 或更新版本 (v1.1.0)。

例如，在 Raspberry Pi 中執行以下命令，安裝所需的 libssl 版本：

1. 

   ```
   wget http://ftp.us.debian.org/debian/pool/main/o/openssl/libssl1.0.0_1.0.2l-1~bpo8+1_armhf.deb
   ```

1. 

   ```
   sudo dpkg -i libssl1.0.0_1.0.2l-1~bpo8+1_armhf.deb
   ```

### macOS 上的安全例外狀況
<a name="macos-notarization-exception"></a>

當您在使用 macOS 10.15 的主機電腦上執行 IDT 時，無法正確偵測 IDT 的公證票證，且 IDT 會遭到封鎖而無法執行。若要執行 IDT，您需要將安全性例外狀況授予`devicetester_mac_x86-64`可執行檔。

**將安全性例外狀況授予 IDT 可執行檔**

1. 從 Apple 選單啟動**系統偏好設定**。

1. 選擇**安全與隱私權**，然後在**一般**索引標籤上，按一下鎖定圖示以變更安全設定。

1. 尋找訊息`"devicetester_mac_x86-64" was blocked from use because it is not from an identified developer.`，然後選擇**允許任何方式**。

1. 接受安全警告。

如果您對 IDT 支援政策有任何疑問，請聯絡[AWS 客戶支援](https://aws.amazon.com/contact-us/)。