locales broken on Beaglebone Black running Debian

2

1

So this all started when I wanted to install my custom daemon on my Beaglebone Black running Debian using update-rc.d mydaemon defaults 97 like I've done many times during it's development on my Mint host. And I'm greeted with:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
   LANGUAGE = (unset),
   LC_ALL = (unset),
   LC_PAPER = "es_CL.UTF-8",
   LC_ADDRESS = "es_CL.UTF-8",
   LC_MONETARY = "es_CL.UTF-8",
   LC_NUMERIC = "es_CL.UTF-8",
   LC_TELEPHONE = "es_CL.UTF-8",
   LC_IDENTIFICATION = "es_CL.UTF-8",
   LC_MEASUREMENT = "es_CL.UTF-8",
   LC_NAME = "es_CL.UTF-8",
   LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
update-rc.d: using dependency based boot sequencing

Which I subsequently tried to fix with dpkg-reconfigure locales, to which it replies

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_MONETARY = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LANG = "en_US.UTF-8"
     are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  en_US.ISO-8859-1...locale alias file `/usr/share/locale/locale.alias' not found: No such file or directory
 done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_MONETARY = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_PAPER = "es_CL.UTF-8",
    LANG = "C"
     are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_MONETARY = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_PAPER = "es_CL.UTF-8",
    LANG = "C"
     are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

I have no idea how to fix this as it refuses to let me install any packages or update anything... Anyone have any ideas? I'm stumped...

p.s. I've seen Configure Locales on Debian and this does not work for me (i.e. source /etc/default/locale)

p.p.s I also checked /etc/locales.gen shell and en_US.UTF-8 UTF-8 is uncommented as it is supposed to be and the shell script suggests to run locale-gen and I get

Generating locales (this might take a while)...
en_US.UTF-8...locale alias file `/usr/share/locale/locale.alias' not found: No such file or directory

Chris

Posted 2015-03-03T21:35:39.223

Reputation: 121

Answers

4

So after looking through all the Debian manuals and the BeagleBone build I finally figured out what has happened! I thought I'd put this up in case anyone runs into this problem. In order to fix the locales I needed to manually re-write the /etc/default/locale file with: (if your in north American for example you would use "en_US.UTF-8" for all).

LANG="en_US.UTF-8"
LC_NUMERIC="es_CL.UTF-8"
LC_MONETARY="es_CL.UTF-8"
LC_PAPER="es_CL.UTF-8"
LC_NAME="es_CL.UTF-8"
LC_ADDRESS="es_CL.UTF-8"
LC_TELEPHONE="es_CL.UTF-8"
LC_MEASUREMENT="es_CL.UTF-8"
LC_IDENTIFICATION="es_CL.UTF-8"

You then need to ensure the shell script /etc/locale.gen has all the locales you intend to use uncommented i.e. sudo nano /etc/locale.gen.

You then need to fix the symbolic link that locales expects, that the kernel should have made on installation, this is done by: sudo ln -s /etc/locale.alias /usr/share/locale/locale.alias

Finally run dpkg-reconfigure locales to fix the linking, and everything should be running fine now.

(On a side note: I realized later that the update-rc.d is a legacy tool on the later Debian releases, such as that on the BeagleBone black, the daemon shell should be installed using insserv mydaemon instead)

Chris

Posted 2015-03-03T21:35:39.223

Reputation: 121

This worked on a debian container build. Thanks! – bryanmac – 2018-06-08T00:04:38.327