Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ve7ZK-00979g-15 for pgsql-docs@arkaria.postgresql.org; Fri, 09 Jan 2026 08:10:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1ve7ZJ-006Hoj-0I for pgsql-docs@arkaria.postgresql.org; Fri, 09 Jan 2026 08:10:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdtHz-003Nfk-0w for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 16:55:12 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdtHu-005JOb-32 for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 16:55:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=Btf+o/qUHZgInMlHCbmAaaoCTC5s4ID7XQTpEy48jY8=; b=Q3huzk6Gn8WEYkMQON4DIxF0mS wBx2NUIm8f+xaWZsvx5D52QbfMn8a/rjUi9ndoDLGF1zahqKLT5M6jBnHJAti5aKPgrec0ZdADBmr bnag3ALqmaP5TH5SguacmrZiLGQva/iXyvBoDhfAkKk8LHwvnOZ4LprsQSW9iNrcdzZIAzWZ5rWgS Zs7WHhNUYny6j7b42jdExOyZBEnZgBw2omg7BDhrhIMeq/5sC9yMnjPFTBuNotc1MUE3Rsp/bAbzn o6UNdTa2nQiOo03uS7F0PvUIhCHGlZm8EjDUNitJH/bNdqYQ+MED4UaJGJjeX0yQACOlpb7cjaeVS 0obDKDjQ==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdtHs-00ENCe-2H for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 16:55:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdtHq-00735I-17 for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 16:55:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Documentation/Behavior: Systemd Type=notify failure with pg_ctl on Debian 12 To: pgsql-docs@lists.postgresql.org From: PG Doc comments form Cc: virtualtengfei@163.com Reply-To: virtualtengfei@163.com, pgsql-docs@lists.postgresql.org Date: Thu, 08 Jan 2026 16:54:03 +0000 Message-ID: <176789124328.1470667.14491036876449669285@wrigleys.postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/18/server-start.html Description: **PostgreSQL Version:** 18.1 (devel/snapshot) and 17.5 **Operating System:** Debian 12.11 (amd64) **Installation Method:** Source compilation **Configure Options:** `./configure --prefix=3D/usr/local/services/pgsql-18= .1 --with-llvm --with-systemd` **Description:** I am encountering an issue starting the PostgreSQL service using systemd after compiling from source with `--with-systemd`. While the server starts correctly when invoking `pg_ctl` manually from the command line, it fails to start when using a systemd unit file configured with `Type=3Dnotify`, which references the documentation at [https://www.postgresql.org/docs/current/server-start.html](https://www.pos= tgresql.org/docs/current/server-start.html). **Steps to Reproduce:** 1. Compile and install PostgreSQL with systemd support. 2. Create a systemd unit file as follows (using `pg_ctl` in ExecStart): ```Ini [Unit] Description=3DPostgreSQL database server Documentation=3Dman:postgres(1) After=3Dnetwork-online.target Wants=3Dnetwork-online.target [Service] Type=3Dnotify User=3Dpostgres WorkingDirectory=3D/usr/local/services/pgsql-18.1 # Using pg_ctl to start the service ExecStart=3D/usr/local/services/pgsql-18.1/bin/pg_ctl start -D /usr/local/services/pgsql-18.1/data -l /usr/local/services/pgsql-18.1/pg.log ExecReload=3D/bin/kill -HUP $MAINPID KillMode=3Dmixed KillSignal=3DSIGINT TimeoutSec=3Dinfinity [Install] WantedBy=3Dmulti-user.target ``` 3. Run `sudo systemctl daemon-reload` and `sudo systemctl start postgresql`. **Observed Result:** The service hangs in the "activating" state until it times out, even though the database process is actually running in the background. Systemd eventually kills the process because it never receives the readiness notification. `pg.log` (even at debug5 level) shows no errors, confirming the database started but the notification was not acknowledged by systemd. **Analysis & Fix:** Since `ExecStart` executes `pg_ctl`, but the `sd_notify` signal is sent by the forked `postgres` process, systemd ignores the signal by default. I found that adding the following lines to the `[Service]` section fixes the issue entirely: ```Ini NotifyAccess=3Dall PIDFile=3D/usr/local/services/pgsql-18.1/data/postmaster.pid ``` **Suggestion:** The documentation regarding Systemd integration (specifically when using `pg_ctl` combined with `Type=3Dnotify`) might be incomplete. It appears that `NotifyAccess=3Dall` is mandatory when `ExecStart` is a wrapper (like `pg_ctl`) rather than the `postgres` binary itself. I confirmed this behavior on both PostgreSQL v18.1 and v17.5 on Debian 12. I suggest updating the documentation examples or adding a note about `NotifyAccess` for users compiling with `--with-systemd`. Best regards.