#942137 postgresql-common: strech/buster upgrades fail with error 'invalid value for parameter "lc_time"'

#942137#5
Date:
2019-10-10 19:30:00 UTC
From:
To:
Dear Maintainer,

When upgrading from stretch to buster, the nss upgrade offers restart
the affected services, that is postgresql.

Then we get the message:
┌─────────────────────────Configuring libc6:amd64────────────────────────────┐
│ Failure restarting some services for GNU libc upgrade                      │
│                                                                            │
│ The following services could not be restarted for the GNU libc library     │
│ upgrade:                                                                   │
│                                                                            │
│ postgresql                                                                 │
│                                                                            │
│ You will need to start these manually by running 'invoke-rc.d <service>    │
│ start'.                                                                    │
│                                                                            │
│                                                                            │
├────────────────────────────────────────────────────────────────────────────┤
│                                 <  OK  >                                   │
└────────────────────────────────────────────────────────────────────────────┘

Running "/etc/init.d/postgresql start" manually, one gets:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
[....] Starting PostgreSQL 9.6 database server: main[....] perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_GB.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). The PostgreSQL server failed to start. Please check the log output: 2019-10-10 20:10:39 BST [21355-1] LOG: invalid value for parameter "lc_time": "en_GB.UTF-8" 2019-10-10 20:10:39 BST [21355-2] FATAL: configuration file "/etc/postgresq[FAIL/main/postgresql.conf" contains errors ... failed!
 failed!

If I comment out the line "lc_time" in
/etc/postgresql/9.6/main/postgresql.conf then every thing is fine.

I expected libc to upgrade smoothly without having to patch
postgresql.conf file.

#942137#8
Date:
2019-10-11 07:50:26 UTC
From:
To:
Re: Jean-Michel Vourgère 2019-10-10 <157073580035.6593.14242157514478031502.reportbug@deimos.nirgal.com>

Hi Jean-Michel,

the problem is within the locales on that system. Just invoking "perl"
is a pretty good way to verify that the locales are set up correctly.

Did en_GB.UTF-8 ever work correctly on that box? Was that broken by
the dist-upgrade? That would be a bug in `locales`, but I suspect it's
rather some local problem.

Maybe there's something in the logs like /var/log/apt/term.log? Check
if there's any errors during the upgrade of the `locales` package or
similar items.

The fix is probably simply re-invoking `dpkg-reconfigure locales`.

Christoph

#942137#15
Date:
2019-10-11 09:58:50 UTC
From:
To:
Hi Christoph

My English locale en_GB.UTF-8 is working fine. It is my default locale,
defined either at installation, or by dpkg-reconfigure locales.

Each time I do a major Debian dist-upgrade (7/8, 8/9 and 9/10), I get many
such perl warnings. It has never been a real issue, but for the flood of my
terminal.

Attached is the beginning of my term.log and my /etc/postgresql/9.6/main/
postgresql.conf.

You'll notice that packages locales and perl-modules are unpacked really
early, but are configured later. These annoying warnings stops when they are
configured.

You'll notice that I have:
lc_messages = 'en_GB.UTF-8' # locale for system error message
                            # strings
lc_monetary = 'en_GB.UTF-8' # locale for monetary formatting
lc_numeric = 'en_GB.UTF-8'  # locale for number formatting
#lc_time = 'en_GB.UTF-8'     # locale for time formatting


The only problem is lc_time. One must comment out the line for postgres9.6 to
start during the dist-upgrade. The other lines like lc_messages, lc_monetary
and lc_numeric are not a problem.

I upgraded 5 different postgresql servers, and I had to edit the
postgresql.conf in the middle of the update on all 5 of them! Not doing so
causes the whole dist-upgrade to fail with other nastier side-effect. This is
not an isolated issue!

You suggested that I redo a "dpkg-reconfigure locales". I don't think I could
do that in the middle of a dist-upgrade! I assure you that my locale is
working fine before and after the upgrade, even if it's broken during the
dist-upgrade!

You can very probably reproduce the problem by installing a stretch using
locale en_GB.UTF-8, then install postgres (You should then get a
lc_time='en_GB.UTF-8' in postgresql.conf) and libnss, then do a dist-upgrade
accepting all automatic restarts when required.

Fell free to tell me how I can help to pinpoint the issue.