3

I'm writing a script that downloads various releases using 'debootstrap' and installs some necessary packages on it (including locales), then packages it for use in another script.

I get the following error when running the command inside the chroot:

# locale-gen en_US.UTF-8;update-locale LANG=en_US.UTF-8
Generating locales (this might take a while)...
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        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
*** update-locale: Error: invalid locale settings:  LANG=en_US.UTF-8

When I run "export LANG='en_US.UTF-8'" it reports no errors, but it does not fix any issues.

So the question is, how can I fix these locales errors?

PS: I can post part of the script source if it would help.

1 Answer 1

6

I'm afraid that you are calling locale-gen wrong -- locale-gen does not take locales as parameters. You need to specify all locales for your system in /etc/locale.gen, the call locale-gen once to generate them all for you.

EDIT: The /etc/locale.gen was the file I set when using Debian. I'm using Ubuntu now, and the configuration file is /var/lib/locales/supported.d/local. Check your locale-gen man page to make sure.

8
  • So would something like cat "en_US.UTF-8 UTF-8" > /etc/locale.gen or to the Ubuntu path, then running locale-gen, make sense to do?
    – ionFish
    May 27, 2013 at 14:36
  • Yep, that should do it. What do you get? Check your locale-gen man page to make sure as well.
    – xpt
    May 27, 2013 at 18:18
  • @ionFish, it should read echo "en_US.UTF-8 UTF-8" > /etc/locale.gen.
    – xpt
    May 27, 2013 at 18:19
  • I get the following error still while installing software to the system: fpaste.org/14822/83369136/raw . Any suggestions? Thanks.
    – ionFish
    May 27, 2013 at 19:36
  • That doesn't help. Need to see the log of exactly what locale-gen said.
    – xpt
    May 27, 2013 at 22:36

You must log in to answer this question.

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