You are not logged in.

#1 2015-02-23 10:38:13

pmatts
Member
Registered: 2015-02-23
Posts: 25

[Solved] Cannot start postgresql

I've installed and used postrges several times in the past, but this time i'm stumped.

Before jumping throught the usual hoops of account/password/database creation I need to get the thing up and running. It installed fine via pacman

[x@arch ~]$ sudo systemctl start postgresql
Job for postgresql.service failed. See "systemctl status postgresql.service" and "journalctl -xe" for details.
[x@arch ~]$ systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2015-02-23 11:20:57 CET; 8s ago
  Process: 956 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE)
[x@arch ~]$ journalctl -xe
<snip>
Feb 23 11:07:22 arch su[813]: pam_unix(su:auth): authentication failure; logname= uid=1000 euid=0 tty=pts/0 ruser=x rhost=  user=postgres
Feb 23 11:07:24 arch su[813]: FAILED SU (to postgres) x on pts/0

Anybody know whats going on?

[x@arch ~]$ uname -a
Linux arch 3.18.6-1-ARCH #1 SMP PREEMPT Sat Feb 7 08:59:29 CET 2015 i686 GNU/Linux

Last edited by pmatts (2015-02-23 11:38:18)

Offline

#2 2015-02-23 11:13:36

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Cannot start postgresql

https://wiki.archlinux.org/index.php/Po … PostgreSQL

You can see a -check-db-dir command failing, probably because you didn't run initdb? Or there is a problem with the postgres user (the su error) which you could have checked already, but you're going to have to try it anyway to run initdb as the right user.

Last edited by Raynman (2015-02-23 11:16:37)

Offline

#3 2015-02-23 11:35:05

pmatts
Member
Registered: 2015-02-23
Posts: 25

Re: [Solved] Cannot start postgresql

Ah! That initdb stuff is new for me. i missed that bit.

heres the process for anyone interested: (Change your locale to your locale)

[x@arch ~]$ su root
Password: 
[root@arch x]# su postgres
[postgres@arch x]$ initdb --locale en_GB.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
could not change directory to "/home/x": Permission denied
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_GB.UTF-8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/lib/postgres/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/postgres/data
or
    pg_ctl -D /var/lib/postgres/data -l logfile start

[postgres@arch x]$ exit
[root@arch x]# exit
[x@arch ~]$ sudo systemctl start postgresql

Offline

Board footer

Powered by FluxBB