Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 10367 - Postgresql 7.2.3-r1 ebuild adds postgres user with shell /bin/false
Summary: Postgresql 7.2.3-r1 ebuild adds postgres user with shell /bin/false
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
: 9829 11276 14294 15701 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-07 01:31 UTC by Andres Toomsalu
Modified: 2007-09-22 23:09 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Toomsalu 2002-11-07 01:31:38 UTC
Postgresql 7.2.3-r1 ebuild adds postgres user with shell '/bin/false' which
makes starting postgresql database with postgresql init script impossible (it
can't do 'su - postgres'). Shell has to be changed manually to /bin/sh for
example. Strange that ebuild contains 'useradd -g postgres -s /bin/bash -d
/var/lib/postgresql -c "postgres" postgres' but still postgres user gets
'/bin/false' for shell.
Comment 1 Ryan Phillips (RETIRED) gentoo-dev 2002-11-07 22:22:44 UTC
Eric: Does this line work for you?
sudo -u ${PGUSER} "${EXE} ${PGOPTS} -p ${PGPORT} 2>&1" | logger -p
${FACILITY}.notice 1>&2 &
Comment 2 Mike Hostetler 2002-11-19 15:55:44 UTC
I have the same problem.  The above start-up command does not work.
Comment 3 Ryan Hoegg 2002-11-25 15:13:11 UTC
I had this same problem.  However, changing the shell to /bin/true worked for me.

YMMV
Comment 4 Ryan Hoegg 2002-11-25 16:33:03 UTC
Actually that didn't work but the init script returns "ok".

So I set the postgres shell to /bin/bash in /etc/passwd and tried:
# PGDATA=/var/lib/postgres sudo -u postgres "/usr/bin/postgres"

and got back:
FATAL 1: File /var/lib/postgresql/PG_VERSION is missing.  This is not a valid
data directory.

I think the ebuild left out the initdb step.  I manually did this:

# su - postgres -c "/usr/bin/initdb -D $PGDATA"

Now everything starts up fine.  I'd love it if I could make the shell for my
postgres user something safe, so please let me know your thoughts.  I can set
the shell to /bin/true and the following works:

# sudo -u postgres /usr/bin/pg_ctl start -D $PGDATA -s -l $PGLOG

However if I try /etc/init.d/postgresql start I get no postmaster processes. 
Furthermore, /etc/init.d/postgresql start and stop cease to work. Start says I
already have it running and stop says there's nothing there!

I know very little about ebuilds or the Gentoo startup scripts having installed
5 days ago.  If anyone has an idea why the user's shell matters for the init
script but not for a manual startup, please pass it along.
Comment 5 Ryan Phillips (RETIRED) gentoo-dev 2002-11-26 17:23:08 UTC
Can anyone provide a patch to the ebuild to make it so that the database directory is owned by postgres w/ /bin/false as the shell? 
Comment 6 Eric Renfro 2002-12-06 10:53:40 UTC
I agree. There should be an initdb phase, BUT WITH CHECKS, to see if it already
exists, or not, based on the conf.d/postgresql PGDATA variable.

Second, yes, /bin/true would work. However, even the postgresql maintainers
themselves suggest a real shell, since you will have to use that account for
managing postgresql itself, anyway.

This is not unlike other powerful RDBMs, including Oracle and IBM DB2.
Comment 7 Ryan Phillips (RETIRED) gentoo-dev 2003-01-31 16:49:46 UTC
*** Bug 11276 has been marked as a duplicate of this bug. ***
Comment 8 David E.Miller 2003-07-06 21:21:12 UTC
Experienced the same problem described in this bug. Used Webmin to look at server data. Webmin Gentoo module for PostgreSQL shows /var/lib/postgresql as the $PGDATA directory("Path to host access config file", that is, pg_hba.conf. Changed this entry to: "/var/lib/postgresql/data/pg_hba.conf" and then used Webmin Users and Groups to modify the user postgres to use /bin/bash as the shell. Went back to Webmin PostgreSQL server admin page and started PostgreSQL from there. Checked processes and postmaster is now running.

After "emerge postgresql" is conplete you have to run:

ebuild /usr/portage/dev-db/postgresql/postgresql-7.3.3.ebuild config

to set up postgreSQL properly.

There is a message at the conpletion of the emerge for PostgreSQL that directs you to do this and a second message to ensure that the user postgres in the /etc/passwd file has /bin/bash or /bin/true set as the shell.
Comment 9 Martin Holzer (RETIRED) gentoo-dev 2003-07-09 12:10:42 UTC
*** Bug 9829 has been marked as a duplicate of this bug. ***
Comment 10 Martin Holzer (RETIRED) gentoo-dev 2003-07-09 12:40:39 UTC
*** Bug 14294 has been marked as a duplicate of this bug. ***
Comment 11 Martin Holzer (RETIRED) gentoo-dev 2003-07-09 12:50:10 UTC
*** Bug 15701 has been marked as a duplicate of this bug. ***
Comment 12 Paul Tötterman 2003-07-17 05:32:07 UTC
Seems this is fixed, based on comment #8. Is this true?
Comment 13 Charles Goodwin 2003-10-08 05:24:27 UTC
If this bug isn't fixed, it should be.  If it is, it should be closed.  Besides,
we're onto Postgres 7.3.x these days.
Comment 14 Martin Holzer (RETIRED) gentoo-dev 2003-10-12 15:18:01 UTC
closing as fixed