Обсуждение: staring pgsql on fedora 8

Поиск
Список
Период
Сортировка

staring pgsql on fedora 8

От
newbiegalore
Дата:
Hello everyone :-) ,
                              I've just started to get to grips with
pgsql and am facing a small issue. I would appreciate any pointers /
ideas about how to get around it :-) .

When I installed FC8 on my machine, I installed the pgsql package via
the package installer, and then tried to start the service by using
the service manager. The message I got was "you need to initalize the
cluster first run service postgresql initdb"

When I use this command $> service postgresql initdb  nothing really
happens. The display says, initializing database and then nothing.
I've waited for 10 minutes at a stretch and CPU/memory utilization
doesn't seem to be going out of the window implying some major
processing of some sort..!

If I use $>service postgresql restart I get Stopping postgresql
service: and then nothing, the processing does not finish.

Extra info: I ran the command as root, I plan to change to another
user when I get the db going to create and use the db.

Thanks in advance for any help,
-A

Re: staring pgsql on fedora 8

От
Tom Lane
Дата:
newbiegalore <banerjee.anirban@gmail.com> writes:
> When I use this command $> service postgresql initdb  nothing really
> happens. The display says, initializing database and then nothing.
> I've waited for 10 minutes at a stretch and CPU/memory utilization
> doesn't seem to be going out of the window implying some major
> processing of some sort..!

Shouldn't take more than a minute to finish initdb, even on very slow
hardware.  Have you looked to see if anything gets created under
/var/lib/pgsql/?  In particular, if /var/lib/pgsql/pgstartup.log
exists, looking into that file might tell you something.

I'm assuming you're using the standard Fedora RPMs for PG, which
at this writing are
postgresql-libs-8.2.6-1.fc8
postgresql-8.2.6-1.fc8
postgresql-server-8.2.6-1.fc8
(There are more but this is the minimum set to run a postmaster.)

            regards, tom lane

Re: staring pgsql on fedora 8

От
newbiegalore
Дата:
On Mar 6, 10:12 pm, t...@sss.pgh.pa.us (Tom Lane) wrote:
> newbiegalore <banerjee.anir...@gmail.com> writes:
> > When I use this command $> service postgresql initdb  nothing really
> > happens. The display says, initializing database and then nothing.
> > I've waited for 10 minutes at a stretch and CPU/memory utilization
> > doesn't seem to be going out of the window implying some major
> > processing of some sort..!
>
> Shouldn't take more than a minute to finish initdb, even on very slow
> hardware.  Have you looked to see if anything gets created under
> /var/lib/pgsql/?  In particular, if /var/lib/pgsql/pgstartup.log
> exists, looking into that file might tell you something.
>
> I'm assuming you're using the standard Fedora RPMs for PG, which
> at this writing are
> postgresql-libs-8.2.6-1.fc8
> postgresql-8.2.6-1.fc8
> postgresql-server-8.2.6-1.fc8
> (There are more but this is the minimum set to run a postmaster.)
>
>                         regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

hey! thanks for the reply :-). I looked into the pgstartup.log file
and everything seems to have worked perfectly with the msg at the end
saying "Success: you can now start...."

but when I try to start it as a normal user using su normaluser my
computer just hangs.. arrrrgh!!!!
I can't even log in via ssh as a normal user. I found the exact
problem described at http://www.computing.net/linux/wwwboard/forum/29077.html
and at http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12082
but the solution is vague to me and using sudo doesn't help either.

I think it must all be related to permissions of some kind. Thanks for
the tip anyway :-) .
-A

Re: staring pgsql on fedora 8

От
Tom Lane
Дата:
newbiegalore <banerjee.anirban@gmail.com> writes:
> hey! thanks for the reply :-). I looked into the pgstartup.log file
> and everything seems to have worked perfectly with the msg at the end
> saying "Success: you can now start...."

> but when I try to start it as a normal user using su normaluser my
> computer just hangs.. arrrrgh!!!!

