LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep is not working in RHEL5.3 (https://www.linuxquestions.org/questions/linux-newbie-8/grep-is-not-working-in-rhel5-3-a-4175534164/)

prakash_kumar 02-16-2015 05:24 AM

grep is not working in RHEL5.3
 
Hi,

I have Redhat 5.3 running on my machine. But when I am login through putty it gives me below error.
Without running any grep command I get this error on login and the grep command doesn't work.

login as: root
root@IP's password:
Last login: Mon Feb 16 15:27:55 2015 from IP
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/egrep: cannot execute binary file
-bash: /bin/grep: cannot execute binary file
-bash: /bin/grep: cannot execute binary file
[root@bkpdrill ~]# grep MemTotal /proc/meminfo
-bash: /bin/grep: cannot execute binary file

pan64 02-16-2015 05:30 AM

what will uname -a and file /bin/grep respond ?

prakash_kumar 02-16-2015 06:05 AM

Please find below output:-

[root@bkpdrill ~]# uname -a
Linux bkpdrill.icat.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@bkpdrill ~]# file /bin/grep
/bin/grep: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), corrupted program header size, corrupted section header size
[root@bkpdrill ~]#

pan64 02-16-2015 06:07 AM

So as you can see grep itself is corrupted. Probably you can try to reinstall, but would be nice to know the reason.

prakash_kumar 02-16-2015 06:28 AM

Should I have to uninstall it before reinstall? Can you tell me which version I have to install?

pan64 02-16-2015 06:32 AM

No you do not need to uninstall I think and also you need to install the package belongs that release (RHEL 5.3)

prakash_kumar 02-16-2015 06:35 AM

Hi
I download grep package but while installing it gives me below error.

[root@bkpdrill icat]# rpm -ivh grep-2.6.3-6.el6.x86_64.rpm
rpm: error while loading shared libraries: librpm-4.4.so: wrong ELF class: ELFCLASS64
[root@bkpdrill icat]#

Please help me on this?

pan64 02-16-2015 06:36 AM

I would say there are other corrupted files or ??? Something strange happened. Probably you need to reinstall everything.

prakash_kumar 02-16-2015 06:38 AM

Can you Please tell me which all things need to be reinstalled?

pan64 02-16-2015 06:40 AM

sorry, I have no idea what's happened, probably you need to reinstall the whole OS again (not only a few packages). But save your important data before that.

prakash_kumar 02-16-2015 06:44 AM

I cannot reinstall the whole OS. Can any one help me how to reinstall grep?
Also the below error is coming when I fire the command rpm -help
error while loading shared libraries: librpm-4.4.so: wrong ELF class: ELFCLASS64

TB0ne 02-16-2015 10:24 AM

Quote:

Originally Posted by prakash_kumar (Post 5318020)
I cannot reinstall the whole OS.

Sorry, but that is JUST NOT TRUE. If the OS was installed, that means it can be REinstalled as well.
Quote:

Can any one help me how to reinstall grep?
We tried to, and you were told to get the RHEL 5.3 media and re-install it from there. You ignored that advice, and downloaded a package for RHEL6, and then were amazed that it didn't work on RHEL5. Not much else we can tell you past that.
Quote:

Also the below error is coming when I fire the command rpm -help error while loading shared libraries: librpm-4.4.so: wrong ELF class: ELFCLASS64
Again, you need to re-install your system...you appear to be having several serious issues. Also, again, RHEL5.3 is ANCIENT, and you really should NOT be using it. The latest is RHEL7.x, so download and install it...but only if you're PAYING FOR IT. Otherwise, use CentOS instead. As you were told in your OTHER thread:

http://www.linuxquestions.org/questi...-a-4175531803/

...where you said you ran 'rm -rfv /', then said you didn't have a valid backup of your system.

John VV 02-16-2015 03:11 PM

Quote:

rpm -ivh grep-2.6.3-6.el6.x86_64.rpm
you DO KNOW that is the rpm for some version of RHEL6
NOT for RHEL5 !!!!

you can NOT mix two very different operating systems together

think of it a trying to install windows 8 exe file on XP
and by doing that with copy/paste

with this being REDHAT
you BOUGHT IT!!! for the SUPPORT you get with the REQUIRED support contract

contact redhat
you are paying a lot of cash every year for that support
You might want to use it

prakash_kumar 02-17-2015 07:39 AM

Thanks for the reply. I copied the grep and rpm files from other machine of the same architecture. This worked perfectly fine with "grep", which was not working earlier :)
But this is not working for "rpm". I also copied some rpm dependent libraries as mentioned below:
/usr/lib64/librpm.so.1
/usr/lib64/librpmbuild.so.1
/usr/lib64/librpmio.so.1
/lib64/libcap.so.2
/lib64/libdb-4.7.so
/usr/lib64/libdb-4.7.so
/usr/lib64/liblzma.so.0
/usr/lib64/liblzma.so.0.0.0
/usr/lib64/liblua-5.1.so

After this when I fire rpm --help command I get the following error message:

[root@bkpdrill ~]# rpm --help
rpm: /usr/lib64/libpopt.so.0: no version information available (required by rpm)
rpm: /usr/lib64/libpopt.so.0: no version information available (required by /usr/lib64/librpmbuild.so.1)
rpm: /usr/lib64/libpopt.so.0: no version information available (required by /usr/lib64/librpm.so.1)
rpm: /usr/lib64/libpopt.so.0: no version information available (required by /usr/lib64/librpmio.so.1)
rpm: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /usr/lib64/liblua-5.1.so)
rpm: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by /usr/lib64/liblua-5.1.so)

Can you please tell me what this error is and how can this be resolved?
Thank you in advance !!!

TB0ne 02-17-2015 08:55 AM

Quote:

Originally Posted by prakash_kumar (Post 5318678)
Thanks for the reply. I copied the grep and rpm files from other machine of the same architecture. This worked perfectly fine with "grep", which was not working earlier :)

But this is not working for "rpm". I also copied some rpm dependent libraries as mentioned below: After this when I fire rpm --help command I get the following error message:

Can you please tell me what this error is and how can this be resolved?

We have ALREADY TOLD YOU, and also have TOLD YOU HOW TO RESOLVE IT, but you seem to be selectively ignoring what you get told.

AGAIN: YOU NEED TO DO A FRESH INSTALLATION. You ran the 'rm -rfv /' command, and didn't restore from backup...congratulations, you have erased MANY Parts of your VERY OLD SYSTEM. You have ONE OPTION LEFT..do a fresh installation of the LATEST RHEL. AGAIN, 5.3 is OLD and UNSUPPORTED...7.x is the most current, and if you don't play on PAYING FOR RHEL, then load CentOS 7.x instead. If you ARE PAYING for RHEL extended support for 5.3, then CALL RED HAT, and ask what they suggest.

To recap, before you ask yet again what you can do to fix your system:
  • Restore from backups (which you said you didn't have, after you ran the rm command)
  • Do a fresh installation of RHEL 5.3 and apply the patches which you're paying for (which you STILL haven't said whether you're paying for RHEL or not)
  • Do a fresh installation of RHEL 7.x, and apply the updates which you are PAYING FOR (or load CentOS 7.x if you don't plan on paying)
Those are your ONLY OPTIONS. Pick one.


All times are GMT -5. The time now is 09:42 PM.