Обсуждение: PostgresSQL Halting System Boot

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

PostgresSQL Halting System Boot

От
Matias Silva
Дата:
Hi everyone, I'm totally new here and I got a little issue.
I just got done installing PostgreSQL 8.1.  I have configured PostgreSQL
to start automatically upon system start via an init script.  Problem
is that when CentOS boots it halts on "Starting PostgeSQL".  I have
to press the <Enter> key to resume the boot.  It doesn't time out either.

How do I fix this?

I check the PostgreSQL logs and the only thing that stands out is
"Do you want to choose a different one? [n]Your default context is
user_u:system_r:unconfined_t.". However when I search Google, I find
nothing.

Thanks for your time,
Matt

Re: PostgresSQL Halting System Boot

От
Richard Huxton
Дата:
Matias Silva wrote:
> Hi everyone, I'm totally new here and I got a little issue.
> I just got done installing PostgreSQL 8.1.  I have configured PostgreSQL
> to start automatically upon system start via an init script.  Problem
> is that when CentOS boots it halts on "Starting PostgeSQL".  I have
> to press the <Enter> key to resume the boot.  It doesn't time out either.
>
> How do I fix this?
>
> I check the PostgreSQL logs and the only thing that stands out is
> "Do you want to choose a different one? [n]Your default context is
> user_u:system_r:unconfined_t.". However when I search Google, I find
> nothing.

This sounds like something to do with selinux, which Redhat build in to
their more recent offerings. I'm afraid I don't know enough about it to
give you specific advice, but you should be able to find out more by
checking the archives and googling.

--
   Richard Huxton
   Archonet Ltd

Re: PostgresSQL Halting System Boot

От
Jerry Sievers
Дата:
Matias Silva <matiassilva@gmail.com> writes:

> How do I fix this?
>
> I check the PostgreSQL logs and the only thing that stands out is
> "Do you want to choose a different one? [n]Your default context is
> user_u:system_r:unconfined_t.". However when I search Google, I find
> nothing.

Dunno the actual cause.  Someone else will.

Ok, so if you start the server again after booting you're going to get
prompted the same way.  Try starting it with logging NOT directed to a
file.

$ su - postgres
$ pg_ctl start

Should prompt you.  Now see if redirecting the null file to stdin lets
the server start without waiting.

$ pg_ctl start </dev/null

Or...

$ echo n | pg_ctl start

If any of these workarounds suffice, edit them into your
/etc/init.d/postgresql script.

HTH

--
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile    http://www.JerrySievers.com/

Re: PostgresSQL Halting System Boot

От
Matias Silva
Дата:
Richard Huxton wrote:
> Matias Silva wrote:
>> Hi everyone, I'm totally new here and I got a little issue.
>> I just got done installing PostgreSQL 8.1.  I have configured PostgreSQL
>> to start automatically upon system start via an init script.  Problem
>> is that when CentOS boots it halts on "Starting PostgeSQL".  I have
>> to press the <Enter> key to resume the boot.  It doesn't time out either.
>>
>> How do I fix this?
>>
>> I check the PostgreSQL logs and the only thing that stands out is
>> "Do you want to choose a different one? [n]Your default context is
>> user_u:system_r:unconfined_t.". However when I search Google, I find
>> nothing.
>
> This sounds like something to do with selinux, which Redhat build in to
> their more recent offerings. I'm afraid I don't know enough about it to
> give you specific advice, but you should be able to find out more by
> checking the archives and googling.
>

When logged in as root, I stop and start PostgreSQL by using the init script
and it doesn't halt on startup.  So I decided switch to the postgres user
(su - postgres) and stat PostgreSQL (pg_ctl start -D ../data).  Upon
start up it echos the log entry and waits for an enter key.

I notice the init script switches user.

   start)
         $ECHO_N "Starting PostgreSQL: "$ECHO_C
         su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
         echo "ok"
         ;;

Below is me switching user and starting the database and the blank
line is where I hit enter.

[root@CentOSVmware bin]# service postgresql stop
Stopping PostgreSQL: postmaster stopped
ok
[root@CentOSVmware bin]# su - postgres
-bash-3.00$ ./pg_ctl start -sD ../data
-bash-3.00$ LOG:  database system was shut down at 2005-12-02 19:11:28 PST
LOG:  checkpoint record is at 0/33B110
LOG:  redo record is at 0/33B110; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 588; next OID: 16385
LOG:  next MultiXactId: 1; next MultiXactOffset: 0
LOG:  database system is ready
LOG:  transaction ID wrap limit is 2147484146, limited by database "postgres"

-bash-3.00$ ./pg_ctl stop -sD ../data
LOG:  received smart shutdown request
LOG:  shutting down
LOG:  database system is shut down
postmaster stopped
-bash-3.00$ exit

Now that I know whats causing it how do I stop it, I don't know enough stop it.

Thanks for your time,
Matt

Re: PostgresSQL Halting System Boot

От
Tom Lane
Дата:
Matias Silva <matiassilva@gmail.com> writes:
> I just got done installing PostgreSQL 8.1.  I have configured PostgreSQL
> to start automatically upon system start via an init script.  Problem
> is that when CentOS boots it halts on "Starting PostgeSQL".  I have
> to press the <Enter> key to resume the boot.  It doesn't time out either.

> I notice the init script switches user.

>    start)
>          $ECHO_N "Starting PostgreSQL: "$ECHO_C
>          su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
>          echo "ok"
>          ;;

Hm, where did this init script come from?  Last I heard, CentOS was a
direct ripoff^H^H^H^H^H^Hrepackaging of Red Hat, but the RH initscript
for Postgres doesn't look like that.

In any case, the Postgres community isn't in a position to support other
vendors' repackagings of Postgres.  I suggest trying the initscript from
the PGDG RPMs (if not the entire RPM package...) --- that one we can at
least answer questions about.

            regards, tom lane

Re: PostgresSQL Halting System Boot

От
Steve Atkins
Дата:
On Sat, Dec 03, 2005 at 12:38:16PM -0500, Tom Lane wrote:
> Matias Silva <matiassilva@gmail.com> writes:
> > I just got done installing PostgreSQL 8.1.  I have configured PostgreSQL
> > to start automatically upon system start via an init script.  Problem
> > is that when CentOS boots it halts on "Starting PostgeSQL".  I have
> > to press the <Enter> key to resume the boot.  It doesn't time out either.
>
> > I notice the init script switches user.
>
> >    start)
> >          $ECHO_N "Starting PostgreSQL: "$ECHO_C
> >          su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
> >          echo "ok"
> >          ;;
>
> Hm, where did this init script come from?  Last I heard, CentOS was a
> direct ripoff^H^H^H^H^H^Hrepackaging of Red Hat, but the RH initscript
> for Postgres doesn't look like that.

That is the init script distributed with postgresql -
contrib/start-scripts/linux.

That's the one I use in production and it works just fine.

> In any case, the Postgres community isn't in a position to support other
> vendors' repackagings of Postgres.  I suggest trying the initscript from
> the PGDG RPMs (if not the entire RPM package...) --- that one we can at
> least answer questions about.

The original error smelled like an SELinux issue, rather than anything
to do with the startup scripts, but I'm not that familiar with SELinux
(I turn it off as part of the installation) so I can't say for sure.

Cheers,
  Steve