LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-12-2009, 07:03 PM   #1
brojard
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Rep: Reputation: 0
postgresql 8.3.8 startup fails at boot on fc11


System is fc 11
postgres version is 8.3.8

Postgresql installed and works fine. I manually start-up using:
$ su postgres
$ cd /var/lib/pgsql
$ pg_ctl start -D /var/lib/pgsql/data -l

$ chkconfig postgresql on
Didn't test this that and it turns out that won't work because you have to startup using the db owner which is postgres.

So that is where I'm at. I'm trying to get postgres to start on boot by adding a line to rc.local. I've tried many versions of the following to no avail:

runuser -s bash -c "/usr/bin/pg_ctl start -D /var/lib/pgsql/data -l logfile" -l postgres

var/log/boot.log says:
runuser: bash: No such file or directory ??

I've tried same command using su.
I've left out the switches (-s bash and -l also) but nothing has worked so far.

Comments, suggestions, brow beatings welcome!

Last edited by brojard; 09-19-2009 at 02:00 PM. Reason: wrong version for postgres listed
 
Old 09-12-2009, 07:32 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Considering that 8.5 has only just started its development
cycle I wouldn't be surprised ... where did you get that from?

The latest current (stable) release is 8.4.1


Cheers,
Tink
 
Old 09-13-2009, 07:32 AM   #3
catbird
LQ Newbie
 
Registered: Oct 2006
Posts: 26

Rep: Reputation: 16
I wrote the download info:
pgdg-fedora-8.5.1.noarch.rpm
The doc does say 8.4.1
 
Old 09-13-2009, 08:26 AM   #4
brojard
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
CB we both screwed up... the version is found using following cmd
$ postgres --version
postgres (PostgreSQL) 8.3.8
 
Old 09-13-2009, 08:34 AM   #5
steve michael
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
that's good
 
Old 09-18-2009, 01:11 PM   #6
brojard
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Problem resolved.

I removed the data directory in /var/lib/pgsql/data
and then initialized the server using initdb command per documentation.
But this time instead of:
$ su postgres

I did this:
$ su - postgres

I think that using the - in the su command may be the trick.

BTW - I wish I had known that I could restart the *just* the service. I was restarting the pc which took 8 minutes each time I made a change and tested it.

Does that seem plausible that using the - in the su command could have resolved this?
Thanks
 
Old 09-19-2009, 03:02 PM   #7
brojard
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I was wrong. The problem was not resolved - completely. It is true that using services to start the app worked after I re initdb'd the server as described above. But, apparently there is a difference between using the system-config-services gui and rebooting the operating system or starting the OS from scratch. Because rebooting or restarting the system continues to report that postmaster couldn't access the postgresql.conf file 'permission denied'

# more /var/log/messages | grep postmaster
provided this:

Sep 19 14:22:14 localhost setroubleshoot: SELinux is preventing postmaster (postgresql_t) "getattr" to /var/lib/pgsql/data/postgresql.conf (var_lib_t). For complete SELinux messages. run sealert -l 286874b6-b78a-4faf-91b6-98bbe29306cf

# sealert -l 286874b6-b78a-4faf-91b6-98bbe29306cf
[root@Archimedes ~]# sealert -l 286874b6-b78a-4faf-91b6-98bbe29306cf

Summary:

SELinux is preventing postmaster (postgresql_t) "getattr" to
/var/lib/pgsql/data/postgresql.conf (var_lib_t).

Detailed Description:

SELinux denied access requested by postmaster.
/var/lib/pgsql/data/postgresql.conf may be a mislabeled.
/var/lib/pgsql/data/postgresql.conf default SELinux type is postgresql_db_t, but
its current type is var_lib_t. Changing this file back to the default type, may
fix your problem.

File contexts can be assigned to a file in the following ways.

* Files created in a directory receive the file context of the parent
directory by default.
* The SELinux policy might override the default label inherited from the
parent directory by specifying a process running in context A which creates
a file in a directory labeled B will instead create the file with label C.
An example of this would be the dhcp client running with the dhclient_t type
and creates a file in the directory /etc. This file would normally receive
the etc_t type due to parental inheritance but instead the file is labeled
with the net_conf_t type because the SELinux policy specifies this.
* Users can change the file context on a file using tools such as chcon, or
restorecon.

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.

Allowing Access:

You can restore the default system context to this file by executing the
restorecon command. restorecon '/var/lib/pgsql/data/postgresql.conf', if this
file is a directory, you can recursively restore using restorecon -R
'/var/lib/pgsql/data/postgresql.conf'.

Fix Command:

restorecon '/var/lib/pgsql/data/postgresql.conf'

Additional Information:

Source Context system_u:system_rostgresql_t:s0
Target Context unconfined_ubject_r:var_lib_t:s0
Target Objects /var/lib/pgsql/data/postgresql.conf [ file ]
Source postmaster
Source Path /usr/bin/postgres
Port <Unknown>
Host Archimedes
Source RPM Packages
Target RPM Packages
Policy RPM selinux-policy-3.6.12-82.fc11
Selinux Enabled True
Policy Type targeted
MLS Enabled True
Enforcing Mode Enforcing
Plugin Name restorecon
Host Name Archimedes
Platform Linux Archimedes 2.6.30.5-43.fc11.i686.PAE #1 SMP
Thu Aug 27 21:34:36 EDT 2009 i686 i686
Alert Count 40
First Seen Sat Sep 12 16:25:20 2009
Last Seen Sat Sep 19 14:22:08 2009
Local ID 286874b6-b78a-4faf-91b6-98bbe29306cf
Line Numbers

Raw Audit Messages

node=Archimedes type=AVC msg=audit(1253384528.356:10): avc: denied { getattr } for pid=1527 comm="postmaster" path="/var/lib/pgsql/data/postgresql.conf" dev=dm-0 ino=131293 scontext=system_u:system_rostgresql_t:s0 tcontext=unconfined_ubject_r:var_lib_t:s0 tclass=file

*************************************************************
WOW that is very cool - it told me exactly what to do:

So for good measure I added this line at the beginning of the
start() routine (in /etc/rc.d/init.d/postgresql):


[ -x /sbin/restorecon ] && /sbin/restorecon -R "$PGDATA"


I now have postgresql running when the system boots or restarts.

*************************

Does anyone know why system-config-services was able to start the service but reboot and system start up were not?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I disable graphical boot on FC11 SimGuy Fedora 22 10-13-2009 02:05 AM
System boot failure after installation of fedora fc11 in dual boot with windows xp npsdevan Fedora - Installation 1 08-10-2009 04:45 AM
yum update fails after FC6->FC9->FC11 upgrade on MySQL-server rpm ericcarlson Fedora 1 07-08-2009 01:06 PM
GPM mouse server fails on boot startup and disables keyboard!! linuxgeek01 Linux - General 1 10-30-2006 09:51 AM
Postgresql FAILS at boot (used to work...) lhoff Linux - Newbie 1 03-06-2002 09:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration