Re: postgresql systemd service fails to start only on boot but not manually

From: Doron Behar <doron(dot)behar(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: postgresql systemd service fails to start only on boot but not manually
Date: 2018-09-23 10:41:19
Message-ID: 20180923104119.5pjfw7r5hkuzgjys@NUC.doronbehar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Sep 22, 2018 at 07:14:33AM -0700, Adrian Klaver wrote:
>
> Linux distro and version?

Arch Linux

$ uname -a
Linux vps 4.18.9-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 19 21:19:17 UTC 2018 x86_64 GNU/Linux

It's a VPS with one CPU core on it and 2G RAM - not very much I know,
hosted on OVH

>
> Assuming Postgres version 10+ given logical replication warning. Still
> actual version would be nice.
>
> How did you install Postgres?

With the package manager and the files used in it's build are viewable
from here:
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/postgresql

>
> Where did systemd script come from?
>
> What is in the systemd script?

The systemd service was installed with the package

[Unit]
Description=PostgreSQL database server
After=network.target

[Service]
Type=notify
TimeoutSec=120
User=postgres
Group=postgres

Environment=PGROOT=/var/lib/postgres

SyslogIdentifier=postgres
PIDFile=/var/lib/postgres/data/postmaster.pid
RuntimeDirectory=postgresql
RuntimeDirectoryMode=755

ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
ExecStart=/usr/bin/postgres -D ${PGROOT}/data
ExecReload=/bin/kill -HUP ${MAINPID}
KillMode=mixed
KillSignal=SIGINT

# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
# killing Postgres, so adjust it downward
OOMScoreAdjust=-200

# Additional security-related features
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

>
> What does the log show when you do a successful manual start?

2018-09-22 09:38:44.470 CEST [15251] LOG: listening on IPv4 address "127.0.0.1", port 5432
2018-09-22 09:38:44.472 CEST [15251] LOG: listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2018-09-22 09:38:44.485 CEST [15253] LOG: database system was shut down at 2018-09-21 20:49:10 CEST
2018-09-22 09:38:44.490 CEST [15251] LOG: database system is ready to accept connections

>
> What does the system log show when the Postgres reboot startup fails?

This was posted in my 1st message.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Williams 2018-09-23 10:54:20 RE: PostgreSQl, PHP and IIS
Previous Message Robert Haas 2018-09-23 04:14:00 Re: Code of Conduct plan