Ubuntu – Error with sudo apt-get -f install (ldconfig not found)

14.04aptcommand linedirectorysoftware installation

I am using 14.04 LTS. When I type sudo apt-get -f install into the terminal I get this error:

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.
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

Please help, thanks.


In response to Faizan who said "try executing sudo dpkg-reconfigure -a" in comments. When I tried that I got this message:

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.
acpid stop/waiting
acpid start/running, process 11426
/var/lib/dpkg/info/activity-log-manager.postinst: 5: /var/lib/dpkg/info/activity-log-manager.postinst: ldconfig: not found

Edit:

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.
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

Best Answer

Try this workaround if it works for you. Make sure you have not activated unstable repos for different releases or pre-released updates but for 14.04 LTS recommended only check in --> system settings/software & updates.

then run:

sudo apt-get -f install

sudo dpkg-reconfigure libc6

sudo dpkg-reconfigure libc-bin

sudo apt-get install --reinstall libc6

sudo apt-get install --reinstall libc-bin

sudo apt-get dist-upgrade

Other way:

Download libc-bin here e.g.

Then you'll have to extract it:

dpkg -x libc-bin*.deb unpacked/

copy the files to system:

sudo cp unpacked/sbin/ldconfig /sbin/

Or open Nautilus with:

gksudo nautilus

and do this GUI way, right click on a .deb package and choose extract here and copy to destination place.

And then:

sudo apt-get install --reinstall libc-bin

sudo apt-get install -f
Related Question