postgresql service start issues

10,765

Solution 1

This turned out to be an selinux issue. I disabled it and was well. Full config below.

For those of you that arent up on selinux (like me until today) the config can be found in:

 /etc/selinux/config

It can also be turned off temporarily like this:

echo 0 > /selinux/enforce

Full config

[root@integration selinux]# cat config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
#   targeted - Only targeted network daemons are protected.
#   strict - Full SELinux protection.

Solution 2

I would try the following since it seems like you're attempting to start the PostgreSQL service with vagrant's credentials even though you're doing a sudo. This will just confirm that you can in fact start PostgreSQL.

$ sudo su -
$ service postgresql start

If you can start the service using the above commands then something is up with your vagrant account's ability to sudo and start the service.

Share:
10,765

Related videos on Youtube

mconlin
Author by

mconlin

I build software and software teams.

Updated on September 18, 2022

Comments

  • mconlin
    mconlin almost 2 years

    I'm attempting to build a box via Fabric on Openstack. Part of the install involves installing and running PostgreSQL.

    This command works fine:

    $ sudo service postgresql initdb 
    

    This command fails:

    $ sudo service postgresql start
    

    Log output of failure shows no issues when I run this command:

    $ cat /var/lib/pgsql/pgstartup.log  
    

    This command shows the following messages:

    $ cat /var/lib/pgsql/data/pg_log/postgresql-Wed.log
    

    LOG: could not open configuration file "/var/lib/pgsql/data/pg_hba.conf": Permission denied FATAL: could not load pg_hba.conf

    My user while executing these commands has the following groups:

    vagrant, wheel
    

    My user is in the sudoers list under /etc/sudoers with these permissions:

    vagrant  ALL=(ALL) NOPASSWD: ALL
    

    perms on pgsql:

    [root@integration ~]# ls -ltr /var/lib/pgsql/
    total 12
    drwx------.  2 postgres postgres 4096 Sep 13  2012 backups
    -rw-------.  1 postgres postgres 1152 Jun 19 20:17 pgstartup.log
    drwx------. 12 postgres postgres 4096 Jun 19 20:19 data
    

    and sub dir data:

    [root@integration ~]# ls -ltr /var/lib/pgsql/data/
    total 76
    -rw-------. 1 postgres postgres     4 Jun 19 20:17 PG_VERSION
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_twophase
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_tblspc
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_stat_tmp
    drwx------. 4 postgres postgres  4096 Jun 19 20:17 pg_multixact
    -rw-------. 1 postgres postgres 16886 Jun 19 20:17 postgresql.conf
    -rw-------. 1 postgres postgres  1631 Jun 19 20:17 pg_ident.conf
    drwx------. 3 postgres postgres  4096 Jun 19 20:17 pg_xlog
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_subtrans
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_clog
    drwx------. 5 postgres postgres  4096 Jun 19 20:17 base
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 global
    -rw-------. 1 postgres postgres   241 Jun 19 20:17 pg_hba.conf
    drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_log
    -rw-------. 1 postgres postgres    57 Jun 19 20:19 postmaster.opts
    
  • mconlin
    mconlin about 11 years
    as root user it still fails, error in pgstartup.log is "runuser: cannot set groups: Operation not permitted"
  • mconlin
    mconlin about 11 years
    this did get me on the correct path of digging into perms more, thank you! see answer below.
  • slm
    slm about 11 years
    @mconlin - Glad you solved you issue. Can you please mark your answer as the excepted once the timeout passes? That way others will know that you're issue's been resolved.