I removed libcom_err.so.2 library from usr/lib64/ folder by mistake and yum command stopped working. I was wondering if there is any way to find this lib file and replace it in that folder since I do not have any backup from it. Is there any way to fix this issue? I am on CentOS 7.

P.S: I think the files that I have to use are in package libcom_err-1.42.9-16.el7.x86_64.rpm, but do not know how I can extract those library files and copy them into that folder.

1 Answer 1


You will need to use:

rpm2cpio libcom_err-1.42.9-16.el7.x86_64.rpm | cpio -idmv

This will create installation structure in the current directory.

From there you can copy the missing file.

If those commands don't work, you might have to run that on a temporary machine then copy the file via SFTP.

  • But yum stopped working and also sudo does not work with the error like libcom_err.so.2: cannot open shared object file: No such file or directory Feb 14, 2020 at 22:36
  • He's already stated that yum doesn't work. Feb 14, 2020 at 22:36
  • Pardon my blindness. Will update the answer :) Feb 14, 2020 at 22:37
  • @DanilaVershinin thanks for the reply. how can I make sure that the rpm file matches with my linux? Feb 14, 2020 at 22:41
  • I'm not sure how you can. But then again, if you use the file from the same CentOS version it should be pretty safe, because packages there are quite stable and ABI of libraries doesn't change between library package versions. Once you get yum working (after placing the file), you can ensure consistent version with the initial answer's command yum reinstall libcom_err Feb 14, 2020 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .