Debian Packets fix – locale not working – cant install packets – Librarys broken

user511321 asked:

I did something horrible and hopefully didnt destroy my Debian 9 Strech… I googled like 2 Hours to fix this but nothing has helped…

What I Did:
my ClamAV was outdated, and I added a testing source into /etc/apt/sources.list manually and typed “apt-get install clamav” into terminal, now some Libs are Broken… Moreover I deleted the testing source again and tried to restore the state, but not successfully. The Command suggested to use “apt –fix-broken install” and I did.

Now it seems that my locale is completely gone and some librarys too:
Everytime I try to upgrade / Install something I get this:

Click for better readability (error Message)

> apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Setting up linux-image-4.9.0-8-amd64 (4.9.144-3.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.9.0-8-amd64
WARNING: no ldd around - install libc-bin
update-initramfs: failed for /boot/initrd.img-4.9.0-8-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.9.0-8-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 linux-image-4.9.0-8-amd64
> 
> 

Another Error message I get when I use “sudo apt-get install –reinstall libc-bin”

> 
> Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
> 
> The following packages have unmet dependencies:
 libc-bin : Depends: libc6 (< 2.25) but 2.28-6 is to be installed
E: Unable to correct problems, you have held broken packages.

(Sorry for this horrible quote of the commandline I wanted to post a Image, but I dont have enough reputations yet. I posted a link where you can find a better readable version.)

I tried to fix this by using these commands:

> sudo locale-gen "en_US.UTF-8"`
-> locale-gen: command not found
> 
> update-locale LANG=de_DE.UTF-8
-> update-locale: command not found

I also tried to follow this instruction:https://itsfoss.com/fix-exec-locale-file-directory/

DidnĀ“t help either.

Im so frustrated, cause I have no backup I can restore. Thanks for your help

My answer:


Whenever someone tells you to add sources from unstable or testing onto your stable system, you should ignore them and keep looking for another option. This is the #1 most common way Debian systems get broken.

It might be possible to fix the system with a dist-upgrade. First remove all the testing sources, ensuring that every apt source is on stable (or oldstable if that’s what you are running) and then:

apt-get update
apt-get dist-upgrade

As wurtel said in a comment, you could also change all your sources to testing, and then dist-upgrade to testing.

But keep in mind that your system is so damaged, that this may not even fix it, and your last option will be to reinstall the OS.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.