Bug 190271 - Installing the postgresql package does not create the postgres sql user
Summary: Installing the postgresql package does not create the postgres sql user
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Lane
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-04-29 21:18 UTC by Chris Jones
Modified: 2013-07-03 03:09 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-01-12 13:13:02 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Chris Jones 2006-04-29 21:18:21 UTC
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 22:08:53 UTC
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 06:44:13 UTC
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 06:57:48 UTC
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 07:16:04 UTC
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 07:26:22 UTC
I dont think so, the selinux errrors only apear when you actualy start the server.

Comment 6 Daniel Walsh 2006-05-01 19:05:04 UTC
Were there any AVC messages during the install?

Comment 7 Chris Jones 2006-05-02 09:17:30 UTC
Nope, no messages during the install.

Comment 8 Chris Jones 2006-07-22 10:49:40 UTC
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 17:10:03 UTC
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 13:13:02 UTC
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.