Mistakenly renamed libdl.so: system got corrupted


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Mistakenly renamed libdl.so: system got corrupted
# 1  
Old 12-30-2010
Mistakenly renamed libdl.so: system got corrupted

Hi,

I am using Ubuntu 8.04 64-bit (Hardy Heron LTS Desktop edition) OS on a 64-bit intel hardware (x86_64). I have wrongly renamed the /lib64/libdl-2.7.so shared library file and now hardly few commands are working. My Gnome UI display has gone and I could not establish any new connection via SSH. I cannot run "ls" or "mv", or "cp" as these basic commands rely on libdl library for dlopen, dlclose operations etc,. It is a build server machine for our project and I am reluctant to reboot the system as it has to be run 24/7 (Hudson setup is there).

How I can resolve the system now? I guess recovery mode does not help in this case.
What if I boot via Ubuntu installation Live CD and mount the hard-disk and do the rename? Will it help?

What other options I have been left out?

This is really an urgent issue. Your help is highly solicited and appreciated.
# 2  
Old 12-30-2010
At this point, I'd be booting the system from my handy dandy knoppix CD.

You going to need something running that allows you to rename the shares library file back to it's original name.
# 3  
Old 12-30-2010
Boot another OS, mount broken system, and repair ..... That's what most of us would do.
# 4  
Old 12-30-2010
I believe ubuntu comes with busybox. If ubuntu's version of busybox is compiled statically, it will provide a minimal shell and minimal toolset without any libraries. ...which is kind of the point of having it, so I hope so.

