Segmentation Fault when running commands

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux

Issue

  • Some commands we type we are getting "segmentaion fault" in the console screen as a return.
  • successful commands:
cat, mount, df -h, id, scp
  • failed commands:
sosreport, rpm, ls
  • ls command in normal user
$ ls
Memory fault
  • running "ls" as root user gives the following
$ ls
Segmentation fault

Resolution

Root Cause

  • Some libraries used by applications are still from older version while others are from newer version in glibc package. It happened as the package update was stopped in the middle of installation

Diagnostic Steps

  • Checking with ltrace where exactly it is crashing
$ ltrace -S -n 4 -Tttfs 1024 -o /tmp/ltrace_ls.out ls
  • Check if the libraries have the right permission and size
$ for i in `ldd /bin/ls | awk ' { print $3 } '`; do ls -l $i; done
  • 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.