PDA

View Full Version : AaaaAAAaah help, I made a huge mistake :( accidentally moved /bin!



yelgnits
2nd September 2004, 12:13 AM
Okay, so I made a huge screw up...I was doing some stuff the required root priveleges, forgot to change back to another user...so I was trying to move all the files in the current directory to another, like this
mv ./* /music/new/
Unfortunately, I typed
mv /* /music/new
Thereby moving bin, lib, all of that in the music/new directory...now that only thing I can do via the terminal is cd (mv doesn't work, cp doesn't...etc.) and I have no idea what to do to fix it...is there anything I can do? Any help would be appreciated...I don't wanna have to reinstall the OS!

SuperNu
2nd September 2004, 12:18 AM
What you can do is type the full path to the executable in order to move the files and folders back in place, /music/new/bin/mv should work. Or, if you have a rescue cd or Knoppix burned, you can boot from that and move files around. Good Luck.

--SN

yelgnits
2nd September 2004, 12:21 AM
Using the absolute path of mv produces the error:
/music/new/bin/mv
bash: /music/new/bin/mv: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

And no, I have neither of those burned....sigh... :mad:

SuperNu
2nd September 2004, 12:23 AM
I believe that the first Fedora Core CD will allow you to go into rescue mode so you should be able to mount your hard drive and move your directories back into place.

--SN

yelgnits
2nd September 2004, 12:25 AM
thanks...I'll try it...:/

SuperNu
2nd September 2004, 12:25 AM
Also, you could try to export your path to your /music/new/lib directory from bash by typing export LD_LIBRARY_PATH=/music/new/lib:$LD_LIBRARY_PATH at the command prompt.

--SN

yelgnits
2nd September 2004, 12:46 AM
Okay, I think I screwed up your command somehow...I executed
export LD_LIBRARY_PATH="/music/new/lib:$LD_LIBRARY_PATH"
then:
/music/new/bin/mv
which gave the same error as before...echo $LD_LIBRARY_PATH gives:
/music/new/lib:/music/new/lib
which doesn't look right...also, if I did mount my hd from the CD (i actually have to re-download it and burn it on a diff comp...sigh) how would i get my LD_LIBRARY_PATH back to its default value?

javispedro
2nd September 2004, 01:01 AM
Within the rescue CD you have a perfect working cp and mv commands. Just put those files back again where they belong.

zarthon
1st October 2004, 11:19 PM
Hi.
I am in a similar situation but my compter is not setup to easily boot from any other device but from the harddrive. If someone knows of how to change the path the the ELF interpreter that would be fantastic.

Cheers + + + + + + +
Zarthon

Shadow Skill
1st October 2004, 11:52 PM
ah the dangers of using wildcards....hope you fix that so I can know what to do if I ever do something like that.

zarthon
2nd October 2004, 04:24 PM
Its really even worse than a wild card error. I did it on purpose because I am switching over to a different installation of linux, currently on another subtree. I set it up and compiled the kernel then moved it over to the main boot dir and reconfigured grub to recongize the new kernel as well, then rebooted into the new kernel. I was going to swap trees. All was well until I was stopped by the ELF after moving the /lib dir ! If I had written a script to do this then would I have avoided the ELF ?
Anyway I will certainly post whenever I figure out how I can fix the comptuer, or alternatively when I give up! Any help is appriceated.
I can issue bash commands and cd to dirs to execute binaries that don't depend on anything else from other directories. ( I have found none of these so far).

zarthon
2nd October 2004, 08:46 PM
you can call it by preceeding the full path command with the full path of ld-linx.so.2
you can restore the system through a combination of ln and mv
i found that it was necessary for me to use ln then use mv
after i created the file links i swaped the links for the directories like this

/linuxsomeplace/lib/ld-linux.so.2 /linux/somplace/bin/ln -s /linuxsomeplace/lib /lib
same for bin
then
rm /lib && mv /linuxsomplace/lib /
...

I found help information on ELF / linux liberary loader at:
http://www.lug-owl.de/~jbglaw/tlgg/html/ch02.html