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

Bug #1598326 reported by andrew bezella on 2016-07-02
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
High
Unassigned

Bug Description

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)

andrew bezella (abezella) wrote :
andrew bezella (abezella) wrote :

full output

andrew bezella (abezella) wrote :

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

Changed in glibc (Ubuntu):
status: New → Invalid
andrew bezella (abezella) wrote :

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.

attempting to noninteractively reconfigure locales *un*sets
locales/locales_to_be_generated (full output in
noninteractive-dpkg-reconfigure+debug.log):
~# 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

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 in
interactive-dpkg-reconfigure+debug.log):
~# 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

it's unclear to me why the run of `/var/lib/dpkg/info/locales.config
reconfigure 2.23-0ubuntu3` behaves as it does, but something appears
awry. after finding /etc/locale.gen empty, the locales.config script
(via GEN_LOCALES and SELECTED_LOCALES variables) appears to *un*set
locales/locales_to_be_generated. 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.

tia!

andy

--
andrew bezella <email address hidden>
Internet Archive

Changed in glibc (Ubuntu):
status: Invalid → New
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glibc (Ubuntu):
status: New → Confirmed
Changed in glibc (Ubuntu):
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers