Error starting Postgresql

I am trying to create a box through Fabric on Openstack. Part of the installation includes installing and starting PostgreSQL.

This command works just fine:

$ sudo service postgresql initdb 

This command does not work:

 $ sudo service postgresql start 

Exiting the error log does not cause problems when executing this command:

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

This command displays 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, when executing these commands, has the following groups:

 vagrant, wheel 

My user is on the sudoers list in the /etc/sudoers section 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 
+4
source share
1 answer

This turned out to be a selinux problem. I turned it off and was healthy. Full configuration below.

For those of you who arent on selinux (like me until today), config can be found in:

  /etc/selinux/config 

It can also be temporarily disabled as follows:

 echo 0 > /selinux/enforce 

Full configuration

 [ 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. 
+1
source

Source: https://habr.com/ru/post/1487185/


All Articles