You are not logged in.
Pages: 1
Topic closed
I'm trying to run postgresql in a pure systemd machine.
i've done a fresh install of postgresql using pacman as instructed in the wiki. However when i try to start the service i get the following:
user@frodo:~$ sudo systemctl start postgresql.service
Failed to issue method call: Unit postgresql.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql.service' for details.
user@frodo:~$ sudo systemctl status postgresql.service
postgresql.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
So it seems the package has no systemd service files included. Did anyone got around to make one of these?
Last edited by lothar_m (2012-09-26 22:01:21)
“Clearly, Field Marshal Haig is about to make yet another gargantuan effort to move his drinks cabinet six inches closer to Berlin.”
-----------------------------------------------------------------------------
GitHub
Offline
The PostgreSQL package on [testing] has a service file for systemd.
Offline
Thanks. I've reinstalled the package from testing.
However i'm still unable to start the postgresql server. this time it goes like this:
user@frodo:~$ sudo systemctl start postgresql.service
Job failed. See system journal and 'systemctl status' for details.
user@frodo:~$ systemctl status postgresql.service
postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
Active: failed (Result: exit-code) since Sun, 23 Sep 2012 12:21:38 +0100; 2min 36s ago
Process: 631 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/postgresql.service
here's the content of /etc/conf.d/postgres and /usr/lib/systemd/system/postgresql.service
##
## Parameters to be passed to postgresql
##
## Default data directory location
PGROOT="/var/lib/postgres"
## Passed to initdb if necessary
INITOPTS="--locale en_US.UTF-8"
## Default log file location
PGLOG="/var/log/postgresql.log"
## Additional options to pass via pg_ctl's '-o' option
#PGOPTS=""
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
TimeoutSec=120
User=postgres
Group=postgres
Environment=PGROOT=/var/lib/postgres
Environment=PGLOG=/var/log/postgresql.log
SyslogIdentifier=postgres
PIDFile=/var/lib/postgres/data/postmaster.pid
ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
# killing Postgres, so adjust it downward
OOMScoreAdjust=-200
[Install]
WantedBy=multi-user.target
“Clearly, Field Marshal Haig is about to make yet another gargantuan effort to move his drinks cabinet six inches closer to Berlin.”
-----------------------------------------------------------------------------
GitHub
Offline
Uncomment PGROOT in /etc/conf.d/postgresql.
EDIT: nevermind
Last edited by z0id (2012-09-23 17:55:30)
/usr/bin/drinking
Offline
Uncomment PGROOT in /etc/conf.d/postgresql.
EDIT: nevermind
Yeah... thanks anyway
“Clearly, Field Marshal Haig is about to make yet another gargantuan effort to move his drinks cabinet six inches closer to Berlin.”
-----------------------------------------------------------------------------
GitHub
Offline
Up
“Clearly, Field Marshal Haig is about to make yet another gargantuan effort to move his drinks cabinet six inches closer to Berlin.”
-----------------------------------------------------------------------------
GitHub
Offline
well, i've managed to fix the problem.
it seems that the wiki is missing a couple of steps. so i manually done the following:
i) create the data directory (acordingly with the PGROOT variable set before in the config file)
user@frodo:~$ sudo mkdir /var/lib/postgres/data
ii) set /var/lib/postgres/data ownership to user 'postgres'
iii) As user 'postgres' start the database.
user@frodo:~$ sudo -i -u postgres
[postgres@frodo ~]$ initdb -D '/var/lib/postgres/data'
iv) start the service as root
user@frodo:~$ sudo systemctl start postgresql.service
that should be it.
Issuing a systemctl status should return
user@frodo:~$ sudo sudo systemctl status postgresql.service
postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
Active: active (running) since Wed, 26 Sep 2012 22:50:09 +0100; 6s ago
Process: 11187 ExecStart=/usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 (code=exited, status=0/SUCCESS)
Process: 11183 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=0/SUCCESS)
Main PID: 11193 (postgres)
CGroup: name=systemd:/system/postgresql.service
├ 11193 /usr/bin/postgres -D /var/lib/postgres/data
├ 11198 postgres: checkpointer process
├ 11199 postgres: writer process
├ 11200 postgres: wal writer process
├ 11201 postgres: autovacuum launcher process
└ 11202 postgres: stats collector process
Sep 26 22:50:08 frodo postgres[11187]: LOG: database system was shut down at 2012-09-26 22:49:13 WEST
Sep 26 22:50:08 frodo postgres[11187]: LOG: database system is ready to accept connections
Sep 26 22:50:08 frodo postgres[11187]: LOG: autovacuum launcher starte
Last edited by lothar_m (2012-12-30 09:52:52)
“Clearly, Field Marshal Haig is about to make yet another gargantuan effort to move his drinks cabinet six inches closer to Berlin.”
-----------------------------------------------------------------------------
GitHub
Offline
Thanks 'u @lothar_m
Your solution works for me!
Offline
Closing this two year old thead
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed