setlocale: LC_ALL: cannot change locale (0.UTF-8)

Just had to re-install the latest version for my Pi downloaded today . (the backup I created on USB flash failed to reinstall but that’s another story)
Anyway trying to install samba and openvpn and I get the following :/bin/bash: warning: setlocale: LC_ALL: cannot change locale (0.UTF-8)
This repeats many many, times and I don’t know what I should do. I have tried to go in and set the locale from dietpi-config and I get a warning perl set locale failed?

Don’t know where to go from here. Any help appreciated.

Lets try a reset to en.GB:

  • dietpi-config > Language/Regional Options > Locale.
  • Scroll down to en_GB.UTF-8 UTF-8 and make sure it is ticked (*) with spacebar, then press enter
  • Select en_GB.UTF-8 as default locale, then press enter
  • reboot

Once rebooted, you should see the following when running locale:

root@DietPi:~# locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=

Thanks very much for the fast reply. II have tried that more than once and it doesn’t appear to save the changes after reboot. I still get this

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “0.UTF-8”,
LANG = “en_GB.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_GB.UTF-8”).

Just to confirm locale comes up with this:
root@DietPi:~# ~# locale
-bash: ~#: command not found
root@DietPi:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE=“0.UTF-8”
LC_NUMERIC=“0.UTF-8”
LC_TIME=“0.UTF-8”
LC_COLLATE=“0.UTF-8”
LC_MONETARY=“0.UTF-8”
LC_MESSAGES=“0.UTF-8”
LC_PAPER=“0.UTF-8”
LC_NAME=“0.UTF-8”
LC_ADDRESS=“0.UTF-8”
LC_TELEPHONE=“0.UTF-8”
LC_MEASUREMENT=“0.UTF-8”
LC_IDENTIFICATION=“0.UTF-8”
LC_ALL=0.UTF-8
root@DietPi:~#

Please paste results of:

cat /etc/locale.gen | grep '^[a-z0-9]'

May I suggest:

dpkg-reconfigure locales

and see what happens?

Results posted as requested:
root@DietPi:~# cat /etc/locale.gen | grep ‘^[a-z0-9]’
en_GB.UTF-8 UTF-8
root@DietPi:~#
root@DietPi:~# Fourdee
-bash: Fourdee: command not found
root@DietPi:~# Site Admin
-bash: Site: command not found
root@DietPi:~#
root@DietPi:~# Posts: 1448
-bash: Posts:: command not found
root@DietPi:~# Joined: Tue Feb 06, 2007 12:36 pm
-bash: Joined:: command not found
root@DietPi:~#
root@DietPi:~#

No luck wont change locales:-

root@DietPi:~# dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “0.UTF-8”,
LANG = “en_GB.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_GB.UTF-8”).
Generating locales (this might take a while)…
en_GB.UTF-8… done
Generation complete.

That’s odd!

It happen to me when I removed a package that now I can’t remember exactly. Look in /etc/environment and change 0.UTF-8 to your locale, or comment according to https://wiki.debian.org/Locale#Standard.

Hope this helps.

Thanks, that worked . I was able to edit the /etc/environment to change locacle as you suggested.
:stuck_out_tongue:

If I remember right it happen when passing from dropbear to openssh in a non-fresh install.

Hi,

I’ve got the same problem and i’ve tried these solutions… close, but no sigar.

Can anyone help me?

bump

anyone?

Having same problem with fresh install.

I had same fixed by:

/etc/environment


LC_ALL=en_GB.UTF-8
LANG=en_GB.UTF-8

Easy fix work for me:

root@raspberrypi:~$ export LANGUAGE=en_US.UTF-8
root@raspberrypi:~$ export LANG=en_US.UTF-8
root@raspberrypi:~$ export LC_ALL=en_US.UTF-8
root@raspberrypi:~$ locale-gen en_US.UTF-8
root@raspberrypi:~$ dpkg-reconfigure locales

as soon as I run the last I was asked to choose the locale to generate. My choice was en_US-UTF.8

That’s all, the annoying message disappear!

Thanks John,

Bizarre, I’am still yet to experience the reported 0.UTF-8 issue, on any board (and I go through alot, testing most days lol :slight_smile:).

Still unsure what the cause of this is, but we can look at applying John’s fix into DietPi by default to try and prevent this for our users:
https://github.com/Fourdee/DietPi/issues/825

Ok, John’s fix is coming in v147.

John, any chance you could you check if setting current default locale into /etc/environment results in the 0.UTF-8 issue reoccurring?

Get current locale:

cat /etc/default/locale | grep -m1 '^LANG=' | sed 's/.*=//'

Then replace /etc/environment entries accordingly.
Reboot.