Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/postgresql/postgresql.service: set locale for initdb to C
@ 2023-10-10 16:45 Adam Duskett
  2023-10-10 16:45 ` [Buildroot] [PATCH 2/2] support/testing/tests/package/test_postgresql.py: new test Adam Duskett
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Adam Duskett @ 2023-10-10 16:45 UTC (permalink / raw)
  To: buildroot; +Cc: Maxim Kochetkov, Adam Duskett, Peter Seiderer

From: Peter Seiderer <ps.report@gmx.net>

From this patch from Sept. 20, 2020, postgresql.service is still broken on
startup:

Postgresql systemd startup fails with:

  Starting PostgreSQL database server...
  [FAILED] Failed to start PostgreSQL database server.
  See 'systemctl status postgresql.service' for details.

  $ systemctl status postgresql.service | cat
  ● postgresql.service - PostgreSQL database server
       Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sat 2020-09-12 12:16:35 UTC; 35s ago
      Process: 164 ExecStartPre=/bin/sh -c if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql; fi (code=exited, status=1/FAILURE)

  Sep 12 12:16:35 buildroot systemd[1]: Starting PostgreSQL database server...
  Sep 12 12:16:35 buildroot postgres[166]: The files belonging to this database system will be owned by user "postgres".
  Sep 12 12:16:35 buildroot postgres[166]: This user must also own the server process.
  Sep 12 12:16:35 buildroot postgres[166]: initdb: error: invalid locale settings; check LANG and LC_* environment variables
  Sep 12 12:16:35 buildroot systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
  Sep 12 12:16:35 buildroot postgres[164]: pg_ctl: database system initialization failed
  Sep 12 12:16:35 buildroot systemd[1]: postgresql.service: Failed with result 'exit-code'.
  Sep 12 12:16:35 buildroot systemd[1]: Failed to start PostgreSQL database server.

Fix it by setting a sane/always available locale=C in the startup files.

A similare failure/fix was reported by Pascal de Bruijn ([1]), but with
en_US.UTF-8 instead of C.

[1] http://lists.busybox.net/pipermail/buildroot/2019-November/266700.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
 package/postgresql/postgresql.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
index 539eea8964..245375b77d 100644
--- a/package/postgresql/postgresql.service
+++ b/package/postgresql/postgresql.service
@@ -16,7 +16,7 @@ StandardOutput=syslog
 StandardError=syslog
 SyslogIdentifier=postgres
 
-ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql; fi"
+ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=C; fi"
 ExecStart=/usr/bin/postgres -D /var/lib/pgsql
 ExecReload=/usr/bin/kill -HUP $MAINPID
 KillMode=mixed
-- 
2.41.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-01 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 16:45 [Buildroot] [PATCH 1/2] package/postgresql/postgresql.service: set locale for initdb to C Adam Duskett
2023-10-10 16:45 ` [Buildroot] [PATCH 2/2] support/testing/tests/package/test_postgresql.py: new test Adam Duskett
2023-11-01 16:43   ` Thomas Petazzoni via buildroot
2023-10-10 17:02 ` [Buildroot] [PATCH 1/2] package/postgresql/postgresql.service: set locale for initdb to C Maxim Kochetkov via buildroot
2023-11-01 16:37 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox