Debian – “aptitude -f install” fails

aptitudedebiandebian-lennyinstallation

using debian lenny and trying to do a "aptitude -f install"

I get this error message:

Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encod           ing.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/s           hare/perl5/Debconf/Encoding.pm line 17.
dpkg: `ldconfig' not found on PATH.
dpkg: 1 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install.  Trying to recover:
dpkg: `ldconfig' not found on PATH.

UPDATE
I managed to get a bit further. New error message is

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.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done

So at least ldconfig is back.

** UPDATE 2 **

newest error message:

unknown initscript, /etc/init.d/glibc.sh not found.

getting there… one step after the other
Does anyone of you have any idea as to why and how to repair this?

Best Answer

If you did that as root AND you have /sbin, /usr/sbin and /usr/local/sbin in root's path, you may need to do

  apt-get --reinstall install libc6

to refresh your libc package from scratch and reinstall some corrupted or missing binaries.

The locale seetings are a bit trickier; make sure you've got the 'locales' package installed and maybe the 'locales-all' package as well. You might also try (as root):

dpkg-reconfigure libc6