translators-packages team mailing list archive
-
translators-packages team
-
Mailing list archive
-
Message #01363
[Bug 2120743] [NEW] postinst script overwrites /etc/locale.gen
Public bug reported:
I've been looking into why some of my Ubuntu systems are taking longer
than they should to perform APT upgrades. One reason is the locale-gen
step is compiling 17(!!) additional locales on top of the one that's
actually needed, which is en_US.UTF-8. This makes locale-gen take 50
seconds rather than 2-3 seconds.
When I run dpkg-reconfigure locales, and configure only the en_US.UTF-8
locale to be enabled, I would expect (as a user) for only that locale to
be enabled. However, this is not the case. The other locales are enabled
regardless. It is further confusing to look at /etc/locale.gen and see
that the additional locales are commented out there per the dpkg-
reconfigure session, yet are used anyway.
The first issue I found is that the language-pack-en-base package, which
is installed by default and seems to be required as a dependency of
GNOME in order to provide translation files for the en_US.UTF-8 locale,
is installing a file /var/lib/locales/supported.d/en that overwrites
/etc/locale.gen by adding additional locales.
As far as I can tell, the only way to work around that is to add a file
to /etc/dpkg/dpkg.cfg.d with something like "path-exclude
/var/lib/locales/supported.d/en", and reinstall the package. Maybe
#152945 would eliminate the need to do this; I'm not sure.
But then I discovered a second problem, even worse, which is that
reinstalling language-pack-en-base (which may also occur automatically
during any system upgrade) will forcibly update the contents of
/etc/locale.gen to uncomment all the lines of the additional locales!
This is because the package postinst script is invoking
/usr/share/locales/install-language-pack, which is invoking locale-gen
with an undocumented(?!) positional argument that activates an
undocumented(?!) feature of having it write to locale.gen, rather than
reading from it.
At this point, I am kind of stuck on figuring out how do I configure my
system so that only en_US.UTF-8 is made available as a locale, without
the changes being automatically reverted by APT. Is this behavior
intended? Is it documented anywhere? Am I missing some way to opt out of
the additional locales being added back every time?
This behavior occurs for me on all my systems where I am running Ubuntu
24.04 with GNOME. I believe all versions of language-pack-en-base are
affected but the current one is 1:24.04+20250130.
** Affects: language-pack-en-base (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of
Translators Packages, which is subscribed to language-pack-en-base in
Ubuntu.
https://bugs.launchpad.net/bugs/2120743
Title:
postinst script overwrites /etc/locale.gen
Status in language-pack-en-base package in Ubuntu:
New
Bug description:
I've been looking into why some of my Ubuntu systems are taking longer
than they should to perform APT upgrades. One reason is the locale-gen
step is compiling 17(!!) additional locales on top of the one that's
actually needed, which is en_US.UTF-8. This makes locale-gen take 50
seconds rather than 2-3 seconds.
When I run dpkg-reconfigure locales, and configure only the
en_US.UTF-8 locale to be enabled, I would expect (as a user) for only
that locale to be enabled. However, this is not the case. The other
locales are enabled regardless. It is further confusing to look at
/etc/locale.gen and see that the additional locales are commented out
there per the dpkg-reconfigure session, yet are used anyway.
The first issue I found is that the language-pack-en-base package,
which is installed by default and seems to be required as a dependency
of GNOME in order to provide translation files for the en_US.UTF-8
locale, is installing a file /var/lib/locales/supported.d/en that
overwrites /etc/locale.gen by adding additional locales.
As far as I can tell, the only way to work around that is to add a
file to /etc/dpkg/dpkg.cfg.d with something like "path-exclude
/var/lib/locales/supported.d/en", and reinstall the package. Maybe
#152945 would eliminate the need to do this; I'm not sure.
But then I discovered a second problem, even worse, which is that
reinstalling language-pack-en-base (which may also occur automatically
during any system upgrade) will forcibly update the contents of
/etc/locale.gen to uncomment all the lines of the additional locales!
This is because the package postinst script is invoking
/usr/share/locales/install-language-pack, which is invoking locale-gen
with an undocumented(?!) positional argument that activates an
undocumented(?!) feature of having it write to locale.gen, rather than
reading from it.
At this point, I am kind of stuck on figuring out how do I configure
my system so that only en_US.UTF-8 is made available as a locale,
without the changes being automatically reverted by APT. Is this
behavior intended? Is it documented anywhere? Am I missing some way to
opt out of the additional locales being added back every time?
This behavior occurs for me on all my systems where I am running
Ubuntu 24.04 with GNOME. I believe all versions of language-pack-en-
base are affected but the current one is 1:24.04+20250130.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/language-pack-en-base/+bug/2120743/+subscriptions