Project

General

Profile

Bug #28902

Updated by Ewoud Kohl van Wijngaarden about 1 year ago

When installing F20 nightly on RHEL-7.7 the installer fails due to wrong selinux context of /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf which prevents postgres from being started. Restoring the context manually helps.

<pre>
[root@dhcp-2-111 ~]# foreman-installer -v
...
[ INFO 2020-01-30T04:28:24 verbose] Concat[05-foreman-ssl.conf]: Scheduling refresh of Class[Apache::Service]
[ INFO 2020-01-30T04:28:24 verbose] Class[Postgresql::Server::Service]: Scheduling refresh of Anchor[postgresql::server::service::begin]
[ INFO 2020-01-30T04:28:24 verbose] Class[Postgresql::Server::Service]: Scheduling refresh of Service[postgresqld]
[ INFO 2020-01-30T04:28:24 verbose] Class[Postgresql::Server::Service]: Scheduling refresh of Anchor[postgresql::server::service::end]
[ WARN 2020-01-30T04:28:24 verbose] /Stage[main]/Postgresql::Server::Service/Anchor[postgresql::server::service::begin]: Triggered 'refresh' from 1 event
[ERROR 2020-01-30T04:28:25 verbose] Systemd start for postgresql failed!
[ERROR 2020-01-30T04:28:25 verbose] journalctl log for postgresql:
[ERROR 2020-01-30T04:28:25 verbose] -- Logs begin at Thu 2020-01-30 03:48:52 EST, end at Thu 2020-01-30 04:28:25 EST. --
[ERROR 2020-01-30T04:28:25 verbose] Jan 30 04:28:25 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: Starting PostgreSQL database server...
[ERROR 2020-01-30T04:28:25 verbose] Jan 30 04:28:25 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: postgresql.service: main process exited, code=exited, status=2/INVALIDARGUMENT
[ERROR 2020-01-30T04:28:25 verbose] Jan 30 04:28:25 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: Failed to start PostgreSQL database server.
[ERROR 2020-01-30T04:28:25 verbose] Jan 30 04:28:25 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: Unit postgresql.service entered failed state.
[ERROR 2020-01-30T04:28:25 verbose] Jan 30 04:28:25 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: postgresql.service failed.
...

[root@dhcp-2-111 ~]# journalctl -xe
...
-- Unit postgresql.service has begun starting up.
Jan 30 04:38:31 dhcp-2-111.vms.sat.rdu2.redhat.com sh[5922]: postmaster: could not access the server configuration file "/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf": Permission denied
Jan 30 04:38:31 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: postgresql.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 30 04:38:31 dhcp-2-111.vms.sat.rdu2.redhat.com systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed

[root@dhcp-2-111 ~]# ls -lZ /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf
-rw-------. postgres postgres system_u:object_r:var_t:s0 /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf

[root@dhcp-2-111 ~]# chcon -t postgresql_db_t /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf
[root@dhcp-2-111 ~]# systemctl restart postgresql
[root@dhcp-2-111 ~]# systemctl status postgresql
‚óŹ postgresql.service - PostgreSQL database server
Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-01-30 05:16:13 EST; 3min 9s ago
</pre>

Back