Re: postgresql systemd service fails to start only on boot but notmanually - Mailing list pgsql-general

From Doron Behar
Subject Re: postgresql systemd service fails to start only on boot but notmanually
Date
Msg-id 20180923104119.5pjfw7r5hkuzgjys@NUC.doronbehar.com
Whole thread Raw
In response to Re: postgresql systemd service fails to start only on boot but notmanually  (Adrian Klaver <adrian.klaver@aklaver.com>)
List 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.


pgsql-general by date:

Previous
From: Robert Haas
Date:
Subject: Re: Code of Conduct plan
Next
From: "Mark Williams"
Date:
Subject: RE: PostgreSQl, PHP and IIS