This forum is no longer active. Please post your questions to our new community site

Forums LAPPStack

Problem with PostgreSQL

Subscribe to Problem with PostgreSQL 4 post(s), 2 voice(s)

 
Avatar shumilov 2 post(s)

Hi,

after successfull installation of lapp-1.1 on SuSE 10.2
i can not start it properly. PostgreSQL can not start and
give the following message:


dbas1:/opt/lapp-1.1 # ./ctlscript.sh start
“root” execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.
/opt/lapp-1.1/postgresql/scripts/ctl.sh : postgresql could not be started
Syntax OK
/opt/lapp-1.1/apache2/scripts/ctl.sh : httpd started at port 80
dbas1:/opt/lapp-1.1 #

Thanx,
Serge

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

It seems that the main script are not changing to the postgres user to start the database. It seems a bug that we have to fix. Could you try to install the LAPP using another user instead of “root”?

Thanks for reporting it.

 
Avatar shumilov 2 post(s)

I can not install LAPP as an ordinal user in ”/opt”. This can make only root.

The problem is that PostgreSQL should be started from the user “postgres”. You have already changed in LAPP permissions of the postgres catalog, but probably forgot about the user in the script “lapp/posrgresql/scripts/ctl.sh”. Usually i am using this simple script to start postgresql. You can take particular commands and modify ctl.sh.

Note: Thanx to beltran for fixed formating. :)


# Installation prefix
prefix=/opt/pgsql

# Data directory
PGDATA="/opt/pgsql/data" 

# Who to run the postmaster as, usually "postgres".  (NOT "root")
PGUSER=postgres

# Where to keep a log file
PGLOG="$PGDATA/serverlog" 

## STOP EDITING HERE

# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster" 

# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl" 

set -e

# Only start if we can find the postmaster.
test -x $DAEMON || exit 0

# Parse command line parameters.
case $1 in
  start)
        echo -n "Starting PostgreSQL: " 
        su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
        echo "ok" 
        ;;
  stop)
        echo -n "Stopping PostgreSQL: " 
        su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast" 
        echo "ok" 
        ;;
  restart)
        echo -n "Restarting PostgreSQL: " 
        su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w" 
        su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
        echo "ok" 
        ;;
  reload)
        echo -n "Reload PostgreSQL: " 
        su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s" 
        echo "ok" 
        ;;
  status)
        su - $PGUSER -c "$PGCTL status -D '$PGDATA'" 
        ;;
  *)
        # Print help
        echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
        exit 1
        ;;
esac
exit 0

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

Post fixed. You can use the following tags to show code < pre > < code > CODE < / pre > < / code> . Thanks a lot for posting a solution, we will fix this issue for the next version.

Forums LAPPStack