Question

Language Problem on Ubuntu 14.04

  • Posted July 8, 2014

Droplet Ubuntu 14.04 LTS Error on installing postgresql:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_PAPER = "en_US.UTF-8",
        LC_ADDRESS = "en_US.UTF-8",
        LC_MONETARY = "en_US.UTF-8",
        LC_NUMERIC = "en_US.UTF-8",
        LC_TELEPHONE = "en_US.UTF-8",
        LC_IDENTIFICATION = "en_US.UTF-8",
        LC_MEASUREMENT = "en_US.UTF-8",
        LC_TIME = "en_US.UTF-8",
        LC_NAME = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.

With this error postgresql cant start:

Setting up postgresql-9.3 (9.3.4-1) ...
Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with

  pg_createcluster 9.3 main --start

or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * No PostgreSQL clusters exist; see "man pg_createcluster"

I’ve tried various methods presented by google, none solved my problem:

apt-get install --reinstall locales && sudo dpkg-reconfigure locales

dpkg-reconfigure locales

locale-gen en_US.UTF-8

locale-gen --no-purge --lang en_US.UTF-8
Subscribe
Share

locale -a locale: Cannot set LC_COLLATE to default locale: No such file or directory C C.UTF-8 POSIX en_AG en_AG.utf8 en_AU.utf8 en_BW.utf8 en_CA.utf8 en_DK.utf8 en_GB.utf8 en_HK.utf8 en_IE.utf8 en_IN en_IN.utf8 en_NG en_NG.utf8 en_NZ.utf8 en_PH.utf8 en_SG.utf8 en_US.utf8 en_ZA.utf8 en_ZM en_ZM.utf8 en_ZW.utf8

Can you run locale -a and post the output?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I was dealing with this problem FOR MANY HOURS with nothing suggested here as a working solution for me, until i found the answer on askubuntu. Turns out the problem was that i was CONNECTING FROM OS-X (my MAC) and supposedly If you are remotely connected to the Droplet over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from, So in short all that was needed was to add the following to the ~/.bash_profile (~/.zshrc for me cause i use oh my zsh)

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"

BAM!!, i tried EVERYTHING from editing the etc/default/locale file and the /etc/enviroment and many other things wise fellas recommended, but nothing ever worked, until i did THAT.

And let me say that BEFORE trying to resolve this issue i made a snapshot, so, just in case, to make sure it was not a mixed solution, i returned to my snapshot as it was BEFORE attempting to solve the issue, and again, the local solution (modifying my .zshrc file) was everything i needed. WEIRD.

I was dealing with this problem FOR MANY HOURS with nothing suggested here as a working solution for me, until i found the answer on askubuntu. Turns out the problem was that i was CONNECTING FROM OS-X (my MAC) and supposedly If you are remotely connected to the Droplet over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from, So in short all that was needed was to add the following to the ~/.bash_profile (~/.zshrc for me cause i use oh my zsh)

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"

BAM!!, i tried EVERYTHING from editing the etc/default/locale file and the /etc/enviroment and many other things wise fellas recommended, but nothing ever worked, until i did THAT.

And let me say that BEFORE trying to resolve this issue i made a snapshot, so, just in case, to make sure it was not a mixed solution, i returned to my snapshot as it was BEFORE attempting to solve the issue, and again, the local solution (modifying my .zshrc file) was everything i needed. WEIRD.

I was dealing with this problem FOR MANY HOURS with nothing suggested here as a working solution for me, until i found the answer on askubuntu. Turns out the problem was that i was CONNECTING FROM OS-X (my MAC) and supposedly If you are remotely connected to the Droplet over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from, So in short all that was needed was to add the following to the ~/.bash_profile (~/.zshrc for me cause i use oh my zsh)

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"

BAM!!, i tried EVERYTHING from editing the etc/default/locale file and the /etc/enviroment and many other things wise fellas recommended, but nothing ever worked, until i did THAT.

And let me say that BEFORE trying to resolve this issue i made a snapshot, so, just in case, to make sure it was not a mixed solution, i returned to my snapshot as it was BEFORE attempting to solve the issue, and again, the local solution (modifying my .zshrc file) was everything i needed. WEIRD.

I was dealing with this problem FOR MANY HOURS with nothing suggested here as a working solution for me, until i found the answer on askubuntu. Turns out the problem was that i was CONNECTING FROM OS-X (my MAC) and supposedly If you are remotely connected to the Droplet over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from, So in short all that was needed was to add the following to the ~/.bash_profile (~/.zshrc for me cause i use oh my zsh)

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"

BAM!!, i tried EVERYTHING from editing the etc/default/locale file and the /etc/enviroment and many other things wise fellas recommended, but nothing ever worked, until i did THAT.

And let me say that BEFORE trying to resolve this issue i made a snapshot, so, just in case, to make sure it was not a mixed solution, i returned to my snapshot as it was BEFORE attempting to solve the issue, and again, the local solution (modifying my .zshrc file) was everything i needed. WEIRD.

I was dealing with this problem FOR MANY HOURS with nothing suggested here as a working solution for me, until i found the answer on askubuntu. Turns out the problem was that i was CONNECTING FROM OS-X (my MAC) and supposedly If you are remotely connected to the Droplet over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from, So in short all that was needed was to add the following to the ~/.bash_profile (~/.zshrc for me cause i use oh my zsh)

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"

BAM!!, i tried EVERYTHING from editing the etc/default/locale file and the /etc/enviroment and many other things wise fellas recommended, but nothing ever worked, until i did THAT.

And let me say that BEFORE trying to resolve this issue i made a snapshot, so, just in case, to make sure it was not a mixed solution, i returned to my snapshot as it was BEFORE attempting to solve the issue, and again, the local solution (modifying my .zshrc file) was everything i needed. WEIRD.

The problem seems to be that LANGUAGE is unset.

Try:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

The problem seems to be that LANGUAGE is unset.

Try:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

The problem seems to be that LANGUAGE is unset.

Try:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

The problem seems to be that LANGUAGE is unset.

Try:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

The problem seems to be that LANGUAGE is unset.

Try:

export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale