Jump to content

Recovering glibc-2.4 from RPM [solved]


epretorious
 Share

Recommended Posts

HELP! :huh:

 

I accidentally deleted three of glibc's libraries (libdl.so.2, libc.so.6, & librt.so.1) and now I'm not able to recover them using RPM:

 

[root@eto-dhcp34 ~]# rpm --Uvh /var/lib/misc/Mandrivalinux/media/main/glibc-2.4-4mdk.i586.rpm
--Uvh: unknown option
[root@eto-dhcp34 ~]# urpmi /var/lib/misc/Mandrivalinux/media/main/glibc-2.4-4mdk.i586.rpm
/usr/bin/perl: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory

Link to comment
Share on other sites

OMG - I had no idea how important these files are: When I rebooted the system, init complained...

 

/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: no such file or directory.

...and the boot process completely stopped!

 

What do I do now?! :huh:

Link to comment
Share on other sites

All three of those files are just dynamic links to the actual library files on my system:

 

libdl.so.2 --> libdl-2.4.so

libc.so.6 --> libc-2.4.so

librt.so.1 --> librt-2.4.so

 

If you have the files on the right of the arrow in your /lib, you should be able to recreate the links by running the following as root:

 

# cd /lib

# ln -s libdl-2.4.so libdl.so.2

# ln -s libc-2.4.so libc.so.6

# ln -s librt-2.4.so librt.so.1

 

or in general:

 

# ln -s <target> <link>

 

Edit: If you have a good livecd you can check your /lib for the above files and recreate the links per the above.

Edited by pmpatrick
Link to comment
Share on other sites

From a running Mandriva 2007.0 system:

 

[admin@vdc-vm2 lib]$ cd /lib
[admin@vdc-vm2 lib]$ ls -al libdl* librt*
-rwxr-xr-x 1 root root  9700 Jul 24  2006 libdl-2.4.so*
lrwxrwxrwx 1 root root	12 Dec  7 04:39 libdl.so.2 -> libdl-2.4.so*
-rwxr-xr-x 1 root root 26488 Jul 24  2006 librt-2.4.so*
lrwxrwxrwx 1 root root	12 Dec  7 04:39 librt.so.1 -> librt-2.4.so*

[admin@vdc-vm2 lib]$ cd /usr/lib
[admin@vdc-vm2 lib]$ ls -al libdl* librt* libc.*
-rw-r--r-- 1 root root 238 Jul 24  2006 libc.so
lrwxrwxrwx 1 root root  20 Dec  7 04:42 libdl.so -> ../../lib/libdl.so.2*
lrwxrwxrwx 1 root root  20 Dec  7 04:42 librt.so -> ../../lib/librt.so.1*

On my system (mounted at /mnt):

 

epretorious@epretorious-t43:/mnt/usr/lib$ cd /mnt/lib
epretorious@epretorious-t43:/mnt/lib$ ls -al libc.* librt.* libdl.*
ls: libc.*: No such file or directory
ls: librt.*: No such file or directory
ls: libdl.*: No such file or directory

epretorious@epretorious-t43:/mnt/lib$ cd /mnt/usr/lib/
epretorious@epretorious-t43:/mnt/usr/lib$ ls -al libc.* librt.* libdl.*
-rw-r--r-- 1 root root 238 2007-01-18 10:53 libc.so
lrwxrwxrwx 1 root root  11 2007-02-25 11:47 libc.so.6 -> libc-2.4.so
lrwxrwxrwx 1 root root  20 2007-02-25 11:49 libdl.so -> ../../lib/libdl.so.2
lrwxrwxrwx 1 root root  12 2007-02-25 11:47 libdl.so.2 -> libdl-2.4.so
lrwxrwxrwx 1 root root  20 2007-02-25 11:49 librt.so -> ../../lib/librt.so.1
lrwxrwxrwx 1 root root  12 2007-02-25 11:47 librt.so.1 -> librt-2.4.so

Assuming that I can just copy the libraries across, I've got some reconstructive surgery to do.

Link to comment
Share on other sites

If you have your install cds/dvd you can try doing an upgrade install over your present mdv installation. It might recreate your /lib for you without too much thinking.

I'm not sure that installing over the current installation is such a good idea: The current installation has been updated over time and the freshly-installed packages might conflict with the currently-installed (i.e., updated) packages.

 

Success! :D

 

I booted the system using an old hard drive and I copied the libraries from a running Mandriva 2007.0 system onto the root partition (mounted at /mnt) and recreated the links:

 

epretorious@epretorious-t43:/mnt/lib$ sudo ln -s librt-2.4.so librt.so.1
epretorious@epretorious-t43:/mnt/lib$ sudo ln -s libdl-2.4.so libdl.so.2

epretorious@epretorious-t43:/mnt/lib$ ls -al lib{dl,rt}*
-rwxr-xr-x 1 root root  9700 2007-04-26 21:30 libdl-2.4.so
lrwxrwxrwx 1 root root	12 2007-04-26 21:32 libdl.so.2 -> libdl-2.4.so
-rwxr-xr-x 1 root root 26488 2007-04-26 21:30 librt-2.4.so
lrwxrwxrwx 1 root root	12 2007-04-26 21:31 librt.so.1 -> librt-2.4.so

epretorious@epretorious-t43:/mnt/lib$ ls -al ../usr/lib/lib{dl,rt,c}.so
-rw-r--r-- 1 root root 238 2007-01-18 10:53 ../usr/lib/libc.so
lrwxrwxrwx 1 root root  20 2007-02-25 11:49 ../usr/lib/libdl.so -> ../../lib/libdl.so.2
lrwxrwxrwx 1 root root  20 2007-02-25 11:49 ../usr/lib/librt.so -> ../../lib/librt.so.1

Thanks!

Edited by epretorious
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...