LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash: /bin/ls: /lib/ld-linux.so.2 (https://www.linuxquestions.org/questions/linux-newbie-8/bash-bin-ls-lib-ld-linux-so-2-a-4175612360/)

haseem saeed 08-21-2017 08:49 AM

bash: /bin/ls: /lib/ld-linux.so.2
 
Dear ALL,

i made a script to move data from one place to another i got error while running the script so i stopped the script. after this whenever i am running a command i am getting the error

bash: /bin/ls: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

when trying to install glibc.i686
i am getting the following error
bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

i hope that someone can help me out in resolving this issue.

hazel 08-21-2017 09:26 AM

The first error suggests that you are trying to run 32-bit programs on a 64-bit system. In theory, installing glibc.i686 would solve that problem. But it would surely be better to find out how you got into this mess in the first place.

You can run file on the commands that are failing in order to check their internal format. Also check where your python program is by using which python. Yum expects it to be in /usr/bin but maybe you have it installed somewhere else.

haseem saeed 08-21-2017 09:34 AM

Quote:

Originally Posted by hazel (Post 5750561)
The first error suggests that you are trying to run 32-bit programs on a 64-bit system. In theory, installing glibc.i686 would solve that problem. But it would surely be better to find out how you got into this mess in the first place.

You can run file on the commands that are failing in order to check their internal format. Also check where your python program is by using which python. Yum expects it to be in /usr/bin but maybe you have it installed somewhere else.

Thanks for your input
I have tried to use the file command and it is giving me the following error.

file
bash: file: command not found

which python
bash: /usr/bin/which: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

hazel 08-21-2017 10:11 AM

Wow, you've really messed up your system! file and which ought to be in the same directory: /usr/bin. Yet you can find which (it doesn't run but at least it's there) while file apparently isn't.

Tell us what distro you are using (obviously it's something in the Red Hat family as it uses yum). And what exactly were you doing when it all went pear-shaped? "I was running a script" isn't good enough. What was the script doing when it crashed? What kind of data were you trying to move around? Because it looks to me as if, at the very least, you have moved some program files out of place.

I think you now need to boot from a rescue disc (you should be able to use your installation disc for that) and find out exactly where these programs have got to and what format they have. On paper make a list of the commands that aren't found and another of the ones that give an ELF error and check them all from your rescue disk. Also check the identity of the ld-linux dynamic link loader in /lib. For a 64-bit system it should be called ld-linux-x86-64.so.2. For a 32-bit system it's ld-linux.so.2.

haseem saeed 08-21-2017 10:37 AM

Quote:

Originally Posted by hazel (Post 5750586)
Wow, you've really messed up your system! file and which ought to be in the same directory: /usr/bin. Yet you can find which (it doesn't run but at least it's there) while file apparently isn't.

Tell us what distro you are using (obviously it's something in the Red Hat family as it uses yum). And what exactly were you doing when it all went pear-shaped? "I was running a script" isn't good enough. What was the script doing when it crashed? What kind of data were you trying to move around? Because it looks to me as if, at the very least, you have moved some program files out of place.

I think you now need to boot from a rescue disc (you should be able to use your installation disc for that) and find out exactly where these programs have got to and what format they have. On paper make a list of the commands that aren't found and another of the ones that give an ELF error and check them all from your rescue disk. Also check the identity of the ld-linux dynamic link loader in /lib. For a 64-bit system it should be called ld-linux-x86-64.so.2. For a 32-bit system it's ld-linux.so.2.

Yes i can see that i have moved my library files into /mnt/ before sometime i was able to use busybox but after changing the $PATH i am not able to use it can you please guide me the way to use it again the $PATH which was set before was like below
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/c4s-admin/bin:/bin:/usr/local/bin:/root/bin
CAn you please help me in this setting this as echo command is working

hazel 08-21-2017 10:55 AM

Quote:

Originally Posted by haseem saeed (Post 5750590)
Yes i can see that i have moved my library files into /mnt/ before sometime i was able to use busybox but after changing the $PATH i am not able to use it can you please guide me the way to use it again the $PATH which was set before was like below
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/c4s-admin/bin:/bin:/usr/local/bin:/root/bin
CAn you please help me in this setting this as echo command is working

Just type PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/c4s-admin/bin:/bin:/usr/local/bin:/root/bin.

For the future, make sure you have the path written down correctly in your $HOME/.bash_profile file, so that it will be set correctly whenever you log in. And put your library files back where they belong! What on earth are they doing in /mnt?

haseem saeed 08-21-2017 11:07 AM

Quote:

Originally Posted by hazel (Post 5750593)
Just type PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/c4s-admin/bin:/bin:/usr/local/bin:/root/bin.

For the future, make sure you have the path written down correctly in your $HOME/.bash_profile file, so that it will be set correctly whenever you log in. And put your library files back where they belong! What on earth are they doing in /mnt?

:cool: yeah i just solved it thanks to busybox and you.:)

hazel 08-21-2017 11:15 AM

Good! Please mark it as solved using the thread tools. You can also mark the posts you found useful.


All times are GMT -5. The time now is 08:26 PM.