cancel
Showing results for 
Search instead for 
Did you mean: 

copy lib text file busy

SOLVED
Go to solution
MSwift
Regular Advisor

copy lib text file busy

I have to copy libc.1 from machine A to machine B. (machine A's libc.1 is not OK and hance the copy). when i do this i am not able to do it as it errors out with text file busy. Please let me know how i can copy /usr/lib/libc.1 from one machine to another.

Thanks

Mike
4 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: copy lib text file busy

Hi Mike:

You must rename (the shell's 'mv') the file. The 'mv' must be done within the same filesystem so that it does become a copy ('cp').

On the "bad" server:

# mv /usr/lib/libc.1 /usr/lib/libc.1.old

Having copied a good version from a good server as "*.new":

# cp -p /usr/lib/libc.1.new /usr/lib/libc.1

Regards!

...JRF...
MSwift
Regular Advisor

Re: copy lib text file busy

in case if that libc doesnt work i should be able to move that .old again - correct?

Thanks

Mike
James R. Ferguson
Acclaimed Contributor

Re: copy lib text file busy

Hi (again) Mike:

> in case if that libc doesnt work i should be able to move that .old again - correct?

Yes.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: copy lib text file busy

Why are you using the 10.x libc?

>JRF: You must rename (the shell's 'mv')

The proper command for fiddling with text busy files is the atomic "ln -f", not mv.
# cp -p .../libc.1.new /usr/lib/libc.1.new
# ln -f /usr/lib/libc.1 /usr/lib/libc.1.old
# ln -f /usr/lib/libc.1.new /usr/lib/libc.1

By using ln vs mv, the gap where there isn't a libc.1, is greatly reduced.

>in case if that libc doesn't work I should be able to move that .old again - correct?

No, you need that atomic "ln -f" again:
# ln -f /usr/lib/libc.1.old /usr/lib/libc.1

If you mess this up, plan B is to use /sbin/ln. And if that's messed up, plan C is /sbin/link & /sbin/unlink.