2

UPDATE

I found the problem. I need to relog after setting the language variables. But what I'm wondering is: How would I relog inside a vagrant script? Is this even possible?

Introduction

I've read about this problem already on other threads

locale not found/setting locale failed - what should I do?

but it didn't help me really. The accepted answer asked if the line with the desired language is uncommented in /etc/locale.gen which it is in my case, but it still doesn't work.

What I'm trying to achieve
I'm building a Vagrant box with debian/jessie64 which should automatically set the language variables to German. I have locale.gen file in my vagrant folder which should replace the default one in /etc/locale.gen with this command

sudo cp /var/www/project/www/vagrant_ressources/locale.gen /etc/

These are the contents of locale.gen

de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
de_DE@euro ISO-8859-15
en_US.UTF-8 UTF-8

Afterwards I'm regenerating the locals with sudo locale-gen. This is the output

Generating locales (this might take a while)...
  de_DE.ISO-8859-1... done
  de_DE.UTF-8... done
  de_DE.ISO-8859-15@euro... done
Generation complete.

Now I'm trying to install a package sudo apt-get install -y php7.0-fpm and am getting the warning

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "de_DE.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_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Why does de_DE.UTF-8 come up there? I also want to do this without using dpkg-reconfigure because this is a script which should do everything without user input. And dpkg-reconfigure simply creates the locale.gen file, nothing more, right?

Also, when using sudo dpkg-reconfigure locales the entries from my own locale.gen file are already selected. So it seems like part of this works.

When typing in locale -a these are the results

C
C.UTF-8
de_DE
de_DE@euro
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
deutsch
german
POSIX

1 Answer 1

2

At the moment you seem to have changed LC_CTYPE but not LANG

Make sure you updated /etc/default/locale correctly. Then you could just source /etc/default/locale after running locale-gen.

You must log in to answer this question.

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