preseeded value of "locales/locales_to_be_generated"
Derek Poon
derekp+fai at ece.ubc.ca
Mon Jul 11 06:36:12 CEST 2016
Andy,
I was just investigating this issue a few days ago, and came to the conclusion that Ubuntu 16.04 ignores debconf when it comes to selecting locales. The /var/lib/dpkg/info/locales.config file was introduced between 14.04 and 16.04, and its presence causes /usr/share/debconf/frontend to ignore /var/lib/dpkg/info/locales.postinst, which used to do the debconf integration.
The /var/lib/dpkg/info/locales.config script, on the other hand, only reads its settings from /var/lib/locales/supported.d/local. I have therefore devised this hook to use debconf to write out /var/lib/locales/supported.d/local.
hooks/updatebase.UBUNTU
==========================================================================
# In Ubuntu 16.04 (but not 14.04), the locales configuration mechanism has
# changed. There is a /var/lib/dpkg/info/locales.config file, which
# overrides /var/lib/dpkg/info/locales.postinst and consults
# /var/lib/locales/supported.d/local instead of the debconf system. (See
# the code in /usr/share/debconf/frontend that prefers locales.config.) This
# hook applies the debconf setting. It must run after FAI's debconf task
# but before dpkg gets a chance to clobber debconf with an empty setting.
if [ ! -f "$target/var/lib/locales/supported.d/local" ]; then
$ROOTCMD debconf --owner=locales sh -c '
. /usr/share/debconf/confmodule
db_version 2.0
db_get locales/locales_to_be_generated &&
mkdir -p /var/lib/locales/supported.d &&
echo "$RET" > /var/lib/locales/supported.d/local' &&
$ROOTCMD dpkg-reconfigure locales
fi
==========================================================================
I consider it to be a workaround for a bug.
Derek Poon
University of British Columbia
> On Jul 10, 2016, at 19:39, andrew bezella <abezella at archive.org> wrote:
>
> hi -
>
> i've been having some issues w/locales on a xenial system, installed
> from a jessie nfsroot with fai 5.1. my initial problem was that i'd not
> been including the 'language-pack-en' but it still doesn't seem to be
> working as expected.
>
> i'd logged https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1598326
> but at one point it appeared that might be a red herring.
> the locales excerpts from debconf.data ([2]) are:
> locales locales/default_environment_locale select None
> locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
>
> it's unclear to me why the run of `/var/lib/dpkg/info/locales.config
> reconfigure 2.23-0ubuntu3` behaves as it does. beyond the above
> "Substitution failed" error, while looking at the debug output i noticed
> other confusing bits. e.g., after finding $target/etc/locale.gen empty,
> the locales.config script (via GEN_LOCALES and SELECTED_LOCALES
> variables) appears to *un*set locales/locales_to_be_generated:
> + SELECTED_LOCALES=
> + db_set locales/locales_to_be_generated
> + _db_cmd SET locales/locales_to_be_generated
> + _db_internal_IFS=
>
> + IFS=
> + printf %s\n SET locales/locales_to_be_generated
> + IFS=
>
> + IFS=
> read -r _db_internal_line
> debconf (developer): <-- SET locales/locales_to_be_generated
> debconf (developer): --> 0 value set
> + RET=value set
> + return 0
>
> similarly, it seems that the script tries to substitute the
> DEFAULT_LOCALES that it finds (from on-disk files) into
> locales/default_environment_locale (cf. the debconf error above) without
> regard to its existing value.
>
> while investigating i did also find this unexpected bit during fai's
> debconf task (full logs[1]):
> read -r _db_internal_line
> debconf (developer): <-- SUBST locales/default_environment_locale locales en_US.UTF-8
> debconf (developer): --> 100 Substitution failed
> + RET=100 Substitution failed
> + return 100
>
> but i'm guessing some of my confusion there may have to do with:
> DEBCONF_DB_OVERRIDE="File{$tmpdb readonly:true}"
> and its interaction with `dpkg-reconfigure`
>
> because despite all the above, the resultant system ends up with the
> desired debconf settings:
> locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
> locales locales/default_environment_locale select None
>
> *however*, the on-disk /etc/locale.gen only has commented lines and
> while /etc/default/locale is empty when i set "None", it is also empty
> when i set locales/default_environment_locale to en_US.UTF-8 via fai's
> debconf.
>
> then there's a bit that leads me back to that bug. on the live system,
> attempting to noninteractively reconfigure locales again *un*sets
> locales/locales_to_be_generated (full output [3]):
> ~# debconf-show locales
> * locales/locales_to_be_generated: en_US.UTF-8 UTF-8
> * locales/default_environment_locale: en_US.UTF-8
> ~# egrep -v ^\# /etc/locale.gen
> [intentionally blank lines]
>
> ~# cat /etc/default/locale
> # File generated by update-locale
> ~# DEBIAN_FRONTEND=noninteractive /usr/sbin/dpkg-reconfigure locales
> Generating locales (this might take a while)...
> en_AG.UTF-8... done
> en_AU.UTF-8... done
> en_BW.UTF-8... done
> en_CA.UTF-8... done
> en_DK.UTF-8... done
> en_GB.UTF-8... done
> en_HK.UTF-8... done
> en_IE.UTF-8... done
> en_IN.UTF-8... done
> en_NG.UTF-8... done
> en_NZ.UTF-8... done
> en_PH.UTF-8... done
> en_SG.UTF-8... done
> en_US.UTF-8... done
> en_ZA.UTF-8... done
> en_ZM.UTF-8... done
> en_ZW.UTF-8... done
> Generation complete.
> ~# debconf-show locales
> * locales/locales_to_be_generated:
> * locales/default_environment_locale: en_US.UTF-8
> ~# egrep -v ^\# /etc/locale.gen
>
>
> ~# cat /etc/default/locale
> # File generated by update-locale
> LANG=en_US.UTF-8
>
> so at this point i believe i'm back to it being a bug of some sort in
> locales's dpkg wrappings. notably, when `/usr/sbin/dpkg-reconfigure
> locales` is run *interactively* in place of the noninteractive call,
> "en_US.UTF-8 UTF-8" is *not* preselected; selecting it and completing
> the reconfigure results in what i would expect (full output [4]):
> ~# debconf-show locales
> * locales/locales_to_be_generated: en_US.UTF-8 UTF-8
> * locales/default_environment_locale: en_US.UTF-8
> ~# egrep -v ^\# /etc/locale.gen
>
>
> ~# cat /etc/default/locale
> # File generated by update-locale
> ~# /usr/sbin/dpkg-reconfigure locales
> Generating locales (this might take a while)...
> en_AG.UTF-8... done
> en_AU.UTF-8... done
> en_BW.UTF-8... done
> en_CA.UTF-8... done
> en_DK.UTF-8... done
> en_GB.UTF-8... done
> en_HK.UTF-8... done
> en_IE.UTF-8... done
> en_IN.UTF-8... done
> en_NG.UTF-8... done
> en_NZ.UTF-8... done
> en_PH.UTF-8... done
> en_SG.UTF-8... done
> en_US.UTF-8... done
> en_ZA.UTF-8... done
> en_ZM.UTF-8... done
> en_ZW.UTF-8... done
> Generation complete.
> ~# debconf-show locales
> * locales/default_environment_locale: en_US.UTF-8
> * locales/locales_to_be_generated: en_US.UTF-8 UTF-8
> ~# egrep -v ^\# /etc/locale.gen
>
>
> en_US.UTF-8 UTF-8
> ~# cat /etc/default/locale
> # File generated by update-locale
> LANG=en_US.UTF-8
>
> if anyone has feedback/advice/thoughts, please lmk. otherwise i think
> i'll be adding this to that bug report.
>
> tia!
>
> andy
>
> 1 https://www.us.archive.org/~abezella/tmp/fai-debconf+debug.log
> 2 https://catalogd.archive.org/~abezella/tmp/debconf.data.txt
> 3 https://catalogd.archive.org/~abezella/tmp/noninteractive-dpkg-reconfigure+debug.log
> 4 https://catalogd.archive.org/~abezella/tmp/interactive-dpkg-reconfigure+debug.log
>
> --
> andrew bezella <abezella at archive.org>
> Internet Archive
>
More information about the linux-fai
mailing list