如何解决 EC2 Linux 实例上的 AWS Replication Agent 安装失败问题?

4 分钟阅读
0

我想为 AWS Application Migration Service 或 AWS 弹性灾难恢复安装 AWS Replication Agent。在我的 Amazon Elastic Compute Cloud(Amazon EC2)Linux 实例上安装失败。

解决方法

以下解决方法涵盖了 Linux 操作系统(OS)上最常见的 AWS Replication Agent 安装错误。

确定错误

AWS Replication Agent 安装程序日志在日志末尾显示错误。

要确定错误,请运行下列命令来查看安装程序日志的最后一页:

less +G aws_replication_installer.log

要解决发现的错误,请按照与错误相关的部分中的过程进行操作。

错误:未能从共享对象映射区段: 不允许操作

错误示例:

"./aws-replication-installer-64bit: error while loading shared libraries: libz.so .1: failed to map segment from shared object: Operation not permitted"

安装脚本使用 /tmp 目录。如果在 /tmp 上设置了 noexec,则 libz.so 无法映射分段。发生这种情况时,您会收到此 operation not permitted 错误。

要解决此错误,请运行以下命令来使用执行权限挂载卷:

# sudo mount /tmp -o remount,exec

错误:security token included in the request is expired

错误示例

"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]"

此错误通常是由过期的 AWS Identify and Access Management(IAM)角色引起的。当 IAM 角色过期时,对 Application Migration Service 或弹性灾难恢复端点的 API 调用将失败。

要解决此问题,请刷新 IAM 角色,或者使用访问密钥或秘密访问密钥安装该角色。有关详细信息,请参阅以下 AWS 文档:

错误: Module aws_replication_driver is not currently loaded

错误示例

"rmmod: ERROR: Module aws_replication_driver is not currently loaded insmod: ERROR: could not insert module ./aws-replication-driver.ko: Required key not available"

当在源实例中启用安全启动时,会发生此错误。Application Migration Service 和弹性灾难恢复不支持安全启动。

要解决此错误,请在源实例中关闭安全启动。

错误:ssl.SSLCertVerificationError

错误示例

"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 或更高版本的早期操作系统版本时,可能会出现此错误。Python 3.10 在其 Python Enhancement Proposals 网站上添加了 PEP 644 – 需要 OpenSSL 1.1.1 或更新的提案

较早的操作系统版本没有支持 Python 3.10 的最新 OpenSSL 库。因此,AWS Replication Agent 安装无法验证 Application Migration Service 或弹性灾难恢复端点的 SSL 证书。

为避免此错误,请使用较早版本的 Python,例如 2.7 或 3.8 版。

**注意:**要解决大多数 urllib/SSL 错误,请使用较早版本的 Python。

错误:botocore.exceptions.CredentialRetrievalError

错误示例:

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

当您修改弹性灾难恢复的 AWS Replication Agent 角色 AWSElasticDisasterRecoveryAgentRole 和 Application Migration Service 的 AWSApplicationMigrationAgentRole 时,可能会发生此错误。

要解决此错误,请确保 AWS Replication Agent 角色如下所示:

Application Migration Service

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

弹性灾难恢复

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

错误: A dependency job for aws-replication.target failed.

错误示例:

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

此错误有两个可能的原因:

  • /var 目录的权限为 754。
  • 在为 aws-replication 用户创建 Linux 组的过程中出现问题。

要解决 /var 问题,请为 /var 目录运行 chmod 755

要解决 Linux 组问题,请完成下面的步骤:

  1. 卸载 AWS Replication Agent。

  2. 运行以下命令来删除 aws-replication 用户和 aws-replication 组:

    # userdel aws-replication
    # groupdel aws-replication
  3. 重新安装 AWS Replication Agent。

有关详细信息和安装先决条件,请参阅下列 AWS 文档:

错误: Exception in thread "main" com.amazonaws.services.drs.model.InternalServerException

错误示例:

"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"

当客户端关闭 AWS Security Token Service(AWS STS)端点时,会发生此错误。关闭 STS 端点后,Application Migration Service 或弹性灾难恢复无法调用 AWS STS 来代入客户账户中的角色。

要解决此错误,请在客户端中打开 STS 端点

错误:could not insert module ./aws-replication-driver.ko: Required key not available

当操作系统启用安全启动时,会发生此错误。Application Migration Service 和弹性灾难恢复不支持启用了安全启动的 Linux 操作系统。

要解决此错误,请为 Linux 操作系统禁用安全启动。在大多数操作系统上,在虚拟机监控器中禁用安全启动。

错误:could not insert module ./aws-replication-driver.ko: Cannot allocate memory

错误示例:

"insmod: ERROR: could not insert module ./aws-replication-driver.ko: Cannot allocate memory rmmod: ERROR: Module aws_replication_driver is not currently loaded ] 2023-03-16 10:27:08,416 ERROR Exception during agent installation Traceback (most recent call last): File "cirrus/installer_shared/installer_main.py", line 308, in run_agent_installer_command_linux File "shared/installer_utils/command_utils.py", line 161, in run shared.installer_utils.command_utils.RunException: command: /tmp/tmp_t"

当 Linux 操作系统没有足够的内存来安装代理时,会出现此错误。

要解决此错误,请确保操作系统至少有 300 MB 的可用内存。

错误: Unexpected error while making agent driver! Are kernel linux headers installed correctly?

错误示例:

"Unexpected error while making agent driver! Are kernel linux headers installed correctly? Installation returned with code 1Installation failed due to unspecified error:"

安装代理时,安装程序会下载与当前包匹配的 kernel-devel 包。可以在 Linux 操作系统中配置的包存储库中查找当前包。

当代理安装工作流无法将 kernel-devel 包安装到 Linux 操作系统的运行内核时,会出现此错误。

要解决此错误,请查看安装日志以验证问题是否是由于存储库访问引起的。然后,从互联网手动下载 kernel-devel 包。下载包后,再次运行安装。

可以从以下网站下载 kernel-devel 包:

AWS Replication Agent 还会安装安装所需的依赖项,例如 make gcc perl tar gawk rpm。有关详细信息,请参阅 Linux installation requirements

AWS 官方
AWS 官方已更新 1 年前