Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ansible-error: unsupported locale setting #1715

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-bucher
Copy link
Contributor

Fixes the following error on Debian12 bookworm with locale de_DE.UTF-8.
Not fully sure, which aspect is to blame 😇

==> centos8-katello-devel: Running provisioner: disk_resize (ansible)...
Vagrant gathered an unknown Ansible version:


and falls back on the compatibility mode '1.8'.

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    centos8-katello-devel: Running ansible-playbook...
ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

@ekohl
Copy link
Member

ekohl commented Oct 26, 2023

Not fully sure, which aspect is to blame 😇

You probably have de_DE.UTF-8 configured on your host and the Debian 12 image doesn't have that locale. We also have code that ensures the locale should be available, but it's written in Ansible ...

- name: 'Ensure ENV locales are available'
locale_gen:
name: "{{ item }}"
loop: "{{ query('env', 'LANG', 'LC_ADDRESS', 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_IDENTIFICATION', 'LC_MEASUREMENT', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NAME', 'LC_NUMERIC', 'LC_PAPER', 'LC_TELEPHONE', 'LC_TIME') | unique | select() | list }}"

@m-bucher
Copy link
Contributor Author

@ekohl so I guess locale_gen should be the first provisioning-task we do on the new machine?

@ekohl
Copy link
Member

ekohl commented Oct 27, 2023

Yes, I think it would make sense to extract it to its own role and run it as the very first step. That is, if you can even do that. Not sure where it happens.

Vagrant gathered an unknown Ansible version:

and falls back on the compatibility mode '1.8'.

Perhaps this is actually the root cause. Looking at the source, this is how it attempts to detect it:
https://github.com/hashicorp/vagrant/blob/f33ac0bc98bdbcb421331d62fba42ba39d1aff85/plugins/provisioners/ansible/provisioner/host.rb#L113-L136

Perhaps this fails in your setup?

@m-bucher
Copy link
Contributor Author

I think I understand now:
My system has:

$ locale -a
C
C.utf8
de_DE.utf8
POSIX

forklift's Vagrantfile sets en_US.UTF-8 here.

So either I have to do locale-gen en_US.UTF-8 on my system or locale-gen de_DE.utf8 on the guest-system.
From a user's perspective I'd say do the latter.

@ekohl
Copy link
Member

ekohl commented Oct 27, 2023

But how do you have Ansible installed?

@m-bucher
Copy link
Contributor Author

But how do you have Ansible installed?

https://packages.debian.org/bookworm/ansible-core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants