BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: jhebert(at)micron(dot)com
Subject: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified
Date: 2022-04-28 23:18:17
Message-ID: 17469-b677bc5397f04366@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17469
Logged by: Joe Hebert
Email address: jhebert(at)micron(dot)com
PostgreSQL version: 11.11
Operating system: RHEL 8.5
Description:

The following command was used to initialize the database (separate issue
with postgresql-11-setup not working):
/usr/pgsql-11/bin/initdb -A password -E utf8 -D /postgres/data/datafiles -X
/postgres/tranlog

Initialization completed successfully.

Then ran: sudo systemctl enable postgresql-11
Result: Created symlink
/etc/systemd/system/multi-user.target.wants/postgresql-11.service â
/usr/lib/systemd/system/postgresql-11.service.

Then ran: sudo systemctl start postgresql-11
Result:
Job for postgresql-11.service failed because the control process exited with
error code.
See "systemctl status postgresql-11.service" and "journalctl -xe" for
details.

sudo systemctl status postgresql-11
â postgresql-11.service - PostgreSQL 11 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-11.service; enabled;
vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-04-27 16:19:40 MDT; 28s
ago
Docs: https://www.postgresql.org/docs/11/static/
Process: 147756 ExecStartPre=/usr/pgsql-11/bin/postgresql-11-check-db-dir
${PGDATA} (code=exited, status=1/FAILURE)

Apr 27 16:19:40 systemd[1]: Starting PostgreSQL 11 database server...
Apr 27 16:19:40 systemd[1]: postgresql-11.service: Control process exited,
code=exited status=1
Apr 27 16:19:40 systemd[1]: postgresql-11.service: Failed with result
'exit-code'.
Apr 27 16:19:40 systemd[1]: Failed to start PostgreSQL 11 database
server.

After researching further, I reviewed file
/usr/lib/systemd/system/postgresql-11.service
and found the following offending line:
Environment=PGDATA=/var/lib/pgsql/11/data/

Which should have been set to /postgres/data/datafiles based in the option
provided to the initdb command.

Work-around: sudo systemctl edit --full postgresql-11
replaced the content, fixing the incorrect path
Result: PostgreSQL instance started successfully

If this is not considered a bug, please consider addressing this as an
enhancement. As a side note, I tried the "sudo systemctl edit" command
without the --full option to only override the one line, however, the issue
still persisted and required a wholesale replacement of the
postgresql-11.service file.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-04-28 23:58:27 Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified
Previous Message Wilm Hoyer 2022-04-28 09:31:17 AW: BUG #17448: In Windows 10, version 1703 and later, huge_pages doesn't work.