Bug 124024 - PostgreSQL wont start up if postgres user's shell is not sh-like
PostgreSQL wont start up if postgres user's shell is not sh-like
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-22 20:07 EDT by James Turner
Modified: 2013-07-02 23:01 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-06-23 19:01:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Turner 2004-05-22 20:07:51 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040404 Firefox/0.8

Description of problem:
PostgreSQL failed to start up after an upgrade from Fedora Core 2 from
Fedora Core 1. Init scripts failing, reporting "Ambiguous output
redirect." error.

The init scripts initially reported that an old database format was
found, which needed to be manually upgraded. Renamed the
/var/lib/pgsql directory as a temporary measure to test the new
server. Ran the command "service postgresql start" and got "Ambiguous
output redirect." message, server didn't start or initialise a fresh
database.

Problem fixed itself following re-installation of PostgreSQL:

rpm -e --nodeps postgresql-server
rm -rf /var/lib/pgsql
rpm -Uvh postgresql-server-7.4.2-1.i386.rpm

I got it working in the end, but it may be a potential problem area
for other users. (?)

Version-Release number of selected component (if applicable):
postgresql-server-7.4.2-1 initscripts-7.53-1 bash-2.05b-38

How reproducible:
Didn't try

Steps to Reproduce:
Not sure how easily reproducible this is, but:

 - Running PostgreSQL fine on Fedora Core 1
 - Upgraded to Fedora Core 2
 - PostgreSQL stopped working, as described above

Actual Results:  When startup script is run (including boot-up), after
removing old databases:

Initializing database: Ambiguous output redirect.
                                                           [FAILED]
Starting postgresql service: Ambiguous output redirect.
                                                           [FAILED]

Expected Results:  Initializing database:                            
        [  OK  ]
Starting postgresql service:                                         
                                          [  OK  ]


Additional info:

The error accompanying "initializing database" comes from the line:

su -l postgres -c "/usr/bin/initdb --pgdata=$PGDATA > /dev/null 2>&1"
< /dev/null

The error accompanying "starting postgresql service" comes from the line:

su -l postgres -c "/usr/bin/pg_ctl  -D $PGDATA -p /usr/bin/postmaster
-o '-p ${PGPORT} ${PGOPTS}' start  > /dev/null 2>&1" < /dev/null
Comment 1 Tom Lane 2004-05-22 20:33:20 EDT
The only theory that comes to mind is that you had a nonstandard shell
(csh or some other non-sh-syntax shell) selected for the postgres user
in your FC1 installation.  The remove/reinstall would have fixed it by
deleting and recreating the postgres user's /etc/passwd entry.  Does
this sound right at all?

The previous version of the init script would work anyway because it
included "-s /bin/sh" in the su commands, but that was removed
recently on the grounds that people wanted the postgres user's normal
profile (eg, .bash_profile) to get read when starting the postmaster.
 Possibly we could compromise by putting the /dev/null output
redirection outside the su -c command.
Comment 2 Flavio Cardone 2004-05-23 11:11:06 EDT
I also got the warning that PostgreSQL could not start the database
because an old version was there. Renamed /var/lib/pgsql and used
"service start". PostgreSQL started OK. But how to upgrade/use the old
database?
Comment 3 James Turner 2004-05-26 13:23:08 EDT
I use tcsh as shell for both my normal account and root, but don't
remember changing it for postgres. It seems unlikely that I did, as
it's very seldom I have reason to su to postgres.

For an answer to Flavio Cardone's query, see:

http://www.postgresql.org/docs/7.4/static/install-upgrading.html

I presume Flavio would have to temporarily revert to the old version
in order to dump the databases.
Comment 4 Tom Lane 2004-05-26 17:50:21 EDT
Well, indeed if I change the postgres user's shell to tcsh, I get the
same symptoms you describe, so I'm pretty sure that must be what you
did.  I'll look into fixing the initscript to defend against this
without losing the other feature.
Comment 5 Tom Lane 2004-06-23 19:01:30 EDT
Fixed in postgresql 7.4.3-1.

Note You need to log in before you can comment on or make changes to this bug.