This thread is a continuation of an earlier thread
which had an inappropriate title
How can the locale be set for processes started by boot scripts? For processes which are descendents of login shells, locale is set by /etc/profile.d/lang.*sh in which envar $LANG is set. For virtual terminals, locale is set by kernel parameter vt.default_utf8=1 (thanks Rupa). But how is it set for processes started by boot scripts which are direct descendents of the init process?
Looking around to find how it might be done, I discovered:
- There are no *locale* files under /etc.
- /etc/inittab has nothing about locale.
- man init has nothing about locale.
- man 7 locale describes locale.h and its usage.
- man 5 locale describes the format of locale files.
- /sbin/init (as investigated using the strings command) may call nl_langinfo but man nl_langinfo only describes how to query the locale, not where it is set.
- The envars set while running a boot script (as displayed by the env command) are:
I want to set the locale for Bacula. According to the Bacula Main Reference*, in the "13.1 Critical Items" section: "Bacula assumes all filenames are in UTF-8 format. This is important when saving the filenames to the catalog. ... you must explicitly ensure that your locale is set properly. Typically this means that the bf LANG environment variable must end in .UTF-8. An full example is en US.UTF-8. The exact syntax may vary a bit from OS to OS, and exactly how you define it will also vary.
It would be nice to set the locale for Bacula only but that would require front-ending a lot of executables and I'm not confident of being able to identify them all.
Presumably both the daemon processes and the processes initiated by a logged-on user should have the same locale. One solution would be to export LANG=<something>.utf8 in the Bacula boot scripts and use /etc/profile.d/lang.*sh for the logged-on users but I'm curious how it can be set for all processes.
EDIT: Bacula is configured to use MySQL so presumably that, too, should have LANG=<something>.utf8.
* Available as PDF or HTML at http://www.bacula.org/en/?page=documentation