On my Gentoo system, /bin/bb is a minimal shell, and /bin/busybox can be used to call the builtin programs:
Code:
$ /bin/busybox
BusyBox v1.15.3 (2010-12-30 13:47:04 CST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

	BusyBox is a multi-call binary that combines many common Unix
	utilities into a single executable.  Most people will create a
	link to busybox for each function they wish to use and BusyBox
	will act like whatever it was invoked as!

Currently defined functions:
	[, [[, acpid, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk,
	basename, bb, bbconfig, bbsh, beep, blkid, brctl, bunzip2, bzcat,
	bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd,
	chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond,
	cryptpw, cttyhack, cut, date, dd, deallocvt, delgroup, deluser, depmod,
	devmem, df, dhcprelay, diff, dirname, dmesg, dnsdomainname, dos2unix,
	dpkg-deb, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env,
	envdir, envuidgid, ether-wake, expand, expr, false, fbset, fdflush,
	fdformat, fdisk, fgrep, find, findfs, flash_eraseall, flash_lock,
	flash_unlock, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, fuser,
	getopt, getty, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump,
	hostname, httpd, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd,
	ifup, init, insmod, install, ionice, ip, ipaddr, ipcrm, ipcs, iplink,
	iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd,
	last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap,
	logger, login, logread, losetup, lpq, lpr, ls, lsattr, lsmod, lzmacat,
	lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom,
	mkdir, mkdosfs, mkfifo, mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap,
	mktemp, modprobe, more, mount, mountpoint, mt, mv, nameif, nc, netstat,
	nice, nmeter, nohup, nslookup, openvt, passwd, patch, pgrep, pidof,
	ping, ping6, pipe_progress, pivot_root, pkill, popmaildir, poweroff,
	printenv, printf, ps, pscan, pwd, raidautorun, rdate, rdev, readahead,
	readlink, readprofile, realpath, reboot, reformime, renice, reset,
	resize, rm, rmdir, rmmod, route, rtcwake, run-parts, runlevel, runsv,
	runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch,
	setconsole, setfont, setkeycodes, setlogcons, setsid, setuidgid, sh,
	sha1sum, sha256sum, sha512sum, showkey, sleep, softlimit, sort, split,
	start-stop-daemon, stat, strings, stty, su, sum, sv, svlogd, swapoff,
	swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tee,
	telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr,
	traceroute, true, tty, ttysize, tunctl, udhcpc, udhcpd, umount, uname,
	uncompress, unexpand, uniq, unix2dos, unlzma, unlzop, unzip, uptime,
	usleep, vconfig, vi, vlock, volname, watch, watchdog, wc, wget, which,
	who, whoami, xargs, yes, zcat, zcip

$ ls -l /bin/bb
lrwxrwxrwx 1 root root 7 Dec 30 13:48 /bin/bb -> busybox
$ ldd /bin/busybox
        not a dynamic executable
$ /bin/bb
~ # /bin/busybox touch file
~ # /bin/busybox ls -l file
-rw-r--r--    1 root     root            0 Dec 30 13:52 file
~ # /bin/busybox mv file file2
~ # /bin/busybox ls -l file2
-rw-r--r--    1 root     root            0 Dec 30 13:52 file2
~ #

If you have a shell and nothing else, this might be able to save you. If not, you might be able to boot with "init=/bin/bb", maybe.

Otherwise, you're back at the livecd option.

Last edited by Corona688; 12-30-2010 at 04:01 PM..
# 5  
Old 12-31-2010
Hi.

The busybox details on a 32-bit Ubuntu system I use in a virtual machine:
Code:
% file /bin/busybox
/bin/busybox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.15, stripped

context of system:
Code:
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.32-26-generic, i686
Distribution        : Ubuntu 10.04.1 LTS (lucid) 
GNU bash 4.1.5
busybox - ( /bin/busybox Apr 22 2010 )

Some examples:
Code:
vm-ubuntu ~ % /bin/busybox ls -li t1
    340 -rw-r--r--    1 drl  drl       732 Jun 12  2010 t1
vm-ubuntu ~ % /bin/busybox mv t1 t2
vm-ubuntu ~ % /bin/busybox ls -li t2
    340 -rw-r--r--    1 drl  drl       732 Jun 12  2010 t2

Good luck ... cheers, drl
# 6  
Old 12-31-2010
Hmmm....

I think most people don't have busybox installed on their ubuntu systems. In order to illustrate this, I will login to three ubuntu servers on the net and see if busybox has been installed:

First server (Dedicated Ubuntu server in EU):

Code:
user@dedicated:~# /bin/busybox
-bash: /bin/busybox: No such file or directory

Second server (Slicehost Ubuntu server in US, East Coast):

Code:
user@slicehost:~# /bin/busybox
-bash: /bin/busybox: No such file or directory

Third server (Linode Ubuntu server, Central US):

Code:
user@linode:~# /bin/busybox 
-bash: /bin/busybox: No such file or directory

---------- Post updated at 13:36 ---------- Previous update was at 13:25 ----------

Also, FWIW, I just did a standard apt-get install busybox install on a 64 bit Ubuntu server, and got an ELF dynamic installation:

Code:
user@linode:~# apt-get install busybox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  busybox
0 upgraded, 1 newly installed, 0 to remove and 36 not upgraded.
Need to get 335kB of archives.
After this operation, 586kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  busybox
Install these packages without verification [y/N]? yes
Get:1 http://ftp2.de.debian.org lenny/main busybox 1:1.10.2-2 [335kB]
Fetched 335kB in 1s (307kB/s)   
Selecting previously deselected package busybox.
(Reading database ... 18074 files and directories currently installed.)
Unpacking busybox (from .../busybox_1%3a1.10.2-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up busybox (1:1.10.2-2) ...


Code:
user@linode:~# /bin/busybox
BusyBox v1.10.2 (Debian 1:1.10.2-2) multi-call binary
Copyright (C) 1998-2007 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as!

Currently defined functions:
        [, [[, adjtimex, arping, ash, awk, basename, brctl, bunzip2, bzcat, bzip2, cal, cat, chgrp, chmod, chown, chroot,
        chvt, clear, cmp, cp, cpio, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dos2unix, du, dumpkmap, echo, egrep,
        env, expr, false, fgrep, find, fold, free, ftpget, ftpput, getopt, grep, gunzip, gzip, head, hexdump, hostid, hostname,
        httpd, id, ifconfig, ip, ipcalc, kill, killall, klogd, last, length, ln, loadfont, loadkmap, logger, logname, logread,
        losetup, ls, lzmacat, md5sum, mkdir, mkfifo, mknod, mktemp, more, mount, mt, mv, nameif, nc, netstat, nslookup, od,
        openvt, patch, pidof, ping, ping6, printf, ps, pwd, rdate, readlink, realpath, renice, reset, rm, rmdir, route, rpm,
        rpm2cpio, run-parts, sed, setkeycodes, sh, sha1sum, sleep, sort, start-stop-daemon, strings, stty, swapoff, swapon,
        sync, sysctl, syslogd, tac, tail, tar, tee, telnet, test, tftp, time, top, touch, tr, traceroute, true, tty, umount,
        uname, uncompress, uniq, unix2dos, unlzma, unzip, uptime, usleep, uudecode, uuencode, vi, watch, watchdog, wc, wget,
        which, who, whoami, xargs, yes, zcat

Code:
user@linode:~# ldd /bin/busybox
        linux-vdso.so.1 =>  (0x00007fff01dff000)
        libm.so.6 => /lib/libm.so.6 (0x00007fbf29a6d000)
        libc.so.6 => /lib/libc.so.6 (0x00007fbf296fd000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fbf29cf1000)

Code:
user@linode:~# file /bin/busybox
/bin/busybox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped

---------- Post updated at 13:45 ---------- Previous update was at 13:36 ----------

And just a note, I just checked and to get a static version of busybox on ubuntu, you need to

Code:
apt-get install busybox-static

Resulting in:

Code:
user@linode:~# file /bin/busybox
/bin/busybox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.6.8, stripped

user@linode:~# ldd /bin/busybox
        not a dynamic executable

# 7  
Old 12-31-2010
Hi.

One needs to install / have installed the static version:
Code:
% apt-cache search busybox
busybox-initramfs - Standalone shell setup for initramfs
busybox-static - Standalone rescue shell with tons of builtin utilities
busybox - Tiny utilities for small and embedded systems
...

Juding by the maintainers, I'd guess that this is in a standard install:
Code:
Description: Standalone rescue shell with tons of builtin utilities
 BusyBox combines tiny versions of many common UNIX utilities into a single
 small executable. It provides minimalist replacements for the most common
 utilities you would usually find on your desktop system (i.e., ls, cp, mv,
 mount, tar, etc.).  The utilities in BusyBox generally have fewer options than
 their full-featured GNU cousins; however, the options that are included
 provide the expected functionality and behave very much like their GNU
 counterparts.
 .
 busybox-static provides you with a statically linked simple stand alone shell
 that provides all the utilities available in BusyBox. This package is
 intended to be used as a rescue shell, in the event that you screw up your
 system. Invoke "busybox sh" and you have a standalone shell ready to save
 your system from certain destruction. Invoke "busybox", and it will list the
 available builtin commands.
Original-Maintainer: Debian Install System Team <debian-boot@lists.debian.org>

I was not using server, but 32-bit Desktop. I don't recall installing busybox separately. If the OP has a more-or-less standard install, then I'd expect a statically-linked version. However, there are differences (OP vs. mine): 64 vs. 32, 8.04 vs. 10.04, so the only way to tell is for the OP to try it ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Renamed Volume Group name on Webmin while running samba server (oops)

Hi...I'm new to Linux and was working on a home server. I have it operational with Samba Share as my NAS system. Unfortunately, while I was on Webmin I changed the Logical Volume Group Name and now I can't find the data I had saved on my Samba Server. Can anyone help me recover those files? ... (0 Replies)
Discussion started by: pangil
0 Replies

2. Shell Programming and Scripting

Renaming file and check for the renamed file existence

Hi Am trying to move a file from one name to another When I do "ls" to check for the moved filename I can see the file but when I try the same with a script am unable.. I think am doing some pretty silly error.. please help.. toMove=`ls | grep -E "partition.+"` mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

3. Shell Programming and Scripting

who renamed my executable

Hi All, I connected via rlogin in testing environment (ksh ) and placed an executable with -rwxr-xr-x permission. eg: from my own unix box used : rlogin host -l user But the exe was renamed by somebody. since it's only renaming none of the access time , modification time etc is altered.... (2 Replies)
Discussion started by: blackcat
2 Replies

4. Solaris

recover a corrupted solaris10 system /usr/lib

did something very dump under /usr/lib, eg: overwite a bunch of files from a similar system's /usr/lib, while the system is live.. I have no backup on this..it crashed...and came up with a bunch of device driver load errors and hung... This is Solaris10 update 7 .. I wonder if I could do a... (0 Replies)
Discussion started by: ppchu99
0 Replies

5. Solaris

UFS File System Periodically Corrupted - What to check?

The system is a SunFire V440 running SunOS 5.10 About once every 3-4 weeks, the system will reboot into single user mode on its own, and then I run svcs -xv, the filesystem service and dependent services will be disabled due to the metadisk file system being corrupted. The I've been doing... (2 Replies)
Discussion started by: the.gooch
2 Replies

6. Solaris

Renamed lib directory by mistake

Let's say someone accidentally renamed the lib directory in Solaris 8, and now they cannot get into the terminal or even rename the folder via file manager.What would one do? (37 Replies)
Discussion started by: jetjaguar
37 Replies

7. UNIX for Advanced & Expert Users

Critical lib renamed

Hello I have moved a critical lib from its location, so all programms linked to libc dont work . I still have two shells on the machine, bash and ksh The only thing I see is copying back the lib, but of course : dd, cp , mv etc are dead . So i tryed a loop with read ... {^Jwhile read... (24 Replies)
Discussion started by: remi75
24 Replies

8. Shell Programming and Scripting

rsync - update file on backup when file renamed on source

hi all, Please help me with rsync. I configured rsync to preserve timestamps using the -a option. When i renamed fileA to fileB on source machine I have to copies at the backup server. The aim is to keep the most recent file. fileA & fileB has same contents. When i renamed fileB to... (2 Replies)
Discussion started by: coolatt
2 Replies

9. Shell Programming and Scripting

duplicate index names renamed

Hello everyone ! Please have a minute and see if you know how to script this I have a file like this: "create table .... ... create index n112 on ... ... create table ... .... create index n113 on... ... create table ... create index n112 on ...! duplicate ... (1 Reply)
Discussion started by: sotoc79
1 Replies

10. UNIX for Advanced & Expert Users

mistakenly issued crontab -r

HPUX 11 (32bit) An ordinary user (not root) had mistakenly issued "crontab -r" which removed the crontab file corresponds to his user_id. (well, on our keyboard R is next E, where "crontab -e" is to edit the crontab file) :( Is there any way to recover the removed crontab file by that... (2 Replies)
Discussion started by: kanang
2 Replies
Login or Register to Ask a Question