automated installations (I forgot which number)

Today I wanted to play with serial console a bit, because it doesn't work like I want it to.
So I started VMWare and started installing debian with the installation CD.
To my surprise, the installation fubars.

It appears that the locales package panics when it tries to generate locale for the "en" locale. Which is normal because it doesn't exist.
I don't remember ever telling debian to use that locale ?

So I started tracking the problem. There is a file /etc/locale.gen which contains a list of locales to work with. This file is generated at installation time by the locales package. The input for that generation process comes from the languagechooser udeb(?) in the debian-installer.
This last one parser a file /usr/share/languagelist and extracts the entry for the "English" language, which is:

English;en;en_US@euro;en;US;en_US:en_GB:en;kbd=lat0-sun16(iso15)


The /usr/bin/languagemap then extracts the second value "en" from that list and that is used as the locale later on.

OK, I know the CD hasn't changed, but the locales package might have.

So what is actually erroring in there that didn't error before ?
The postinst script calls /usr/bin/locale-gen which reads /etc/locale.gen and calls "localedef" on it.
That generates an error:

cannot open local definition file 'en': No such file or directory



(deepstar/tachyon) ~$ strace -s 1500 -ifo /tmp/localedef.log localedef -i en -c -f ISO-8859-1 -A /etc/locale.alias en
cannot open locale definition file `en': No such file or directory
(deepstar/tachyon) ~$ cat /tmp/localedef.log |grep i18n
10009 [b7f2b09e] open("/usr/share/i18n/charmaps/ISO-8859-1", O_RDONLY) = -1 ENOENT (No such file or directory)
10009 [b7f2b09e] open("/usr/share/i18n/charmaps/ISO-8859-1.gz", O_RDONLY) = 3
10009 [b7f2b09e] open("/usr/share/i18n/locales/en", O_RDONLY) = -1 ENOENT (No such file or directory)
(deepstar/tachyon) ~$ strace -s 1500 -ifo /tmp/localedef.log localedef -i en_US -c -f ISO-8859-1 -A /etc/locale.alias en_US
cannot open locale archive "/usr/lib/locale/locale-archive": Permission denied
(deepstar/tachyon) ~$ cat /tmp/localedef.log |grep i18n
10018 [b7ebd09e] open("/usr/share/i18n/charmaps/ISO-8859-1", O_RDONLY) = -1 ENOENT (No such file or directory)
10018 [b7ebd09e] open("/usr/share/i18n/charmaps/ISO-8859-1.gz", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/en_US", O_RDONLY) = 3
10018 [b7ebd09e] open("i18n", O_RDONLY) = -1 ENOENT (No such file or directory)
10018 [b7ebd09e] open("/usr/share/i18n/locales/i18n", O_RDONLY) = 4
10018 [b7ebd09e] open("/usr/share/i18n/locales/iso14651_t1", O_RDONLY) = 4
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_neutral", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_circle", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_cjk_compat", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_compat", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_font", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_fraction", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_narrow", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_small", O_RDONLY) = 3
10018 [b7ebd09e] open("/usr/share/i18n/locales/translit_wide", O_RDONLY) = 3
(deepstar/tachyon) ~$


From this strace, I conclude that localedef looks for /usr/share/i18n/locales/en and doesn't find it.

When I try installing Debian without modifications, the locale is set to en_US, which is puzzling.
Somehow, the custom CD sets locale to en, and does it differently from standard Debian. I don't recall modifying anything that could touch it though.

Instead of figuring out what settings I need to fix to make this problem go away, I'll just overwrite /etc/environment from within the debian installer.
The correct file to change is /usr/lib/prebaseconfig.d/05languagechooser