pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jhebert@micron.com
Subject: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified
Date: Thu, 28 Apr 2022 23:18:17 +0000
Message-ID: <17469-b677bc5397f04366@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17469
Logged by:          Joe Hebert
Email address:      jhebert@micron.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.



view thread (6+ messages)  latest in thread

Message-ID: <17469-b677bc5397f04366@postgresql.org>
Permalink:  ../17469-b677bc5397f04366@postgresql.org/
Also on:    postgresql.org/message-id/17469-b677bc5397f04366@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jhebert@micron.com
  Subject: Re: BUG #17469: postgresql-11.service file not configured to match setup/initdb options specified
  In-Reply-To: <17469-b677bc5397f04366@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox