Fix: Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/

Ubuntu apt-get update error


While running apt-get, you run in to an error that looks like:

Can’t exec “locale”: No such file or directory at /usr/share/perl5/Debconf/ line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/ 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)

This is a commonly occurring issue in Debian and Debian based Linux distributions such as Ubuntu and Linux Mint. You’ll stuck this problem and will not be able to update or install new programs.

My friend ran into this problem while running Ubuntu 12.04 but the solution presented here should be applicable to newer versions such as Ubuntu 14.04, 14.10 and 15.04 as well.


As per this old forum thread, ldconfig perhaps have been moved from libc6 to libc-bin. Here is what you can do to fix this issue.

In a terminal, use the following commands to download and extract the libc-bin package:

apt-get download libc-bin
dpkg -x libc-bin*.deb unpackdir/

Next you need to copy these files:

sudo cp unpackdir/sbin/ldconfig /sbin/

Now you need to make sure that things are in order. Run these commands to ensure that:

sudo apt-get install --reinstall libc-bin
sudo apt-get install -f

Normally, this should fix the problem of Can’t exec “locale”: No such file or directory at /usr/share/perl5/Debconf/ line 16. Do let me know in the comment section whether or not this fixes your problem.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️


Making You a Better Linux User


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.