resolved – yum returned Segmentation fault error on centos
The following error messages occurred while running yum list or yum update on a centos/rhel host:
[root@test-centos ~]# yum list
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Segmentation fault
As always, I did a strace on this:
[root@test-centos ~]# strace yum list
open(“/var/cache/yum/el5_ga_base/primary.xml.gz”, O_RDONLY) = 6
lseek(6, 0, SEEK_CUR) = 0
read(6, “\37\213\10\10\0\0\0\0\2\377/u01/basecamp/www/el5_”…, 8192) = 8192
— SIGSEGV (Segmentation fault) @ 0 (0) —
+++ killed by SIGSEGV +++
And here’s the error messages from /var/log/messages:
[root@test-centos ~]# tail /var/log/messages
Jan 6 07:07:44 test-centos kernel: yum[5951]: segfault at 3500000000 ip 000000350cc79e0a sp 00007fff05633b78 error 4 in libc-2.5.so[350cc00000+14e000]
After some googling, I found the yum “Segmentation fault” was caused by the conflict between zlib and yum. To resolve this problem, we need use the older version of zlib. Here’s the detailed steps:
[root@test-centos ~]# cd /usr/lib
[root@test-centos lib]# ls -l libz*
-rw-r–r– 1 root root 125206 Jul 9 07:40 libz.a
lrwxrwxrwx 1 root root 22 Aug 2 07:10 libz.so -> /usr/lib/libz.so.1.2.7
lrwxrwxrwx 1 root root 22 Aug 2 07:10 libz.so.1 -> /usr/lib/libz.so.1.2.7
-rwxr-xr-x 1 root root 75028 Jun 7 2007 libz.so.1.2.3
-rwxr-xr-x 1 root root 99161 Jul 9 07:40 libz.so.1.2.7[root@test-centos lib]# rm libz.so libz.so.1
rm: remove symbolic link `libz.so’? y
rm: remove symbolic link `libz.so.1′? y
[root@test-centos lib]# ln -s libz.so.1.2.3 libz.so
[root@test-centos lib]# ln -s libz.so.1.2.3 libz.so.1
After these steps, you should now able to run yum commands without any issue.
Also, after using yum, you should change back zlib to the newer version, and here’s the steps:
[root@test-centos ~]# cd /usr/lib
[root@test-centos lib]# rm libz.so libz.so.1
rm: remove symbolic link `libz.so’? y
rm: remove symbolic link `libz.so.1′? y
[root@test-centos lib]# ln -s libz.so.1.2.7 libz.so
[root@test-centos lib]# ln -s libz.so.1.2.7 libz.so.1
