Description of problem: I have LANG="en_CA.UTF-8" in /etc/sysconfig/i18n. On a system startup I am greeted, immediately when an init sequence starts, with the following: Switching to new root and running init. /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change loc ale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 20: warning: setlocale: LC_COLLATE: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 23: warning: setlocale: LC_MESSAGES: cannot change locale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 26: warning: setlocale: LC_NUMERIC: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 29: warning: setlocale: LC_TIME: cannot change loca le (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change loc ale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 20: warning: setlocale: LC_COLLATE: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 23: warning: setlocale: LC_MESSAGES: cannot change locale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 26: warning: setlocale: LC_NUMERIC: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 29: warning: setlocale: LC_TIME: cannot change loca le (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change loc ale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 20: warning: setlocale: LC_COLLATE: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 23: warning: setlocale: LC_MESSAGES: cannot change locale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 26: warning: setlocale: LC_NUMERIC: cannot change l ocale (en_CA.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 29: warning: setlocale: LC_TIME: cannot change loca le (en_CA.UTF-8): No such file or directory Interestingly enough when some tracing is done one can see things like that: .... +++ unset LC_IDENTIFICATION +++ '[' -n '' ']' +++ unset LC_MEASUREMENT +++ '[' -n '' ']' /etc/profile.d/lang.sh: line 26: warning: setlocale: LC_CTYPE: cannot change loc ale (en_CA.UTF-8): No such file or directory +++ '[' -n '' ']' +++ unset LC_COLLATE /etc/profile.d/lang.sh: line 27: warning: setlocale: LC_COLLATE: cannot change l ocale (en_CA.UTF-8): No such file or directory +++ '[' -n '' ']' +++ unset LC_IDENTIFICATION +++ '[' -n '' ']' +++ unset LC_MEASUREMENT +++ '[' -n '' ']' +++ unset LC_MESSAGES /etc/profile.d/lang.sh: line 30: warning: setlocale: LC_MESSAGES: cannot change locale (en_CA.UTF-8): No such file or directory .... In other words some 'unset' statements are fine but not others. No idea why. If I am trying to repeat the above from a running system, with an appropriate setting and unsetting variables involved - of course, then nothing happens. There are two ways to prevent the above. - One is to revert to bash-3. - The other is to wrap the whole content of /etc/profile.d/lang.sh in "if type -p locale >/dev/null; then ... ; endif". Only the later appears to be a bogus "solution" as renaming /usr/bin/locale to something else does not allow to reproduce from a running system all these "cannot change locale". Apparently this condition just delays attempts to really set LANG until all file systems are mounted. With "fixed" /etc/profile.d/lang.sh and modified to print values of PWD, HOME and LANG before anything else is done I see in a startup this: .... Enabling /etc/fstab swaps: [ OK ] running /etc/profile.d/lang.sh PWD / HOME LANG Entering non-interactive startup running /etc/profile.d/lang.sh PWD / HOME LANG en_CA.UTF-8 iptables: Applying firewall rules: [ OK ] .... So setting of LANG happens only then and no error messages like those above show up. Version-Release number of selected component (if applicable): initscripts-8.89-1 How reproducible: on every startup
I'm suspecting the base cause is that you have /usr/share as a separate file system, and it's doing this before /usr/share is mounted, so setlocale can't get to /usr/share/i18n/locales/en_U. Also, this looks like a dup of bug #482888
> Also, this looks like a dup of bug #482888 Yes, indeed, it does. Does this also mean that bash-3 was simply ignoring those errors and bash-4 is just loud? If this is indeed a matter of availability of /usr/share/locale then running the whole thing inside "if [ -d /usr/share/locale ]; then ...; fi" would help. 'lang.sh' is called all over the place in a startup sequence (which are really runs of /etc/profile). Just 'echo' something from it and see for yourself. It has even a code to prevent setting the same $LANG over and over.
No, *if* you get into /etc/profile.d/lang.sh, throwing those errors *is* proper. The *bug* here is that /etc/profile (and thence /etc/profile.d/*.sh) are being called for /etc/rc.sysinit - *EVEN THOUGH IT'S A SCRIPT AND NOT A LOGIN SHELL*. *THAT*'s what's broken here.
> *THAT*'s what's broken here. You mean that bash used in a startup runs as a login shell? I have no idea if this is by design or by an accident. Surely you need assorted settings, and that includes LANG, be in a proper state before anything of X starts but that should be doable in any case. Also if you want startup error messages "internationalized" (that happens now) then $LANG is required.
*** This bug has been marked as a duplicate of bug 482888 ***