You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

更新GLIBC库后EC2实例无响应,请求恢复指导

问题描述

安装RabbitMQ依赖的Erlang时触发依赖错误:

error: Failed dependencies:
    libcrypto.so.1.1()(64bit) is needed by erlang-26.1-1.el8.x86_64
    libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) is needed by erlang-26.1-1.el8.x86_64
    libcrypto.so.1.1(OPENSSL_1_1_1)(64bit) is needed by erlang-26.1-1.el8.x86_64
    libz.so.1(ZLIB_1.2.7.1)(64bit) is needed by erlang-26.1-1.el8.x86_64

错误尝试更新GLIBC后,EC2实例完全不可用:

  • 先执行了依赖安装:
    sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y
    
  • 下载并强制安装了EL6版本的GLIBC 2.17 RPM包:
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-utils-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-static-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm &
    wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/nscd-2.17-55.el6.x86_64.rpm &
    sudo rpm -Uvh *-2.17-55.el6.x86_64.rpm --force --nodeps
    
  • 删除下载的RPM包:
    rm -rf glibc-*
    

后续故障表现:

  1. 无法执行sudo、wget等基础命令,报错:
    sudo: /lib64/libc.so.6: version `GLIBC_2.26' not found (required by sudo)
    sudo: /lib64/libc.so.6: version `GLIBC_2.26' not found (required by /usr/libexec/sudo/libsudo_util.so.0) 
    
  2. 执行strings /lib64/libc.so.6 | grep GLIBC未找到GLIBC_2.26版本
  3. SSH连接失败,提示:kex_exchange_identification: read: Connection reset
  4. yum和wget均无法使用,yum报错:
    /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /lib64/libcrypt.so.1)
    
解决方案

紧急恢复(优先操作)

由于系统核心库已被破坏且无法通过SSH连接,最可靠的恢复方式是通过EC2控制台的EBS卷挂载操作:

  1. 停止故障EC2实例(EBS卷数据不会丢失)
  2. 从故障实例分离根EBS卷
  3. 启动一台与故障实例同操作系统版本的全新EC2实例
  4. 将分离的根卷挂载到新实例的挂载点(如/mnt/recovery)
  5. 在新实例中,从官方源下载对应系统版本的GLIBC完整RPM包,复制到/mnt/recovery/root目录
  6. 进入挂载的故障卷系统环境,重新安装正确的GLIBC:
    chroot /mnt/recovery
    rpm -Uvh --force /root/glibc-*.rpm
    
  7. 卸载挂载的卷,重新挂载回原故障实例,启动实例尝试连接

原Erlang依赖问题的正确处理

最初的依赖错误是因为安装了与系统版本不匹配的Erlang包(EL8版本的Erlang用于非EL8系统),正确处理方式:

  • 安装对应系统版本的Erlang包:比如EL7系统就用EL7版本的Erlang RPM
  • 使用RabbitMQ官方仓库安装,自动匹配依赖:
    curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
    sudo yum install rabbitmq-server
    
  • 禁止跨版本强制安装GLIBC:GLIBC是系统核心依赖库,跨版本或强制安装会直接破坏系统稳定性,导致无法修复的故障

内容的提问来源于stack exchange,提问作者Yu Xing

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 09:58:12