Try to start *what* as a normal user?

If you mean the Postgres postmaster, you're not supposed to start it as
a normal user; it has to run as the user "postgres" because of the
permissions on the database files.  The usual way to start or stop
the postmaster in a standard RPM installation is "sudo /sbin/service
postgresql start" (vice "stop").  Once you've got that working you can
make the service start automatically at system boot (see chkconfig).

> I found the exact
> problem described at http://www.computing.net/linux/wwwboard/forum/29077.html
> and at http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12082
> but the solution is vague to me and using sudo doesn't help either.

If that's your problem then it's a generic issue having nothing much to
do with Postgres.  What it sounds like to me is a SELinux problem ...
if things magically start working after "sudo /usr/sbin/setenforce 0"
then that guess is confirmed.  I wouldn't recommend that as a permanent
solution though.  My best guess as to the cause is that you've got some
files that are labeled with the wrong SELinux context.  The solution
Red Hat recommends is

    touch /.autorelabel
    reboot

The presence of /.autorelabel causes the boot process to reset every
installed file's security label according to what the RPM database says
it should be (sort of like a fsck for permissions, and yeah it'll take a
little while).

            regards, tom lane

Re: staring pgsql on fedora 8

От
Tom Lane
Дата:
"Anirban Banerjee" <banerjee.anirban@gmail.com> writes:
> Wow! thanks for being super helpful, I will try it all out. Though I
> distinctly remember turning off SElinux because it was giving me such a
> headache even in permissive mode.

Yeah, Red Hat has spent quite some time now filing the rough edges off
SELinux :-(.  I've found that Fedora 8 seems to have it mostly right,
though --- I don't recall hitting any SELinux problems, while back in
the bad old days of FC5 and FC6 I too kept it turned off.  If that was
when you got your bad impression of it, give it another chance.

But it still seems to be possible to have file permissions messed up
after installing packages, hence my suggestion to try a relabel.

            regards, tom lane

Re: staring pgsql on fedora 8

От
"Anirban Banerjee"
Дата:
Wow! thanks for being super helpful, I will try it all out. Though I distinctly remember turning off SElinux because it was giving me such a headache even in permissive mode.

Thanks again for the tips.
Regards,
-A

On Thu, Mar 6, 2008 at 10:17 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
newbiegalore <banerjee.anirban@gmail.com> writes:
> hey! thanks for the reply :-). I looked into the pgstartup.log file
> and everything seems to have worked perfectly with the msg at the end
> saying "Success: you can now start...."

> but when I try to start it as a normal user using su normaluser my
> computer just hangs.. arrrrgh!!!!

Try to start *what* as a normal user?

If you mean the Postgres postmaster, you're not supposed to start it as
a normal user; it has to run as the user "postgres" because of the
permissions on the database files.  The usual way to start or stop
the postmaster in a standard RPM installation is "sudo /sbin/service
postgresql start" (vice "stop").  Once you've got that working you can
make the service start automatically at system boot (see chkconfig).

> I found the exact
> problem described at http://www.computing.net/linux/wwwboard/forum/29077.html
> and at http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12082
> but the solution is vague to me and using sudo doesn't help either.

If that's your problem then it's a generic issue having nothing much to
do with Postgres.  What it sounds like to me is a SELinux problem ...
if things magically start working after "sudo /usr/sbin/setenforce 0"
then that guess is confirmed.  I wouldn't recommend that as a permanent
solution though.  My best guess as to the cause is that you've got some
files that are labeled with the wrong SELinux context.  The solution
Red Hat recommends is

       touch /.autorelabel
       reboot

The presence of /.autorelabel causes the boot process to reset every
installed file's security label according to what the RPM database says
it should be (sort of like a fsck for permissions, and yeah it'll take a
little while).

                       regards, tom lane



--
"The reason Santa is so jolly is because he knows where all the bad girls live."
-George Carlin