From e42e6f31a650c4fc7ab2df5b52f9ecffbb888dc7 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 2 Oct 2024 09:36:55 +0000 Subject: [PATCH] [stable-only] Update system locale before PostgreSQL initialization In Fedora/CentOS9, the PostgreSQL initialization fails with the following message: initdb: invalid locale settings; check LANG and LC_* environment variables This patch installs the required packages and configure the system locale before calling the initialization process. Closes-Bug: #2083482 Change-Id: I2c83e896819b20cd7a1ee8d8ee33354fb047a6d9 --- lib/databases/postgresql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/databases/postgresql b/lib/databases/postgresql index 4f0a5a0a4c..432d32c63f 100644 --- a/lib/databases/postgresql +++ b/lib/databases/postgresql @@ -53,7 +53,8 @@ function configure_database_postgresql { pg_hba=/var/lib/pgsql/data/pg_hba.conf pg_conf=/var/lib/pgsql/data/postgresql.conf if ! sudo [ -e $pg_hba ]; then - sudo postgresql-setup initdb + localectl set-locale LANG=en_US.UTF-8 + sudo -E postgresql-setup initdb fi elif is_ubuntu; then version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2` @@ -108,7 +109,7 @@ EOF if is_ubuntu; then install_package postgresql elif is_fedora || is_suse; then - install_package postgresql-server + install_package postgresql-server langpacks-en glibc-langpack-en if is_fedora; then sudo systemctl enable postgresql fi