跳至內容

如何對 Linux 伺服器上的 AWS Replication Agent 安裝失敗問題進行疑難排解?

4 分的閱讀內容
0

我想安裝用於 AWS Application Migration Service 或 AWS Elastic Disaster Recovery 的 AWS Replication Agent,但安裝失敗。

解決方法

若要在 Linux 來源伺服器中安裝 Application Migration Service 或 Elastic Disaster Recovery 複寫代理程式時自動識別問題,請使用 AWSSupport-TroubleshootLinuxMGNDRSAgentLogs 自動化執行手冊。執行手冊會使用 AWS Replication Agent 安裝日誌檔案,提供偵測到的錯誤清單及其解決方法。

在啟動 AWSSupport-TroubleshootLinuxMGNDRSAgentLogs 執行手冊之前,請確保您的 AWS Identity and Access Management (IAM) 使用者或角色具有所需的權限。如需詳細資訊,請參閱 AWSSupport-TroubleshootLinuxMGNDRSAgentLogs必要的 IAM 權限。另外,將 installer-path/aws_replication_agent_installer.log 複寫代理程式日誌檔案上傳到 Amazon Simple Storage Service (Amazon S3) 儲存貯體。

若要執行 AWSSupport-TroubleshootLinuxMGNDRSAgentLogs,請參閱 AWSSupport-TroubleshootLinuxMGNDRSAgentLogs 上的說明

ServiceName (必要) 設定下列輸入參數:

  • 若要使用 Application Migration Service ,請選取 AWS MGN
  • 若要使用 Elastic Disaster Recover,請選取 AWS DRS

或者,執行下列命令手動識別 AWS Replication Agent 安裝錯誤:

less +G installer-path/aws_replication_agent_installer.log

**注意:**將 installer-path 替換為安裝複寫代理程式的路徑。

根據您發現的錯誤,請使用以下疑難排解步驟來解決問題。

"failed to map segment from shared object: Operation not permitted" 錯誤

安裝指令碼使用 /tmp 目錄。如果您在 /tmp 上設定了 noexec,則 libz.so 會無法對應區段,且您會收到以下錯誤訊息:

"error while loading shared libraries: libz.so.1: failed to map segment from shared object: Operation not permitted"

若要解決此問題,請執行下列命令,以掛載具有執行權限的磁碟區:

# sudo mount /tmp -o remount,exec

如果您不想從 /tmp 目錄中移除 noexec,請將下列環境變數新增至命令:

TMPDIR='my_temp_dir' AGENT INSTALLATION COMMAND

**注意:**將 my_temp_dir 替換為不包含 noexec 的目錄,並將 AGENT INSTALLATION COMMAND 替換為您用於安裝代理程式的命令。

命令範例:

TMPDIR='temp1' sudo chmod +x aws-replication-installer-init; sudo ./aws-replication-installer-init

"security token included in the request is expired" 錯誤

如果您的 IAM 角色過期,則對 Application Migration Service 或 Elastic Disaster Recovery 端點的 API 呼叫將失敗,並且您將收到以下錯誤訊息:

"botocore.exceptions.ClientError: An error occurred (ExpiredTokenException) when calling the GetAgentInstallationAssetsForDrs operation: The security token included in the request is expired [installation_id: 1a9af9d3-9485-4e02-965e-611929428c61, agent_version: 3.7.0, mac_addresses: 206915885515739,206915885515740, _origin_client_type: installer]"

若要解決此問題,請請求臨時安全憑證,以產生新權杖。或者,使用 Application Migration ServiceElastic Disaster Recovery 的存取金鑰或私密存取金鑰安裝該角色。

"ssl.SSLCertVerificationError" 錯誤

如果您在較舊版本的作業系統 (OS) 上使用 Python 3.10 或更新版本,則可能會收到以下錯誤訊息:

"ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) - urllib.error.URLError: urlopen error unknown url type: https"

較舊版本的作業系統不包含支援 Python 3.10 的最新 OpenSSL 函式庫。如需詳細資訊,請參閱 Python Enhancement Proposals 網站上的 PEP 644 - 需要使用 OpenSSL 1.1.1 或更新版本。在這種情況下,AWS Replication Agent 安裝無法驗證 Application Migration Service 或 Elastic Disaster Recovery 端點的 SSL 憑證。

為避免此問題,請使用較早版本的 Python,例如 2.7 或 3.8。

**注意:**若要解決大部分 "urllib" 或 "SSL" 錯誤,請使用較早版本的 Python。

"botocore.exceptions.CredentialRetrievalError" 錯誤

修改 AWSElasticDisasterRecoveryAgentRoleAWSApplicationMigrationAgentRole IAM 服務角色時,您會收到下列錯誤訊息:

"botocore.exceptions.CredentialRetrievalError: Error when retrieving credentials from cert: Oct 17, 2022 9:38:54 AM com.amazonaws.cloudendure.credentials_provider.SharedMain createAndSaveJks"

若要解決此問題,請根據您使用的服務更新 IAM 服務角色的權限政策

Application Migration Service 權限政策:

