Open ikke-t opened 2 years ago
since it's about unicode, here's my locale:
▶ ssh root@10.128.1.10
The authenticity of host '10.128.1.10 (10.128.1.10)' can't be established.
ECDSA key fingerprint is SHA256:V6Nnz8fIlTndlb5dleV0R+UVZJS5rhrZXgnFdrZ4XOM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.128.1.10' (ECDSA) to the list of known hosts.
Last login: Fri Dec 31 10:45:56 2021 from 10.254.253.2
[root@rh-idm-01 ~]# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=fi_FI.UTF-8
LC_TIME=fi_FI.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=fi_FI.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=fi_FI.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=fi_FI.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
I tried also with: LC_ALL=en_US.UTF-8 ansible-playbook ...
no difference
ansible 2.9.27
doing the same install manually works perfectly:
ipa-server-install \
--domain cool.lab \
--realm COOL.LAB \
--ds-password bar \
--admin-password foo \
--unattended \
--setup-dns \
--forwarder 10.1.102.5 \
--auto-reverse
It looks like this is triggered by a systemd tool's warning which contains UTF-8 but non-ASCII characters (an arrow) which is then cannot be parsed by Python. Three possible solutions:
I think a longer term solution would be for both (1) and (3). We do expect UTF-8 locale to be present and working on the system in IPA.
I try with:
- name: gen eu_US locale
locale_gen:
name: en_US
state: present
- name: set as default locale
command: localectl set-locale LANG=en_US LC_ALL=en_US
the locale_gen module doesn't seem to work on rhel
How should the locales be set in freeipa?
I try now with localectl set-locale LANG=C
no help
The kickstart config for rhel is here https://github.com/ikke-t/ansible-packer/blob/master/templates/cfg-rhel_8.j2
And the ipa install adding to that is here: https://github.com/RedHatNordicsSA/cool-lab/blob/main/setup-idm.yml
There is a locale error:
[root@rh-idm-01 ~]# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
Have you modified the system after doing the kickstart installation? In the kickstart file there is lang en_US.UTF-8
, but in your locale
output there is LC_NUMERIC=fi_FI.UTF-8
for example.
What system are you using for the controller?
Do you have glibc-langpack-fi
installed on rh-idm-01? Is the locale command and the role working if you install this package?
Those fi things come from my laptop where I run the ansibles from. I've also tried with
LC_ALL=C ansible-playbook -u root -e "subs_username=$subs_username subs_pw=$subs_pw" setup-idm.yml -vvv --skip-tags replica,subs
to avoid my laptop settings taking effect. I'll try also with installing the finnish locales.
Now I took another look at it. The warning comes from the fact this file has lines that produce warning into log:
[root@rh-idm-01 ~]# cat /etc/tmpfiles.d/dirsrv-COOL-LAB.conf
d /var/run/dirsrv 0770 dirsrv dirsrv
d /var/lock/dirsrv/ 0770 dirsrv dirsrv
d /var/lock/dirsrv/slapd-COOL-LAB 0770 dirsrv dirsrv
In the ansible warning:
[WARNING]: Module invocation had junk after the JSON data: File "/usr/lib/python3.6/site-packages/ipapython/ipautil.py", line 579, in run logger.debug('stderr=%s', error_log) Message: 'stderr=%s' Arguments:
('[/etc/tmpfiles.d/dirsrv-COOL-LAB.conf:1] Line references path below legacy directory /var/run/, updating /var/run/dirsrv ��� /run/dirsrv; please update the tmpfiles.d/ drop-in file accordingly.\n',) Applying LDAP updates
So I believe the possible arrow there, like pointed out by @abbra then breaks the reading of json. Now the fix would be to generate the file so it won't cause a warning, as instructed in the warning.
Of course the ansible should not fail reading the log also. but as a quick fix the file syntax should be correct.
So this package: 389-ds-base-1.4.3.23-12.module+el8.5.0+13329+4096c77a.x86_64 has a file: /usr/share/dirsrv/inf/defaults.inf which sets the run dir:
/usr/share/dirsrv/inf/defaults.inf:run_dir = /var/run/dirsrv
/usr/share/dirsrv/inf/defaults.inf:pid_file = /var/run/dirsrv/slapd-{instance_name}.pid
at least that place. I don't know exactly where that install line comes from, but it's using legacy path.
question is, who generates this file: /etc/tmpfiles.d/dirsrv-COOL-LAB.conf, and how can the path inside it be fixed? It should point to /run/, instead of /var/run
I think changing the /var/run from everywhere is slightly more work, as it seems to be even in selinux targets.
@t-woerner you are right. The package glibc-langpack-fi fixes it. I wonder why when i had the LC_ALL in the command line....
@t-woerner for ansible-freeipa plugins we are forcing os.environ["LANGUAGE"] = "C"
, should it be also done to roles?
Hmmmm, seems to be all my fault. I recalled LC_ALL sets all locales, but it won't. This gets rid of the local finnish locales I have:
LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 ansible-playbook -i hosts -u root -e "subs_username=$subs_username subs_pw=$subs_pw" setup-idm.yml
So the problem at the end was that Ansible carries my laptops locales to remote system, which somehow leads to error, as the target machine doesn't have the Finnish locales. So setting up the LC_ALL and LANG to en_US.UTF-8 will get rid of all this problem.
@ikke-t that's the reason for my question. To fix it on ansible-freeipa side, we might need to force the locale on the roles.
Funny, actually in the previous I had a typo. I had LANG set incorrectly to en_US.UFT-8, then it worked. So this is the way to get it working:
LC_ALL=en_US.UTF-8 LANG=C ansible-playbook -i hosts -u root -e "subs_username=$subs_username subs_pw=$subs_pw" setup-idm.yml
LC_ALL indeed should override all the other locale settings but setting LANGUAGE should only affect the messages displayed by programs. See locale
(7) for details. Since source code mentions "ansible-freeipa requires locale to be C, IPA requires utf-8", not sure would using C.UTF-8 on recent distributions be of any help.
I have tried to install freeipa several times on rhel8.5, both with the roles coming from ansible-freeipa-0.3.8-1.el8.noarch or upstram collections version 1.5.3. I can not get it to work.
My variables:
passwords are in vault
end of ansible log: