Command ansible-galaxy error during kickstart


I’am trying on my %post to run ansible-galaxy but find it hard as it will drop this error:

/mnt/sysimage/bin/ansible-galaxy: /usr/bin/python3.9: bad interpreter: No such file or directory

On my package part have added python3 and this is appearing under


my guess for this error is that ansible-galaxy is looking for python and not finding it under /usr/bin

Don’t really know best solution for this. Came up with link the one from /mnt to /usr and solve this with by changing the interpreter… So i have now this:

%post --nochroot --interpreter=/mnt/sysimage/bin/python3.9 --log=/root/ansible-post.log

But it comes out now with another error:

/mnt/sysimage/bin/python3.9 error while loading shared libraries: cannot open shared object file: No such file or directory

Any solution for this?

1 Like

try to add

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

before running ansible-galaxy collection install [xxx] command.

1 Like

I think this has to do with this Anaconda version during OS install - Rocky Linux General - Rocky Linux Forum

Like I wrote in that other thread, the ansible* should probably run within the chroot, in the “installed system”. That way it sees the libraries that were installed from dependent packages, and the files written go to the installed system, not to the “/” of the install environment.

If you have input files in the install media, then copy them first, before chrooting. (If you have custom image, then you could have the input files as a RPM package that is installed with the rest.)

Note also that EPEL has package ansible that provides some Ansible collections (and some more in ansible-* packages). That way you may be able to install required collections without running ansible-galaxy at all.