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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. How to backup Linux OS using “dd” Command
  2. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  3. How to add words to the dictionary cracklib uses for validating passwords against known dictionary words
  4. CentOS / RHEL : How to get the date and time of executed command in the history command output
  5. Managing Clustered Logical Volumes in RHEL Cluster (pacemaker)
  6. How to recreate LVM device files under /dev directory using vgmknodes
  7. How to Check vendor of installed RPM packages in Linux
  8. How to troubleshoot NFS transfer latency issues using “nfsiostat” in CentOS / RHEL
  9. How to configure iSCSI target using targetcli in CentOS / RHEL 7
  10. How to Configure Proxy in CentOS/RHEL/Fedora

You May Also Like

Primary Sidebar

Recent Posts

  • Oracle Database – Configuring Secure Application Roles
  • Extend rule sets by using factors in Oracle Database Vault
  • What are Command Rules in oracle Database
  • Using Rule Sets in Oracle Database Vault
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary