preseeded value of "locales/locales_to_be_generated" lost on `locales.postinst configure` action

Asked by andrew bezella

in attempting to track down why locales are unset, i noticed this issue (perhaps related to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134). running `/var/lib/dpkg/info/locales.postinst configure` appears to unset the seeded value of locales/locales_to_be_generated, but only if that value was set via noninteractive means.

to reproduce (1):
# debconf-set-selections /tmp/locales.debconf (2)

# debconf-show locales
* locales/default_environment_locale: en_US.UTF-8
* locales/locales_to_be_generated: en_US.UTF-8 UTF-8

# /var/lib/dpkg/info/locales.postinst configure
Generating locales (this might take a while)...
Generation complete.

# debconf-show locales
* locales/locales_to_be_generated:
* locales/default_environment_locale: en_US.UTF-8

# cat /etc/default/locale
# File generated by update-locale

# grep -v ^\# /etc/locale.gen
[empty and locale errs continue]

on the other hand, setting the same value via an interactive `dpkg-reconfigure locales` works:
# debconf-show locales
* locales/default_environment_locale: en_US.UTF-8
* locales/locales_to_be_generated: en_US.UTF-8 UTF-8

# dpkg-reconfigure locales (nb. en_US.UTF-8 UTF-8 is NOT pre-selected, but once manually selected and dpkg-reconfigure has finished the locales errors are gone)
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

# grep -v ^\# /etc/locale.gen

en_US.UTF-8 UTF-8

# cat /etc/default/locale
# File generated by update-locale
LANG=en_US.UTF-8

when i watch the postinst script it can be seen in an unsuccessful run that `db_get locales/locales_to_be_generated` (line 19) gives an empty RET value:
+ db_get locales/locales_to_be_generated
+ _db_cmd GET locales/locales_to_be_generated
+ _db_internal_IFS=

+ IFS=
+ printf %s\n GET locales/locales_to_be_generated
+ IFS=

+ IFS=
 read -r _db_internal_line
+ RET=
+ return 0
+ SELECTED_LOCALES=
+ echo
+ sed -e s/, /\n/g
+ SELECTED_LOCALES=

the immediately prior `db_get locales/default_environment_locale` (line 18) gives RET=en_US.UTF-8 as expected.

when locales/locales_to_be_generated has been set interactively, RET=en_US.UTF-8 UTF-8, also as expected.

setting the value via ansible's debconf module also results in failure.

than you for your time and effort in supporting ubuntu.

    andy

1) as the locales are not configured at this point, most debconf commands result in an additional error of:
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").
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_ALL to default locale: No such file or directory

i have left these out of this description but included them in the full output attachment

2) see attached, generated via `debconf-get-selections` on another host

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: locales 2.23-0ubuntu3
ProcVersionSignature: Ubuntu 4.4.0-24.43-generic 4.4.10
Uname: Linux 4.4.0-24-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
Date: Sat Jul 2 00:08:05 2016
PackageArchitecture: all
ProcEnviron:
 TERM=rxvt-unicode-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: glibc
UpgradeStatus: No upgrade log present (probably fresh install)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu glibc Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
andrew bezella (abezella) said :
#1

i'm much less clear on this now than i was yesterday. continuing to investigate.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

You have a bug, you don't need a question as well

Can you help with this problem?

Provide an answer of your own, or ask andrew bezella for more information if necessary.

To post a message you must log in.