Setting locale failed error on Ubuntu or Debian

Sometimes I get a weird error message when using apt-get or dpkg on certain Ubuntu or Debian systems. More particularly, this happened on a server I was running and confused me quite a bit. Basically, when working with packages, I kept getting the following message:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.

After some research online, I found the quickest was to fix this was to run (as root):

apt-get install language-pack-en-base

I was also told to execute the following, but I found it to be unnecessary:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

I hope this helps someone else, too. Remember to change en_US to your desired locale.

Advertisement


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 45 other followers