{      "Version": "2012-10-17",  
    "Statement": [  
        {  
            "Effect": "Allow",  
            "Principal": {  
                "Service": "mgn.amazonaws.com"  
            },  
            "Action": [  
                "sts:AssumeRole",  
                "sts:SetSourceIdentity"  
            ],  
            "Condition": {  
                "StringLike": {  
                    "sts:SourceIdentity": "s-*",  
                    "aws:SourceAccount": "AWS-Account-Number"  
                }  
            }  
        }  
    ]

**注意:**將 AWS-Account-Number 替換為您的 AWS 帳戶 ID。

Elastic Disaster Recovery 權限政策:

{      "Version": "2012-10-17",  
    "Statement": [  
        {  
            "Effect": "Allow",  
            "Principal": {  
                "Service": "drs.amazonaws.com"  
            },  
            "Action": [  
                "sts:AssumeRole",  
                "sts:SetSourceIdentity"  
            ],  
            "Condition": {  
                "StringLike": {  
                    "sts:SourceIdentity": "s-*",  
                    "aws:SourceAccount": "AWS-Account-Number"  
                }  
            }  
        }  
    ]  
}

**注意:**將 AWS-Account-Number 替換為您的帳戶 ID。

"A dependency job for aws-replication.target failed" 錯誤

如果 /var 目錄具有 754 權限,或者您在為 aws-replication 使用者建立 Linux 群組時出現問題,則會收到以下錯誤訊息:

"stderr: A dependency job for aws-replication.target failed.See 'journalctl -xe' for details"

若要解決 /var 問題,請執行以下命令:

sudo chmod 755 /var

若要解決 Linux 群組問題,請完成以下步驟:

  1. 解除安裝用於 Application Migration ServiceElastic Disaster Recovery 的 AWS Replication Agent。

  2. 執行以下命令刪除 aws-replication 使用者和 aws-replication 群組:

    sudo userdel aws-replication
    sudo groupdel aws-replication
  3. 重新安裝用於 Application Migration ServiceElastic Disaster Recovery 的 AWS Replication Agent。

如需 Application Migration Service 的安裝先決條件,請參閱安裝要求。對於 Elastic Disaster Recovery,請參閱 AWS Replication Agent 的安裝要求

"Exception in thread "main" com.amazonaws.services.drs.model.InternalServerException" 錯誤

如果您停用 AWS Security Token Service (AWS STS) 端點,則會收到下列錯誤訊息:

"Exception in thread "main" com.amazonaws.services.drs.model.InternalServerException: An unexpected error has occurred (Service: Drs; Status Code: 500; Error Code: InternalServerException; Request ID: 4f4a76cb-aaec-44cc-a07a-c3579454ca55; Proxy: null"

發生此錯誤的原因是 Application Migration Service 和 Elastic Disaster Recovery 會呼叫 AWS STS 以在用戶端帳戶中擔任角色。若要解決此問題,請在用戶端中啟用 STS 端點

"could not insert module ./aws-replication-driver.ko:" 錯誤

如果您在來源伺服器上啟用了 SecureBoot,則會收到下列其中一個錯誤訊息:

"insmod: ERROR: could not insert module ./aws-replication-driver.ko: Required key not available"

-或-

"insmod: ERROR: could not insert module ./aws-replication-driver.ko: Key was rejected by service"

您無法在具有 Application Migration Service 或 Elastic Disaster Recovery 的 Linux 作業系統中使用 SecureBoot

若要解決此問題,請停用 Linux 作業系統的 SecureBoot

**注意:**通常,您可以使用 Hypervisor 來停用 SecureBoot

若要檢查 SecureBoot 狀態,請執行下列命令:

sudo mokutil --sb-state

"could not insert module ./aws-replication-driver.ko: Cannot allocate memory" 錯誤

如果您的 Linux 作業系統沒有足夠的記憶體來安裝代理程式,那麼您會收到以下錯誤訊息:

"insmod: ERROR: could not insert module ./aws-replication-driver.ko: Cannot allocate memory"

若要解決此問題,請確認您的作業系統在執行安裝時,至少有 300 MB 的可用記憶體。此問題可能是由於記憶體碎片化引起的。若要解決記憶體碎片化問題,請重新啟動來源伺服器。另外,檢查安全或防毒軟體 (例如 Falcon、Trend Micro、SentinelOne 或 McAfee) 是否會導致記憶體或核心保護,從而封鎖代理程式安裝。

"Unexpected error while making agent driver! "、"Kernel development package ...missing from repositories" 或 "Kernel development or header package...did not install" 錯誤

安裝代理程式時,安裝程式會下載與您目前執行的核心套件相符的 kernel-devel 套件。您可以在 Linux 作業系統設定的套件儲存庫中找到目前套件。如果代理程式安裝無法在 Linux 作業系統的執行核心中安裝 kernel-devel 套件,您會收到以下其中一個錯誤訊息:

"Unexpected error while making agent driver! Are kernel linux headers installed correctly?"

-或-

"Kernel development package for '************' are missing from repositories"

-或-

"Kernel development or header package for ************ did not install"

若要解決此問題,請查看安裝日誌以檢查儲存庫存取問題。

然後,根據您的發行版搜尋並手動下載 kernel-devel 套件:

  • 如需 Red Hat Enterprise Linux (RHEL)、CentOS、Oracle 和 SUSE 套件目錄,請參閱 RPM 網站上的搜尋
  • 如需 Debian,請參閱 Debian 網站上的套件
  • 如需 Ubuntu,請參閱 Ubuntu 套件網站上的 Ubuntu 套件搜尋

下載套件之後,請再次執行安裝。AWS Replication Agent 在安裝過程中也會安裝所需的相依性,例如 make gcc perl tar gawk rpm。如需詳細資訊,請參閱 Linux 安裝要求

相關資訊

代理程式問題疑難排解

Elastic Disaster Recovery 疑難排解

疑難排解 (Application Migration Service)