Bug 190271 - Installing the postgresql package does not create the postgres sql user
Installing the postgresql package does not create the postgres sql user
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-29 17:18 EDT by Chris Jones
Modified: 2013-07-02 23:09 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-01-12 08:13:02 EST
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 Chris Jones 2006-04-29 17:18:21 EDT
Description of problem:
Installing the postgresql-server package does not create the postgres sql user

Version-Release number of selected component (if applicable):
8.1.3-1

How reproducible:
Allways

Steps to Reproduce:
1. yum groupinstall "PostgreSQL Database"
2. /etc/init.d/postgresql restart
3.
  
Actual results:
From Yum...
  Installing: postgresql-server            ########################  [5/7]warning: user postgres does 
not exist - using root
warning: group postgres does not exist - using root
  Installing: postgresql-server            ########################  [5/7]warning: user postgres does 
not exist - using root
warning: group postgres does not exist - using root
  Installing: postgresql-server            ########################  [5/7]warning: user postgres does 
not exist - using root
warning: group postgres does not exist - using root
  Installing: postgresql-server            ########################  [5/7]warning: user postgres does 
not exist - using root
warning: group postgres does not exist - using root

When Trying to start postgres
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log': File exists
chown: `postgres:postgres': invalid user
                                                           [FAILED]
Starting postgresql service:                               [FAILED]


Expected results:
User gets created, Server starts

Additional info:
Fresh install of fc5, with all present updates applied.
Comment 1 Tom Lane 2006-04-29 18:08:53 EDT
The RPM certainly tries to create that user --- its "%pre server" script does

groupadd -g 26 -o -r postgres

useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash -c "PostgreSQL Server" -u 26 postgres

I notice it ignores any errors from them though :-( ... probably to deal with the case where the user and 
group already exist.

What happens if you try to do those commands by hand (as root)?
Comment 2 Chris Jones 2006-04-30 02:44:13 EDT
When i remove the server packages, manualy add the user, and then reinstall the server packages, it 
works.

The package manages to create the group, but not the user, it manages to remove both group and user on 
uninstall.
Comment 3 Chris Jones 2006-04-30 02:57:48 EDT
Additonly starting the server generates the following selinux errors, 
Apr 30 08:02:42 newsilver kernel: audit(1146380562.762:16): avc:  denied  { append } for  pid=3301 
comm="hostname" name="pgstartup.log" dev=sda3 ino=13978277 scontext
=user_u:system_r:hostname_t:s0 tcontext=system_u:object_r:postgresql_log_t:s0 tclass=file
Apr 30 08:02:42 newsilver kernel: audit(1146380562.794:17): avc:  denied  { append } for  pid=3316 
comm="hostname" name="pgstartup.log" dev=sda3 ino=13978277 scontext
=user_u:system_r:hostname_t:s0 tcontext=system_u:object_r:postgresql_log_t:s0 tclass=file
Apr 30 08:02:46 newsilver kernel: audit(1146380566.416:18): avc:  denied  { append } for  pid=3367 
comm="hostname" name="pgstartup.log" dev=sda3 ino=13978277 scontext
=user_u:system_r:hostname_t:s0 tcontext=system_u:object_r:postgresql_log_t:s0 tclass=file
Apr 30 08:02:46 newsilver kernel: audit(1146380566.448:19): avc:  denied  { append } for  pid=3382 
comm="hostname" name="pgstartup.log" dev=sda3 ino=13978277 scontext
=user_u:system_r:hostname_t:s0 tcontext=system_u:object_r:postgresql_log_t:s0 tclass=file
Comment 4 Tom Lane 2006-04-30 03:16:04 EDT
Hm ... I'm baffled but am thinking SELinux might have blocked the initial useradd step somehow.
Dan, any troubleshooting suggestions?
Comment 5 Chris Jones 2006-04-30 03:26:22 EDT
I dont think so, the selinux errrors only apear when you actualy start the server.
Comment 6 Daniel Walsh 2006-05-01 15:05:04 EDT
Were there any AVC messages during the install?
Comment 7 Chris Jones 2006-05-02 05:17:30 EDT
Nope, no messages during the install.
Comment 8 Chris Jones 2006-07-22 06:49:40 EDT
Right, After having a simular problem trying to install a differant package
(openldap-servers) I've taken a closer look at this machine. I think the problem
may be due to the login.defs file being tweaked on this machine. 
Replaceing the tweaked login.defs with the .rpmnew version made the problem go
away for openldap-server, and i suspect it will do the same for postgresql.
Comment 9 Tom Lane 2006-08-21 13:10:03 EDT
Would you confirm whether or not that was the problem?  I'd like to close this bug if it was just a problem 
with a broken login.defs file.
Comment 10 Chris Jones 2007-01-12 08:13:02 EST
The machine in question is now in use. Thus i have no way to test if this solved
the problem.

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