Description of problem: When running fedora container by singularity, the warning "/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)" is outputted. This does not happen for docker (docker-ce) and podman. Version-Release number of selected component (if applicable): $ rpm -q singularity singularity-3.4.0-1.2.fc30.x86_64 (Latest version on Fedora 30) How reproducible: Steps to Reproduce: 1. $ singularity run docker://fedora echo "fedora" Actual results: $ singularity run docker://fedora echo "fedora" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) fedora Expected results: The warning is not outputted. Additional info: My local host environment Fedora 30 ``` $ env | grep LC_ALL LC_ALL=en_US.UTF-8 $ rpm -q glibc-langpack-en glibc-langpack-en-2.29-22.fc30.x86_64 ``` It only happens for fedora container. ``` $ singularity run docker://ubuntu echo "ubuntu" ubuntu $ singularity run docker://fedora echo "fedora" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) fedora $ singularity run docker://alpine echo "alpine" alpine ``` This warning does not happen for docker (docker-ce) and podman. I suppose that singularity has a unique logic for the locale comparing from docker and podman. ``` $ singularity run docker://fedora echo "fedora" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) fedora ``` ``` $ rpm -qf /usr/bin/docker moby-engine-18.06.3-2.ce.gitd7080c1.fc30.x86_64 $ docker run fedora echo "fedora" fedora ``` ``` $ rpm -q podman podman-1.5.1-3.fc30.x86_64 $ podman run fedora echo "fedora" fedora ```
I can reproduce the issue on el7 with the latest singularity in epel-testing and the following command $ rpm -q singularity singularity-3.4.1-1.1.el7.x86_64 $ LC_ALL=en_US.UTF-8 singularity run docker://fedora echo "fedora" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) fedora The reason is that unlike docker and presumably podman, by default singularity imports all environment variables. You can work around it by using the run --cleanenv or -e option. In addition apparently the fedora container does not by default support the en_US.UTF-8 locale. I can also reproduce by explicitly setting LC_ALL in docker: $ docker run fedora bash -c 'LC_ALL=en_US.UTF-8 echo fedora' bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory fedora Is that a sufficient answer for you?
Hi Dave. Yes, it's a sufficient answer! Thank you for checking it! I was able to suppress the warning with "--cleanenv" option. ``` $ singularity run --cleanenv docker://fedora echo "fedora" fedora ``` I was able to reproduce below warning too. ``` $ docker run fedora bash -c 'LC_ALL=en_US.UTF-8 echo fedora' fedora bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory ``` I would close this ticket. Thanks, again.