Commands fail with "error while loading shared libraries: cannot open shared object file: No such file or directory"

Solution Verified - Updated -


  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7


  • Most commands are not working and the following error message is seen:
    • error while loading shared libraries: cannot open shared object file: No such file or directory


  1. Boot to rescue mode using a Binary DVD or boot.iso
  2. Select continue to auto-mount the system at /mnt/sysimage
  3. Move the glibc rpms onto the rescue environment.
  4. From outside the chroot, use rpm to reinstall the glibc packages.
    • rpm -Uvh --replacefiles --replacepkgs --root=/mnt/sysimage /tmp/glibc-<version>.<arch>.rpm

Root Cause

The library was unlinked or not properly linked which caused numerous application errors.

Diagnostic Steps

Verify the glibc package is installed correctly with rpm

# rpm -q glibc

# rpm -V glibc
....L...    /lib64/
....L...    /lib/

# man rpm
       rpm {-V|--verify} [select-options] [verify-options]


       S file Size differs
       M Mode differs (includes permissions and file type)
       5 MD5 sum differs
       D Device major/minor number mismatch
       L readLink(2) path mismatch
       U User ownership differs
       G Group ownership differs
       T mTime differs
  • Component
  • rpm

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.


A simple example of how to load this package:

How to reinstall the glibc packages step by step:

  1. On your server do the following: a. Identity the specific release of glibc which is resident on your system.

            Rpm – q glibc

You will get something like:


If you first load the release media and access the Packages as well, you and check the full list of packages, use ls to get a full list. I used:

 ls -l *2.17* 

to see all associated glibc packages.
Make sure all associated packages get reinstalled.
If you have a subscription of Red Hat with the yum application do the following:

Yum -reinstall glibc-2.17-307.el7.1.i686  
Yum -reinstall glibc-2.17-307.el7.1.x86_64


Follow the prompts for yum and and you are done.