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

Locale are not available #1405

Open
pratikbin opened this issue Aug 26, 2021 · 5 comments
Open

Locale are not available #1405

pratikbin opened this issue Aug 26, 2021 · 5 comments

Comments

@pratikbin
Copy link

pratikbin commented Aug 26, 2021

Trying to install foreman with ansible

ansible-playbook --become --become-method=sudo -i hosts playbooks/foreman.yml -e foreman_repositories_version=3.0 --diff -vv

getting error The locale you've entered is not available on your system

TASK [foreman_installer : Ensure en_US.UTF-8 locale is available] *************************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:7
ok: [10.10.0.5] => changed=false 
  msg: OK
  name: en_US.UTF-8
 [started TASK: foreman_installer : Print the gateway for each host when defined on 10.10.0.5]

TASK [foreman_installer : Print the gateway for each host when defined] *******************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:11
ok: [10.10.0.5] => 
  msg:
  - en_US.utf8
  - C
 [started TASK: foreman_installer : Ensure ENV locales are available on 10.10.0.5]
redirecting (type: modules) ansible.builtin.locale_gen to community.general.locale_gen
[WARNING]: sftp transfer mechanism failed on [10.10.0.5]. Use ANSIBLE_DEBUG=1 to see detailed information

TASK [foreman_installer : Ensure ENV locales are available] *******************************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:15
failed: [10.10.0.5] (item=en_US.utf8) => changed=false 
  ansible_loop_var: item
  item: en_US.utf8
  msg: The locale you've entered is not available on your system.
redirecting (type: modules) ansible.builtin.locale_gen to community.general.locale_gen
failed: [10.10.0.5] (item=C) => changed=false 
  ansible_loop_var: item
  item: C
  msg: The locale you've entered is not available on your system.

added one job Print query before Ensure ENV locales are available to render and print the query thing

- name: 'Print query'
ansible.builtin.debug:
msg: "{{ 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 }}"
- 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 }}"

list of locales with diffrent commands

root@foreman:/home/administrator# localectl status
   System Locale: LANG=en_US.UTF-8
                  LANGUAGE=en_US
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105
root@foreman:/home/administrator# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
root@foreman:/home/administrator# localectl list-locales
C.UTF-8
en_US.UTF-8
@ekohl
Copy link
Member

ekohl commented Aug 26, 2021

What is the target OS? What I think is happening is that on the host OS the locale is resolved to C and the target OS doesn't understand C (but does C.UTF-8). That sounds like the target OS is EL8 or something else more modern.

@pratikbin
Copy link
Author

pratikbin commented Aug 27, 2021

What is the target OS?

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

@ekohl
Copy link
Member

ekohl commented Aug 27, 2021

And your host OS? What's your environment on that?

@pratikbin
Copy link
Author

pratikbin commented Aug 27, 2021

This is the host OS

wait, you mean, from where I'm running playbook?. ahh. checking...
it worked
it's checking in localhost which is my machine from where I'm running ansible,
I set/unset

export LC_COLLATE=
export LANG=

but why checking in localhost?

@ekohl
Copy link
Member

ekohl commented Aug 30, 2021

The idea is that these local env vars are also exported to the remote host. This ensures the local locale is also available on the remote host. However, your local locale ends up being C and that's weird. Modern distributions are moving to C.UTF-8 only. I'd recommend setting the locale to something that does resolve.

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

No branches or pull requests

2 participants