升级 glibc 版本的问题
一般情况下,也不要升级 glibc 版本,升级后有可能会导致已安装的应用无法启动;开发环境上将 glibc 从 2.17 升级到 2.28 之后,遇到达梦数据库无法启动,从前台启动时报“段错误”,在 /var/log/messages
中看到错误信息:
kernel: dmserver[3506]: segfault at 0 ip 00007ff1f9a274b6 sp 00007ffed59f1270 error 4 in libc-2.28.so[7ff1f99ed000+1ae000]
而升级之后 libc.so.6 就是指向 libc-2.28.so 的软链接:
[root@localhost ~]# ll /lib64/libc.so.6
lrwxrwxrwx. 1 root root 19 Dec 13 18:07 /lib64/libc.so.6 -> /lib64/libc-2.28.so
[root@localhost ~]#
[root@localhost ~]# ll /lib64/libc-*
-rwxr-xr-x. 1 root root 2156592 May 19 2022 /lib64/libc-2.17.so
-rwxr-xr-x. 1 root root 18232920 Dec 11 11:55 /lib64/libc-2.28.so
lrwxrwxrwx. 1 root root 19 Jan 9 2023 /lib64/libc-client.so -> libc-client.so.2007
-rwxr-xr-x. 1 root root 1134632 Jul 31 2017 /lib64/libc-client.so.2007
[root@localhost ~]#
尝试将 libc.so.6 这个软链接删除,并重新创建指向 libc-2.17.so 的软链接:
# libc.so.6 这个软链接不能直接删除!!!
# 删除会导致 Linux 很多命令无法使用:
[root@localhost ~]# rm -f /lib64/libc.so.6
[root@localhost ~]#
[root@localhost ~]# ln -s /lib64/libc-2.17.so /lib64/libc.so.6
ln: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@localhost ~]#
如果已经删除了,使用 LD_PRELOAD
重建软链接:
LD_PRELOAD=/lib64/libc-2.28.so ln -s /lib64/libc-2.28.so /lib64/libc.so.6
或者使用 sln 命令重建软链接:
sln /usr/lib64/libc-2.28.so /lib64/libc.so.6
sln /usr/lib64/ld-2.28.so /usr/lib64/ld-linux-x86-64.so.2
sln /usr/lib64/libm-2.28.so /usr/lib64/libm.so.6
# 重建上述三个软链接之后,基础命令不会再报错;
降级 glibc 版本
yum 安装的高版本
查看当前安装的 glibc 版本:
[root@VM-4-11-centos ~]# rpm -qa|grep glibc
glibc-devel-2.17-324.el7_9.x86_64
glibc-2.17-324.el7_9.x86_64
glibc-common-2.17-324.el7_9.x86_64
glibc-headers-2.17-324.el7_9.x86_64
[root@VM-4-11-centos ~]#
查询 glibc 软件包中都有哪些版本:
[root@VM-4-11-centos ~]# yum list glibc glibc-devel glibc-common glibc-headers --showduplicates
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
* centos-sclo-rh: mirrors.aliyun.com
* centos-sclo-sclo: mirrors.aliyun.com
Installed Packages
glibc.x86_64 2.17-324.el7_9 @updates
glibc-common.x86_64 2.17-324.el7_9 @updates
glibc-devel.x86_64 2.17-324.el7_9 @updates
glibc-headers.x86_64 2.17-324.el7_9 @updates
Available Packages
glibc.i686 2.17-317.el7 base
glibc.x86_64 2.17-317.el7 base
glibc.i686 2.17-322.el7_9 updates
glibc.x86_64 2.17-322.el7_9 updates
glibc.i686 2.17-323.el7_9 updates
glibc.x86_64 2.17-323.el7_9 updates
glibc.i686 2.17-324.el7_9 updates
glibc.x86_64 2.17-324.el7_9 updates
glibc.i686 2.17-325.el7_9 updates
glibc.x86_64 2.17-325.el7_9 updates
glibc.i686 2.17-326.el7_9 updates
glibc.x86_64 2.17-326.el7_9 updates
glibc-common.x86_64 2.17-317.el7 base
glibc-common.x86_64 2.17-322.el7_9 updates
glibc-common.x86_64 2.17-323.el7_9 updates
glibc-common.x86_64 2.17-324.el7_9 updates
glibc-common.x86_64 2.17-325.el7_9 updates
glibc-common.x86_64 2.17-326.el7_9 updates
glibc-devel.i686 2.17-317.el7 base
glibc-devel.x86_64 2.17-317.el7 base
glibc-devel.i686 2.17-322.el7_9 updates
glibc-devel.x86_64 2.17-322.el7_9 updates
glibc-devel.i686 2.17-323.el7_9 updates
glibc-devel.x86_64 2.17-323.el7_9 updates
glibc-devel.i686 2.17-324.el7_9 updates
glibc-devel.x86_64 2.17-324.el7_9 updates
glibc-devel.i686 2.17-325.el7_9 updates
glibc-devel.x86_64 2.17-325.el7_9 updates
glibc-devel.i686 2.17-326.el7_9 updates
glibc-devel.x86_64 2.17-326.el7_9 updates
glibc-headers.x86_64 2.17-317.el7 base
glibc-headers.x86_64 2.17-322.el7_9 updates
glibc-headers.x86_64 2.17-323.el7_9 updates
glibc-headers.x86_64 2.17-324.el7_9 updates
glibc-headers.x86_64 2.17-325.el7_9 updates
glibc-headers.x86_64 2.17-326.el7_9 updates
[root@VM-4-11-centos ~]#
将 glibc 降级到指定的版本:
yum downgrade glibc-2.17-323.el7_9 glibc-devel-2.17-323.el7_9 glibc-common-2.17-323.el7_9 glibc-headers-2.17-323.el7_9 -y
执行完之后,再用 rpm -qa
查看系统中的版本。
标签:x86,glibc,升级,64,updates,版本,2.17,el7 From: https://www.cnblogs.com/zhpj/p/18133065/sheng-ji-glibc-ban-ben-de-wen-ti-hqvjw