0

I'm using 64-bit Crunchbang, which is Debian-based.

I was trying to fix a certain problem with libc6, and naively followed the advice of an askUbuntu answer (link) that made me run the following command:

sudo ln -sf /lib32/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6

Now I cannot run a single terminal command or GUI program. On terminal I get a plethora of errors. Here is ls, for example:

ls: error while loading shared libraries: libs.so.6: wrong ELF class: ELFCLASS32

sed: error while loading shared libraries: libs.so.6: wrong ELF class: ELFCLASS32

/usr/bin/env: error while loading shared libraries: libs.so.6: wrong ELF class: ELFCLASS32

date: error while loading shared libraries: libs.so.6: wrong ELF class: ELFCLASS32

sed: error while loading shared libraries: libs.so.6: wrong ELF class: ELFCLASS32

GUI programs simply don't launch or give me strange errror messages.

In short, I have no way to delete the symlink that caused this catastrophe. What can I do to get my computer working again?

3
  • Is it possible to boot to a Linux live CD, mount the hard disk and fix it from there? I haven't done that so I'm not sure what permissions you might be missing.
    – baochan
    Jul 19, 2014 at 14:34
  • Thanks, if I don't find an easier solution I might try this. I don't know about the permissions either. Jul 19, 2014 at 14:36
  • @erlkoenig I don't think you have much of a choice unless you have busybox installed...and even then it may still link back to libc
    – Lawrence
    Jul 19, 2014 at 15:18

2 Answers 2

0

The /lib32 folder can only contain 32 bit libraries. You created a link of libc.so.6 in /lib32 that points to the 64 bit version of the same file. Get a 32 bit version of libc.so.6 and place it in the /lib32 folder.

4
  • That's the wrong way around. OP created a link from the 32bit into the 64bit location.
    – Lawrence
    Jul 19, 2014 at 15:16
  • I thought so, but of course I cannot get the 32-bit version in the current state. Jul 19, 2014 at 16:20
  • can you download it on another computer place it on a memory stick? Mount the memory stick on your linux and cp the file into place.
    – cybernard
    Jul 19, 2014 at 17:04
  • I asked a new question, and I would appreciate your help: superuser.com/q/788304 Jul 26, 2014 at 3:30
0

Since you've mucked up your libc and generally every useful utility depends on it, your only real convenient option is to boot off a Live CD / USB and fix it, or stick your hard drive in somebody else's computer (don't boot off it) and fix it from there.

To fix it, undo what you did.

However, your poor choice of the -f option to ln and presumed failure to back up any original file means that if /lib/x86_64-linux-gnu/libc.so.6 actually existed before you did that command, it was overwritten. In that case your best bet would be to obtain a copy from elsewhere, hopefully a compatible version, then do a forced reinstall of libc once you get your machine operational again just to make sure that all the right versions of the right files are in the right places.

If you didn't have that file to begin with then no worries there.

After you clean this all up, consider attempting less risky solutions to whatever your problem was, such as unmasking and installing correct packages for your platform, etc., instead of mucking around with symlinks to critical libraries.

2
  • I booted a live USB and removed the bad symlink, but now my computer won't boot---as you guessed above, the original libc.so.6 was deleted and is needed for init. Where should I get the libc.so.6 from to replace it? Google has many results. Jul 23, 2014 at 2:45
  • I made this a separate question: superuser.com/q/788304 Jul 26, 2014 at 3:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .