1

I've been having troubles with locales recently. I've been having a problem with them since a long time ago, but didn't bother to fix (dumb me, maybe back then I was closer to solving this problem). Recently I've been trying to code a little bit in Perl, and after running the script an information popped up:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = "en_US.UTF-8",
    LC_CTYPE = "en_US.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

I've been trying to configure /etc/default/locale, adding lines, since I've lurked around other SO's threads:

LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"

To the file, and then running:

locale-gen en_US.UTF-8

But while running this command, I only receive:
Generating locales (this might take a while)....
pl_PL.UTF-8... done     # (which is my native language)
Generation complete.

Then I've ran:

sudo dpkg-reconfigure locales

I've chosen en_US.UTF-8 locales to generate, rebooted, bam. Terminal is not opening up. I've changed the default language in settings to Polish, and terminal opened up, but upon starting it a warning popped up:

bash: warning: setlocale: LC_ALL: can't change locale (en_US.UTF-8): No file or directory

This error was printed in my native language by the way, but I've translated it. Most probably because of the language change.

locale -a prints that:

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_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
pl_PL.utf8

1 Answer 1

6

I have solved the problem. It turns out I just didn't have enough locales installed on my system.

apt-get install locales-all

Solved my problem. For some reason dpkg-reconfigure locales didn't work for me.

There is a follow-up question to this problem, since I was scratching my head why the above command didn't work: Locales were not being generated by dpkg-reconfigure locales

4
  • The SE system is set up for a pairing of Questions with Answers. I'd recommend that you focus this Answer on the resolution to this Question and post any follow-up questions as separate Question(s). Thank you!
    – Jeff Schaller
    Commented Apr 3, 2022 at 13:33
  • 1
    Sure. I will edit that post and post my question once again.
    – tetektoza
    Commented Apr 3, 2022 at 13:37
  • 1
    @JeffSchaller Should/Can I also post a link here in that answer to my next question? Like just by editing that answer. Would that be recommended?
    – tetektoza
    Commented Apr 3, 2022 at 13:39
  • The general recommendation is to mention this previous question in the next question, to give any additional context for that new question. Thanks!
    – Jeff Schaller
    Commented Apr 3, 2022 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .