Weird bug with locale

172 views
Skip to first unread message

Andrew Pashkin

unread,
May 2, 2014, 2:42:38 PM5/2/14
to ansible...@googlegroups.com
I'm trying to set up provisioning for Vagrant VM with Ansible, but constantly get an error:
locale: Cannot set LC_ALL to default locale: No such file or directory
Here is the full output.

I've tried to place this task in pre_tasks:
- name: set up locale
  apt: pkg=language-pack-en
And also tried to put this in task that fails:
environment:
    LC_ALL: "en_US.UTF-8"
But it didnt helped.
Does anybody saw an error like that, and found solutions? Kindly help.



  


-- 
С наилучшими пожеланиями, Андрей Пашкин.
м.т - +7 (985) 898 57 59
Skype - waves_in_fluids
e-mail - andrew....@gmx.co.uk

James Cammarata

unread,
May 2, 2014, 2:55:14 PM5/2/14
to ansible...@googlegroups.com
Just yesterday we merged in a slight change in the way that we're setting the localization environment and other environment variables. What version are you running to produce the above output?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5363E71E.40908%40gmx.co.uk.
For more options, visit https://groups.google.com/d/optout.

Andrew Pashkin

unread,
May 2, 2014, 3:11:35 PM5/2/14
to ansible...@googlegroups.com

On 02.05.2014 22:55, James Cammarata wrote:
Just yesterday we merged in a slight change in the way that we're setting the localization environment and other environment variables. What version are you running to produce the above output?

I use 1.5.4.  I thought that this is the issue with Ubuntu (I use image from Canonical) or with Vagrant. Because there is a lot of topics on the internet about such errrors, but all of them in general solved with setting up LC_ALL and re-generation of locales - doesnt work in my case.  Is there some workarounds with version 1.5.4 for this? Or maybe you can describe what actually cause the error, because I'm totally can't get why it happens.

Also I do some debugging right now - check the part of my playbook - I've discovered, that if first task is commented - error does not being throwed.

James Cammarata

unread,
May 2, 2014, 3:24:50 PM5/2/14
to ansible...@googlegroups.com
Previously in 1.5.x we set LANG=C specifically to ensure a consistent shell environment. This does create problems for Unicode however, so recently we modified the way it works. In your case, you should set 'module_lang = en_RU.UTF-8' (or en_US.UTF-8 if you wish) in your ansible.cfg under the "[defaults]" section. That value will then be used instead of "C".


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Andrew Pashkin

unread,
May 2, 2014, 3:35:25 PM5/2/14
to ansible...@googlegroups.com

On 02.05.2014 23:24, James Cammarata wrote:
> Previously in 1.5.x we set LANG=C specifically to ensure a consistent
> shell environment. This does create problems for Unicode however, so
> recently we modified the way it works. In your case, you should set
> 'module_lang = en_RU.UTF-8' (or en_US.UTF-8 if you wish) in your
> ansible.cfg under the "[defaults]" section. That value will then be
> used instead of "C".
If I want to override this variable only for that project or playbook
and keep everything else with default values, what is the cleanest way
to do that?
Docs says that:
> Settings in files are not merged together.
So, I need to copy all stuff from /etc/ansible/ansible.cfg to
myproj/ansible.cfg and tweak needed values?

There line in ansible.cfg:
> nearly all parameters can be overridden in ansible-playbook
Does it mean, that I can just put module_lang setting in a playbook?

Andrew Pashkin

unread,
May 4, 2014, 4:27:20 AM5/4/14
to ansible...@googlegroups.com
False alert! I didnt noticed error messages "cannot allocate memory" in
the middle of output. I've just increased VMs memory and everything
became OK.

Andrew Pashkin

unread,
May 22, 2014, 7:22:30 AM5/22/14
to ansible...@googlegroups.com
By the way, I was found that locale can be fixed with this:

- name: set up locale
shell: echo "echo $'LANGUAGE=en_US.UTF-8\n' >
/etc/default/locale" | sudo -s;
echo "echo $'LANG=en_US.UTF-8\n' >> /etc/default/locale" |
sudo -s;
echo "echo $'LC_ALL=en_US.UTF-8\n' >> /etc/default/locale"
| sudo -s;
echo "echo $'LC_MESSAGES=POSIX\n' >> /etc/default/locale"
| sudo -s;
locale-gen en_US.UTF-8;
dpkg-reconfigure locales;
touch /etc/locale_configured;
creates=/etc/locale_configured

Works on Ubuntu 12.04
With kind regards, Andrew Pashkin.
cell phone - +7 (985) 898 57 59

Michael DeHaan

unread,
May 23, 2014, 8:20:21 AM5/23/14
to ansible...@googlegroups.com
FWIW, if you have something like that again, the 'script' module makes for cleaner playbooks.

It just pushes and runs a remote script.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/537DDDF6.7060506%40gmx.co.uk.
Reply all
Reply to author
Forward
0 new messages