Complete.Org: Mailing Lists: Archives: discussion: February 2004:
[aclug-L] Re: File too short
Home

[aclug-L] Re: File too short

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: discussion@xxxxxxxxx
Subject: [aclug-L] Re: File too short
From: John Goerzen <jgoerzen@xxxxxxxxxxxx>
Date: Wed, 4 Feb 2004 08:22:15 -0600
Reply-to: discussion@xxxxxxxxx

On Tue, Feb 03, 2004 at 11:26:55PM -0600, bbales wrote:
> I scp'd some files to my wife's machine and one of them was a link to another 
> file, which was not on the target machine.  Linux locked up and won't boot.  
> I get a kernel panic:  
> init: error loading shared libraries:  libc.6.so:   file too short
> init: kernel panic:  attempting to kill init
> 
> The boot disk I made won't get it going.  

OK, you are pretty close to being totally hosed, but fear not, recovery
is possible.  (Take this from someone that was even closer than you a
couple weeks ago <g>)

Your problem is with the C library, libc.  This is not part of the
kernel, but almost every single program on the system (including the
likes of ls) requires it to run.  So no boot disk or chroot will work
because they are just using the same file as everything else.

However, install/rescue disks that have a Linux environment of their own
should be able to help you out.  You will want to boot off one of these
and repair the damage.

The files in question reside in /lib.  You should have (at least) two
files, like this:

-rw-r--r--    1 root     root      1244004 Jan 20 11:29 libc-2.3.2.so
lrwxrwxrwx    1 root     root           13 Jan 27 12:16 libc.so.6 ->
libc-2.3.2.so

That is, you will have a regular file named libc-(something) and a file
named libc.so.6.  If you are really lucky, your only problem is
libc.so.6.  You can rm libc.so.6, and then re-link it -- in this
example, the command would be:

ln -s libc-2.3.2.so libc.so.6

If you are not really lucky, your libc is messed up.  You will have to
re-install it from somewhere.  Knoppix may be a good way to go; you
could probably at least copy the file from /lib on the Knoppix
environment.

> knoppix can't get to it.

That is really strange, and I suspect that it's not actually the case;
Knoppix may not mount it for you automatically, but I'd be quite
surprised if it couldn't see it.  The only reason I could think of for
that is if you're using an exotic filesystem of some sort -- but even
then, I think Knoppix supports most filesystems.

You mentioned you had a working chroot... use it to cat the file
/etc/fstab on your system, and note where "/" is mounted from.  Then, in
Knoppix, try some commands like this:

mkdir /foo
mount /dev/hda4 /foo

(Replace /dev/hda4 with the path to your root partition from fstab).
Now:

cp /lib/libc* /foo/lib

Then, go into /foo/lib and make sure the link is correct like I
mentioned above.  Finally:

cd /
umount /foo

> Tried to upgrade with same cd (RH7.2) - it did the upgrade in about 10 
> minutes, but didn't change anything.  Still kernel panic

It probably looked at the RPM database and concluded that the version of
libc it was going to install is the same as the one on its CD.  You
might want to try an actual newer version of RedHat... Or, if you can
find the RPMs on the CD, try a command like this:

rpm --root /sys/image -i libc.rpm

> Everything but swap is on one partition and I'd sure like to save her /home 
> directory.

If all else fails, I can give you instructions on copying that out from
the rescue environment.

> Any ideas how to remove the offending piece of a file?

A couple :-)

-- John

-- This is the discussion@xxxxxxxxx list.  To unsubscribe,
visit http://www.complete.org/cgi-bin/listargate-aclug.cgi


[Prev in Thread] Current Thread [Next in Thread]