跳至内容

如何对 Linux 服务器上的 AWS Replication Agent 安装失败问题进行故障排除?

4 分钟阅读
0

我想为 AWS Application Migration Service 或 AWS 弹性灾难恢复安装 AWS Replication Agent,但安装失败了。

解决方法

要自动识别在 Linux 源服务器中安装 Application Migration Service 或弹性灾难恢复复制代理时出现的问题,请使用 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 (Required)(ServiceName(必填))配置以下输入参数:

  • 要使用 Application Migration Service,请选择 AWS MGN
  • 要使用弹性灾难恢复,请选择 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 或弹性灾难恢复端点的 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 Service弹性灾难恢复的访问密钥或秘密访问密钥的角色。

"ssl.SSLCertVerificationError" 错误

如果您在 Python 3.10 或更高版本中使用较早的操作系统 (OS) 版本,则可能会收到以下错误消息:

"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 或弹性灾难恢复端点的 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。

弹性灾难恢复权限策略:

{      "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 Service弹性灾难恢复的 AWS Replication Agent。

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

    sudo userdel aws-replication
    sudo groupdel aws-replication
  3. Application Migration Service弹性灾难恢复重新安装 AWS Replication Agent。

有关 Application Migration Service 的安装先决条件,请参阅安装要求。有关弹性灾难恢复,请参阅 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 和弹性灾难恢复通过调用 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"

-or-

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

您不能在启用了 Application Migration Service 或弹性灾难恢复的 Linux 操作系统中使用 SecureBoot

要解决此问题,请为 Linux 操作系统停用 SecureBoot

**注意:**通常情况下,您可以使用虚拟机监控程序来停用 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"

要解决此问题,请确保在运行安装程序时操作系统至少有 300MB 的可用内存。此问题可能是由于内存碎片导致的。要解决内存碎片问题,请重启源服务器。此外,还要检查安全或防病毒软件(例如 Falcon、Trend Micro、SentinelOne 或 McAfee)是否会引发内存或内核保护,进而阻止代理安装。

"Unexpected error while making agent driver! ", "Kernel development package ...missing from repositories", or "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?"

-or-

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

-or-

"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 安装要求

相关信息

对代理问题进行故障排除

对弹性灾难恢复进行故障排除

故障排除 (Application Migration Service)