Thread: Startup problem

Startup problem

From
"Alexandre Becquereau"
Date:
Hello,
 
    I have a problem running Postgres at startup. I use the start-scripts/linux script in /etc/rc.local. The script is executed on boot but the system ask a question :
 
" Your default context is user_u:system_r:unconfined_t Do you want to choose a different one? [n] "
If I do not answer the system wait several seconds and then continue boot (but I can't login except by connecting on ssh). Once I login I have to kill the start-scripts/linux process and launch it manually. When the script is manually launched the question is never asked
 
The answer to the question will always be no... I would like to know how to avoid this question, this machine will be rebooted remotely so I won't be able to type n !
 
The postgres version is 8.2.1 running on RedHat Enterprise Edition ES 4
 
I previously used a 7.6 version on Fedora Core 3 and there was no problem launching it on boot.
 
 
Thank you for your help!
 
Alex BECQUEREAU
--
SafeLogic
 

Re: Startup problem

From
Devrim GUNDUZ
Date:
Hi,

On Mon, 2007-01-22 at 12:20 +0100, Alexandre Becquereau wrote:
> " Your default context is user_u:system_r:unconfined_t Do you want to
> choose a different one? [n] "

This is a SELinux issue. I haven't used SELinux until now; but you
should either play with your SELinux policies or disable it. I'm sure
some people may give a better answer.

Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/




Attachment

Re: Startup problem

From
Tom Lane
Date:
"Alexandre Becquereau" <alex@safelogic.com> writes:
>     I have a problem running Postgres at startup. I use the
> start-scripts/linux script in /etc/rc.local.

The one in our contrib/?  That's pretty old, crufty, and unmaintained.
The one most people actually use on RPM-based systems is the one that
comes with our RPM distribution ... is there a reason you're not using
the RPM?

Anyway I would guess the problem comes from the fact that the contrib
script uses "su".  The RPM script doesn't:

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
    SU=runuser
else
    SU=su
fi

and eventually

    $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null

but you really ought to adopt the whole script not just that one bit.

> I previously used a 7.6 version on Fedora Core 3 and there was no problem
> launching it on boot.

I believe FC3 didn't have SELinux security ... it certainly didn't have
it enabled by default.

            regards, tom lane

Re: Startup problem

From
"Alexandre Becquereau"
Date:
Thank you, i replaced the su command by runuser and everything works
perfectly now!

 Regards,

Alexandre BECQUEREAU
--
SafeLogic
www.safelogic.com
www.pgeep.com


-----Message d'origine-----
De : Tom Lane [mailto:tgl@sss.pgh.pa.us]
Envoyé : lundi 22 janvier 2007 17:10
À : Alexandre Becquereau
Cc : pgsql-admin@postgresql.org
Objet : Re: [ADMIN] Startup problem

"Alexandre Becquereau" <alex@safelogic.com> writes:
>     I have a problem running Postgres at startup. I use the
> start-scripts/linux script in /etc/rc.local.

The one in our contrib/?  That's pretty old, crufty, and unmaintained.
The one most people actually use on RPM-based systems is the one that comes
with our RPM distribution ... is there a reason you're not using the RPM?

Anyway I would guess the problem comes from the fact that the contrib script
uses "su".  The RPM script doesn't:

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
    SU=runuser
else
    SU=su
fi

and eventually

    $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA'
${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null

but you really ought to adopt the whole script not just that one bit.

> I previously used a 7.6 version on Fedora Core 3 and there was no
> problem launching it on boot.

I believe FC3 didn't have SELinux security ... it certainly didn't have it
enabled by default.

            regards, tom lane



Re: Startup problem

From
Ray Stell
Date:
On Mon, Jan 22, 2007 at 11:10:27AM -0500, Tom Lane wrote:
>
> but you really ought to adopt the whole script not just that one bit.


where is the is script to be found?  Nothing extracts to /etc/init.d

[stellr@stell postgresql]$ rpm -qlp postgresql-8.2.1-1PGDG.i686.rpm
/usr/bin/clusterdb
/usr/bin/createdb
/usr/bin/createlang
/usr/bin/createuser
/usr/bin/dropdb
/usr/bin/droplang
/usr/bin/dropuser
/usr/bin/pg_dump
/usr/bin/pg_dumpall
/usr/bin/pg_restore
/usr/bin/psql
/usr/bin/reindexdb
/usr/bin/vacuumdb
/usr/share/doc/postgresql-8.2.1
/usr/share/doc/postgresql-8.2.1/COPYRIGHT
...

Re: Startup problem

From
Ray Stell
Date:
found it:

[stellr@stell postgresql]$ rpm -qlp postgresql-server-8.2.1-1PGDG.i686.rpm
/etc/pam.d/postgresql
/etc/rc.d/init.d/postgresql







On Mon, Jan 22, 2007 at 01:20:21PM -0500, Ray Stell wrote:
> On Mon, Jan 22, 2007 at 11:10:27AM -0500, Tom Lane wrote:
> >
> > but you really ought to adopt the whole script not just that one bit.
>
>
> where is the is script to be found?  Nothing extracts to /etc/init.d
>
> [stellr@stell postgresql]$ rpm -qlp postgresql-8.2.1-1PGDG.i686.rpm
> /usr/bin/clusterdb
> /usr/bin/createdb
> /usr/bin/createlang
> /usr/bin/createuser
> /usr/bin/dropdb
> /usr/bin/droplang
> /usr/bin/dropuser
> /usr/bin/pg_dump
> /usr/bin/pg_dumpall
> /usr/bin/pg_restore
> /usr/bin/psql
> /usr/bin/reindexdb
> /usr/bin/vacuumdb
> /usr/share/doc/postgresql-8.2.1
> /usr/share/doc/postgresql-8.2.1/COPYRIGHT
> ...

--
You have no chance to survive make your time.