• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

rpm: error while loading shared libraries: invalid ELF header

by admin

The Problem

rpm commands issue the following error:

rpm: error while loading shared libraries: /usr/lib64/liblzma.so.0: invalid ELF header

The Solution

In this instance, either liblzma.so or the link to it (/usr/lib64/liblzma.so.0) had gotten overwritten.

$ rpm -qa | grep binutils
rpm: error while loading shared libraries: /usr/lib64/liblzma.so.0: invalid ELF header

To resolve this issue, the liblzma.so file and associated soft link need to be restored. Follow the steps outlined below in order to restore the .so file and associated soft links.

1. Ensure that the softlink /usr/lib64/liblzma.so.0 exists and points to liblzma.so.0.0.0.

# ls -l /usr/lib64/liblzma.so.0
lrwxrwxrwx 1 root root 16 Mar 31 15:42 /usr/lib64/liblzma.so.0 -> liblzma.so.0.0.0
# file /usr/lib64/liblzma.so.0.0.0
./usr/lib64/liblzma.so.0.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

2. If the softlink does not exist try the following:

– Try to use yum to reinstall the xz-libs. However, if rpm is having a problem, yum likely will too.

# yum reinstall xz-libs

3. If that does not work, unpack the rpm and copy the new shared library file over the invalid file. As rpm is having trouble, unpacking the rpm will likely need to be done on a different system.

– Download the appropriate xz-libx rpm from the source respository and use the rpm2cpio and cpio commands to unpack the rpm.

# rpm2cpio xz-libs-4.999.9-0.5.beta.20091007git.el6.x86_64.rpm | cpio -idv
./usr/lib64/liblzma.so.0
./usr/lib64/liblzma.so.0.0.0
./usr/share/doc/xz-libs-4.999.9
./usr/share/doc/xz-libs-4.999.9/COPYING.GPLv2
./usr/share/doc/xz-libs-4.999.9/COPYING.GPLv3
./usr/share/doc/xz-libs-4.999.9/COPYING.LGPLv2.1
421 blocks

4. Copy the liblzma.so.0.0.0 from the unpacked rpm over the existing shared library file:

# cp -pv ./usr/lib64/liblzma.so.0.0.0 /usr/lib64/liblzma.so.0.0.0
cp: overwrite '/usr/lib64/liblzma.so.0.0.0'? y
'./usr/lib64/liblzma.so.0.0.0' -> '/usr/lib64/liblzma.so.0.0.0'
# file /usr/lib64/liblzma.so.0.0.0
/usr/lib64/liblzma.so.0.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

5. Test that rpm works as expected.

# rpm -qf /usr/lib64/liblzma.so.0.0.0
xz-libs-4.999.9-0.5.beta.20091007git.el6.x86_64

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Linux OS service ‘dhcpd’
  2. groupmod Command Examples in Linux
  3. pluma Command Examples in Linux
  4. CentOS/RHEL – vgs command reports error: “global/global_filter” unknown
  5. jasmine-node: command not found
  6. How to Migrate CentOS/RHEL 6 iptables Rules to CentOS/RHEL 7 firewalld
  7. lsblk Command Examples in Linux
  8. “Failed to start test.mount: Unit is not loaded properly: Invalid argument.” – While mounting a fileystem using systemd
  9. a2disconf Command Examples in Linux
  10. duperemove: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright