Fix stubborn 'Setting locale failed.'
Solution 1:
Had the same problem and found the solution. You have to recreate the custom.UTF-8
locale def (the "custom" file is probably there because you changed the date or time format). Run
sudo localedef -f UTF-8 -i custom custom.UTF-8
Another way to do this is to add the locale to the ones you want dpkg-reconfigure locales
to configure for you. On Debian:
echo 'custom.UTF-8 UTF-8' |sudo tee -a /etc/locale.gen
sudo dpkg-reconfigure locales
On Ubuntu:
echo 'custom.UTF-8 UTF-8' |sudo tee -a /var/lib/locales/supported.d/local
sudo dpkg-reconfigure locales
Hope this helps!
Solution 2:
You could also try to install the locales-all
package, to avoid having to generate any locales ever again.
Solution 3:
I solved the same problem on a Ubuntu 10.04 server this way:
root@hostname:~# export LANGUAGE=en_US.UTF-8
root@hostname:~# export LANG=en_US.UTF-8
root@hostname:~# export LC_ALL=en_US.UTF-8
root@hostname:~# locale-gen en_US.UTF-8
root@hostname:~# dpkg-reconfigure locales
Hope this could help.
Solution 4:
I solved the same problem on a Ubuntu 10.04 server this way:
$ export LANGUAGE=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ sudo locale-gen en_US.UTF-8
$ sudo dpkg-reconfigure locales
To make the changes permanent you need to add there variable into /etc/environment
$ sudo vi /etc/environment