Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am working on AIX 6.1 and inadvertently renamed /usr/lib/libc.a to usr/lib/libc.a_ Just as I renamed I realized my stupid mistake. Almost all of the commands mv, cp, ftp etc ( except cd ) have stopped working.

How shall I rename by libc.a back. Without it, the system hardly functions sanely :(

share|improve this question
2  
Try every possible way to fix it and be imaginative. You can do it with dd, cat, ln, and probably a dozen other commands. Check your list of shell internals (read -N?). Are any servers already running that could be made to do it? –  David Schwartz Apr 4 '12 at 11:50
    
@DavidSchwartz Actually I was running on a virtualized environment of AIX. I mean I was running on one of the several partitions on a single server –  Stacker Apr 4 '12 at 12:07
    
Got Busybox? That might do it. –  Tom O'Connor Apr 4 '12 at 12:27
    
I am not proficient on AIX but does not a .a suffix mean a static library? Is it possible that you have messed up the shared libc file too? BTW, cd is a command embedded to the shell –  adamo Apr 4 '12 at 15:23

5 Answers 5

Most of the binaries depend/use on the libc library. To find out, you can use ldd /path/to/binary It seems that you need to boot another image or live CD. Then, you can mount the relevant partition (/usr if it is separated or /) and rename the file.

share|improve this answer

Just posting this in case someone else searches for this issue.

Since at least AIX 5.3 IBM has provided the recovery shell recsh just for this issue.

Check IBM Documentation.

Example of use: recsh; cp -p libc.a.new /usr/lib/libc.a; exit

share|improve this answer

I guess ln is out of question, too?

ln -s usr/lib/libc.a_ usr/lib/libc.a

Or Perl?

perl -e 'symlink("usr/lib/libc.a_","usr/lib/libc.a");'

or

perl -MFile::Copy -e 'copy("usr/lib/libc.a_","usr/lib/libc.a");'
share|improve this answer

Try while read -r x; do echo $x >> libc.a; done < libc.a_ (This assumes a Bourne style shell).

If it fails and you are lucky enough that ed or sed are statically linked try:

sed libc.a_ > libc.a

or

ed libc.a_
w libc.a
q

also dd if=libc.a_ of=libc.a

share|improve this answer

Boot from rescue disk, mount filesystem, do rename.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.