How to resolve the error "/etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (C.UTF-8)" while running the Job from Ansible Automation Platform?
Environment
- Red Hat® Ansible Automation Platform 2.x
Issue
-
The Jobs running on the target servers from Ansible Automation Platfrom UI fails with an error:
/etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (C.UTF-8)
Resolution
-
Set the locale variables in the
execution-environment.ymlfile while building the custom execution environment:append_final: - RUN microdnf install -y glibc-langpack-en; sed -i 's/^LANG=.*/LANG="en_US.utf8"/' /etc/locale.conf; sed -i 's/^LC_ALL=.*/LC_ALL="en_US.utf8"/' /etc/locale.conf - ENV LANG=en_US.utf8 - ENV LC_CTYPE=en_US.utf8 - ENV LC_ALL=en_US.utf8 -
Follow the KCS article to create a new execution environment for Ansible Automation Platform.
Root Cause
- The reason for this error is "C.utf8" locale directory is not available on RHEL7 and below systems which results job templates to fail. Refer the KCS for more information.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments