====== Fixing a locale-archive breakage ====== If you are greeted with the following errors when trying to use <color orangered>perl</color>: <code console> $ perl -e '' perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). </code> Or when using <color orangered>yum</color>: <code console> $ yum help >/dev/null Failed to set locale, defaulting to C </code> Or using any <color navy>GTK</color> application: <code console> $ gedit (process:24839): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. </code> Or having your scripts failing in strange and unexpected ways: <code console> /etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (fr_FR.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 20: warning: setlocale: LC_COLLATE: cannot change locale (fr_FR.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 23: warning: setlocale: LC_MESSAGES: cannot change locale (fr_FR.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 26: warning: setlocale: LC_NUMERIC: cannot change locale (fr_FR.UTF-8): No such file or directory /etc/profile.d/lang.sh: line 29: warning: setlocale: LC_TIME: cannot change locale (fr_FR.UTF-8): No such file or directory </code> Then you have a <color purple>locale</color> problem. Here's the command to list all the locales available on your system: <code console> $ locale -a locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_COLLATE to default locale: No such file or directory C POSIX </code> <color navy>C</color> and <color navy>POSIX</color> are the two default locales, always supported when everything else is broken. Here, obviously, something is wrong. I'm experiencing a //locale-archive breakage//. The file <color green>/usr/lib/locale/locale-archive</color> is used by the apps to know which locales are supported on your system. If this database is broken, then you'll have lots of warnings in all your programs, and they'll always fallback to the C/POSIX locale (english, and plain us-ascii). To rebuild this database under Fedora, just issue the following command as root : <code console> # /usr/sbin/build-locale-archive </code> When the command is completed, you can check it works, issuing a <color orangered>''locale -a''</color> at the prompt, you should now have a fairly complete list, way more than C and POSIX alone. However, if the build-locale-archive command failed: <code console> # build-locale-archive build-locale-archive: cannot open locale archive template file "/usr/lib/locale/locale-archive.tmpl": No such file or directory </code> Then your problem is more serious: you probably have a damaged <color orangered>glibc-common</color> rpm. You should probably reinstall it: <code console> # yum reinstall glibc-common </code> And then try to rebuild the database. For completeness sake, I should add that you might just want to <color orangered>touch</color> the missing file, as it's of size zero on my setup: <code console> # touch /usr/lib/locale/locale-archive.tmpl </code> But reinstalling the rpm is really a better thing to do. Also, if this happened to you, you should check the integrity of all your rpms, maybe glibc-common is not the only rpm to have corrupted files: <code console> # rpm -Va </code>

 
blog/fixing_a_locale-archive_breakage.txt · Last modified: 28/04/2010 22:57 by speed47 · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki