perl warning – Setting locale failed.

Debian logo

Ak zvyknete narážať na nasledovnú chybu po čerstvej inštalácii Debianu, riešenie je nasledovné:

$ apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
   apt (0.9.7.5 => 0.9.7.6)
   apt-utils (0.9.7.5 => 0.9.7.6)
   dpkg (1.16.8 => 1.16.9)
...
   tzdata (2012f-1 => 2012g-1)
25 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 11.6 MB of archives.
After this operation, 554 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Fetched 11.6 MB in 0s (13.1 MB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = "",
        LC_TIME = "en_US.UTF-8",
        LC_CTYPE = "sk_SK.UTF-8",
        LC_MONETARY = "sk_SK.UTF-8",
        LC_COLLATE = "sk_SK.UTF-8",
        LC_ADDRESS = "sk_SK.UTF-8",
        LC_TELEPHONE = "sk_SK.UTF-8",
        LC_MESSAGES = "en_US.UTF-8",
        LC_NAME = "sk_SK.UTF-8",
        LC_MEASUREMENT = "sk_SK.UTF-8",
        LC_IDENTIFICATION = "sk_SK.UTF-8",
        LC_NUMERIC = "sk_SK.UTF-8",
        LC_PAPER = "sk_SK.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_ALL to default locale: No such file or directory
Preconfiguring packages ...

Riešenie problému je nasledovné. Žiaľ, nestačí samostatný príkaz dpkg-reconfigure locales, ale je potrebné použiť nasledovnú sadu príkazov.


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

Otestovať postup môžete takto:

perl -e 'print 1';

Dúfam, že tento návod bude čoskoro nepotrebný a že chybu inštalátora v Debiane čo najskôr opravia.