-1

We have accidently renamed shared library /lib64/libc.so.6 to be /lib64/libc.so_6. Right after previous command the system (CentOS 6.9) throws the following error :

error while loading shared libraries: /lib64/libc.so.6: cannot open shared object file: No such file or directory

When logged in within rescue mode I followed the following commands :

mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
</Code>

Then i get the following error :

/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

I also tried the following commands :

chroot /mnt /bin/bash
chroot /mnt/root/tmp /bin/bash
chroot /mnt/root/tmp /mnt/bin/bash

Then get another error

chroot: failed to run command ‘/mnt/bin/bash’: No such file or directory

Now the system is down and I only have ssh which failed once "libc.so.6" renamed, and rescue mode. How could I enter to system so that i can rename "libc.so_6" back to "libc.so.6"? Is there a work-around to bypass checking for "libc.so_6"?

halfer
  • 19,824
  • 17
  • 99
  • 186
LiNuX
  • 21
  • 7
  • I don't know if it actually works, but have you tried booting into some other OS from live USB, mounting the FS with the corrupted .so and renaming it from there? – Topper Harley Dec 11 '18 at 13:34
  • Can you try to renaming libc.so.6 back, without chroot? e.g. `mv /mnt/lib64/libc.so_6 /mnt/lib64/libc.so.6` – Kuchara Dec 11 '18 at 13:35
  • Kuchara, many thanks brother, yes it worked, sorry i didnt slept well since three days, you solved my problem brother , many thanks again Kuchara – LiNuX Dec 11 '18 at 13:38
  • Welcome. By the way, first answer which came to my mind was: restore system from backup. – Kuchara Dec 11 '18 at 13:41
  • Be sure to accept the answer provided. ;) – Paul Hodges Dec 11 '18 at 14:13
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Dec 11 '18 at 18:21

1 Answers1

1

For the sake of clarity, will post the answer here (in case someone else encounter similar trouble).

When in rescue mode:

mount /dev/md2 /mnt
mv /mnt/lib64/libc.so_6 /mnt/lib64/libc.so.6

Alternatively:

  • restore system from backup
  • try booting from some live USB (as Topper Harley proposed in comments)
Kuchara
  • 622
  • 7
  • 16