# postgre not starting

## numerodix

I merged dev-db/postgresql-7.3 and ran ebuild /usr/portage/dev-db/postgresql/postgresql-version config. But I can't seem to be able to start the server. Running /etc/init.d/postgresql start shows a fail code but no error message. Also, there are no logs, the path declared in the conf  file at /etc/conf.d/postgresql (/var/lib/postgresql/data/postgresql.log) doesn't exist (file isn't there) so I've no idea how to retrieve the error message.

/etc/conf.d/postgresql

```

# PostgreSQL's Database Directory

PGDATA=/var/lib/postgresql/data

# Logfile path: (NOTE: This must be uid/gid owned by the value of $PGUSER!)

PGLOG=/var/lib/postgresql/data/postgresql.log

# Run the PostgreSQL user as:

PGUSER=postgres

# Extra options to run postmaster with.

# If you want to enable TCP/IP for PostgreSQL, add -i to the following:

PGOPTS="-N 1024 -B 2048"

```

/etc/init.d/postgresql

```

depend() {

        need net

}

start() {

        ebegin "Starting postgres"

        su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'"

        eend $?

}

stop () {

        ebegin "Stopping postgres"

        su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast"

        eend $?

}

svc_restart () {

        ebegin "Restarting postgres"

        su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'"

        eend $?

}

```

Running the command from the init file above on the command line gives no return value but it still doesn't start the server. 

I tried running /usr/bin/pg_ctl status -D '/var/lib/postgresql/data' and it tells me the server isn't running but I still don't know why.

*help*

----------

## fzylogic

I'm having the same problem after installing.

anybody have any clues?

----------

## numerodix

Yes I do. I fixed it. Postgre has to run as an underpriviliged user and the install script sets up user "postgres" with shell "/bin/false", which is the problem here. Because of the nature of the problem, you'll never get any error messages, it just will do nothing. In /etc/passwd, change the shell for postgres to "/bin/bash" for instance, and you should be good to go.

And it took me two days to find this out, reading all kinds of documentation, faqs and mailing lists, none of which mentioned it. I should have tried the bugzilla (https://bugs.gentoo.org/), that's where I found the solution.

----------

## phong

It's bug #10367 for future reference.

----------

## tyreth

There is a recommendation to use either /bin/bash or /bin/true, but the latter didn't work for me, so if you're still having trouble and used /bin/true try /bin/bash.

----------

## aureq

I have a completly new pgsql install

I have tried with /bin/true and it doesn't works.

So you have to use /bin/bash. I think PG need

a valid shell, why ...? I don't no.

----------

## sirwally

> So you have to use /bin/bash. I think PG need

> a valid shell, why ...? I don't no.

I assume because the daemon needs to run as the postgres user, and if the postgres user can't login, then it can't run anything.....I am not sure....I would rather that the user can't login.....No biggie, I guess.

----------

