BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Started by Jamie Strachanabout 16 years ago9 messagesbugs
Jump to latest
#1Jamie Strachan
frostfreek@yahoo.com

The following bug has been logged online:

Bug reference: 5430
Logged by: Jamie Strachan
Email address: frostfreek@yahoo.com
PostgreSQL version: 8.4.3-2PGDG.el4
Operating system: CentOS 4
Description: initdb fails due to permissions of /usr/share/pgsql
Details:

Hello,

Downloaded the following RPM:
http://yum.pgsqlrpms.org/8.4/redhat/rhel-4-i386/postgresql-server-8.4.3-2PGD
G.el4.i386.rpm

for my CentOS 4 install.

service postgresql initdb fails with no error message.

So, I su'd to postgres, and ran

initdb --pgdata=/var/lib/pgsql/data --auth=ident
which is what service postgresql initdb does.
This command failed, with the error message:

could not open directory "/usr/share/pgsql/timezonesets"

I did a
chown -R postgres:postgres /usr/share/pgsql
and then it worked fine.

Using rpm2cpio {file} | cpio -tv
I see:
drwxr-xr-x 6 root root 0 Mar 17 16:21 ./usr/share/pgsql
which is fine, however there is no specific entry for
/usr/share/timezone.
The post-install script doesn't seem to fix it, either.

#2Bruce Momjian
bruce@momjian.us
In reply to: Jamie Strachan (#1)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Would you report this to the RPM maintainers?

---------------------------------------------------------------------------

Jamie Strachan wrote:

The following bug has been logged online:

Bug reference: 5430
Logged by: Jamie Strachan
Email address: frostfreek@yahoo.com
PostgreSQL version: 8.4.3-2PGDG.el4
Operating system: CentOS 4
Description: initdb fails due to permissions of /usr/share/pgsql
Details:

Hello,

Downloaded the following RPM:
http://yum.pgsqlrpms.org/8.4/redhat/rhel-4-i386/postgresql-server-8.4.3-2PGD
G.el4.i386.rpm

for my CentOS 4 install.

service postgresql initdb fails with no error message.

So, I su'd to postgres, and ran

initdb --pgdata=/var/lib/pgsql/data --auth=ident
which is what service postgresql initdb does.
This command failed, with the error message:

could not open directory "/usr/share/pgsql/timezonesets"

I did a
chown -R postgres:postgres /usr/share/pgsql
and then it worked fine.

Using rpm2cpio {file} | cpio -tv
I see:
drwxr-xr-x 6 root root 0 Mar 17 16:21 ./usr/share/pgsql
which is fine, however there is no specific entry for
/usr/share/timezone.
The post-install script doesn't seem to fix it, either.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

#3Jamie Strachan
frostfreek@yahoo.com
In reply to: Bruce Momjian (#2)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Affirmative...

Jamie Strachan

----- Original Message ----
From: Bruce Momjian <bruce@momjian.us>
To: Jamie Strachan <frostfreek@yahoo.com>
Cc: pgsql-bugs@postgresql.org
Sent: Tue, April 20, 2010 11:29:57 AM
Subject: Re: [BUGS] BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Would you report this to the RPM maintainers?

---------------------------------------------------------------------------

Jamie Strachan wrote:

The following bug has been logged online:

Bug reference: 5430
Logged by: Jamie Strachan
Email address: frostfreek@yahoo.com
PostgreSQL version: 8.4.3-2PGDG.el4
Operating system: CentOS 4
Description: initdb fails due to permissions of /usr/share/pgsql
Details:

Hello,

Downloaded the following RPM:
http://yum.pgsqlrpms.org/8.4/redhat/rhel-4-i386/postgresql-server-8.4.3-2PGD
G.el4.i386.rpm

for my CentOS 4 install.

service postgresql initdb fails with no error message.

So, I su'd to postgres, and ran

initdb --pgdata=/var/lib/pgsql/data --auth=ident
which is what service postgresql initdb does.
This command failed, with the error message:

could not open directory "/usr/share/pgsql/timezonesets"

I did a
chown -R postgres:postgres /usr/share/pgsql
and then it worked fine.

Using rpm2cpio {file} | cpio -tv
I see:
drwxr-xr-x 6 root root 0 Mar 17 16:21 ./usr/share/pgsql
which is fine, however there is no specific entry for
/usr/share/timezone.
The post-install script doesn't seem to fix it, either.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

#4Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: Jamie Strachan (#1)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Hi,

On Mon, 2010-04-19 at 14:22 +0000, Jamie Strachan wrote:

for my CentOS 4 install.

service postgresql initdb fails with no error message.

So, I su'd to postgres, and ran

initdb --pgdata=/var/lib/pgsql/data --auth=ident
which is what service postgresql initdb does.
This command failed, with the error message:

could not open directory "/usr/share/pgsql/timezonesets"

Cannot reproduce it on my 8.4+CentOS 4 box:

-bash-3.00$ initdb --pgdata=/var/lib/pgsql/data --auth=ident
...
Success. You can now start the database server using:
...

timezonesets directory has already *enough* permissions for postgres
user to read it:

drwxr-xr-x 2 root root 4096 2010-03-19 09:45 timezonesets

Are you sure that you did not chmod somewhere between installing package
and initdb'ing?

Regards,
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

#5Jamie Strachan
frostfreek@yahoo.com
In reply to: Devrim GÜNDÜZ (#4)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

I have posted the bug to the RPM maintainers, over at Command Prompt.
So, 5430 can be closed.

This is affecting my CentOS 4 release.
(I have to support RHEL/CentOS 4, 5, and some others too.)

[root@isotest ~]# more /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
[root@isotest ~]# rpm -e postgresql-server
[root@isotest ~]# rm -fr /usr/share/pgsql/
[root@isotest ~]# rpm -i postgresql-server-8.4.3-2PGDG.el4.i386.rpm
warning: postgresql-server-8.4.3-2PGDG.el4.i386.rpm: V3 DSA signature: NOKEY, key ID e8e345b8
[root@isotest ~]# ls -ld /usr/share/pgsql/timezone
drwxr-x--- 19 root root 4096 Apr 20 16:27 /usr/share/pgsql/timezone
[root@isotest ~]# ls -ld /usr/share/pgsql/timezonesets/
drwxr-x--- 2 root root 4096 Apr 20 16:27 /usr/share/pgsql/timezonesets/

other is denied access.

Thanks,

Jamie Strachan.

----- Original Message ----
From: Devrim GÜNDÜZ <devrim@gunduz.org>
To: Jamie Strachan <frostfreek@yahoo.com>
Cc: pgsql-bugs@postgresql.org
Sent: Tue, April 20, 2010 3:38:05 PM
Subject: Re: [BUGS] BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Hi,

On Mon, 2010-04-19 at 14:22 +0000, Jamie Strachan wrote:

for my CentOS 4 install.

service postgresql initdb fails with no error message.

So, I su'd to postgres, and ran

initdb --pgdata=/var/lib/pgsql/data --auth=ident
which is what service postgresql initdb does.
This command failed, with the error message:

could not open directory "/usr/share/pgsql/timezonesets"

Cannot reproduce it on my 8.4+CentOS 4 box:

-bash-3.00$ initdb --pgdata=/var/lib/pgsql/data --auth=ident
...
Success. You can now start the database server using:
...

timezonesets directory has already *enough* permissions for postgres
user to read it:

drwxr-xr-x 2 root root 4096 2010-03-19 09:45 timezonesets

Are you sure that you did not chmod somewhere between installing package
and initdb'ing?

Regards,
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

#6Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: Jamie Strachan (#5)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

On Tue, 2010-04-20 at 13:39 -0700, Jamie Strachan wrote:

[root@isotest ~]# ls -ld /usr/share/pgsql/timezonesets/
drwxr-x--- 2 root root 4096 Apr 20
16:27 /usr/share/pgsql/timezonesets/

Still, this should have never ever happened. Lacey, AFAICS there is
nothing that could cause this issue in your spec file.

# more /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 3)

Mine is Update 8, BTW. I wonder whether there is an bug related to rpm
itself in here.
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

#7Jamie Strachan
frostfreek@yahoo.com
In reply to: Devrim GÜNDÜZ (#6)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Hello,
I do appreciate help on this issue!

It seems to me that the directories /usr/share/pgsql/tsearch_data timezone and timezone_data
- are not explicitly contained within in the RPM
- are not configured by %defattr
(defattr is -,root,root)

I did a quick search to see what the default behaviour is supposed to be when a directory is not explicitly configured, but came up empty so far.

Sure enough, I have duplicated this scenario with a simple test RPM.

CentOS 5
[root@localhost ~]# rpm -i testy-1.0.0-0.noarch.rpm
[root@localhost ~]# ls -ld /opt/counterpath/eas/test
drwxr-xr-x 2 root root 4096 Apr 21 09:00 /opt/counterpath/eas/test
5

CentOS 4
[root@isotest ~]# rpm2cpio testy-1.0.0-0.noarch.rpm | cpio -tv
-rw-r--r-- 1 root root 6 Apr 21 08:53 ./opt/counterpath/eas/test/testfile.txt
1 block
[root@isotest ~]# rpm -i testy-1.0.0-0.noarch.rpm
[root@isotest ~]# ls -ld /opt/counterpath/eas/test
drwxr-x--- 2 root root 4096 Apr 21 08:59 /opt/counterpath/eas/test

CentOS 5 installs the directory with drwxr-xr-x, whereas CentOS4 installs it with drwxr-x---

I don't think there should be any issue with explicitly specifying the directory in the RPM with a %dir directive.
EG.,
%dir %attr(0755,root,root) /opt/counterpath/eas/test

My test RPM now installs properly on CentOS 4:

[root@isotest nortel]# rpm2cpio testy-1.0.0-0.noarch.rpm | cpio -tv
drwxr-xr-x 2 root root 0 Apr 21 08:53 ./opt/counterpath/eas/test
-rw-r--r-- 1 root root 6 Apr 21 08:53 ./opt/counterpath/eas/test/testfile.txt
1 block
[root@isotest nortel]# rpm -i testy-1.0.0-0.noarch.rpm
[root@isotest nortel]# ls -ld /opt/counterpath/eas/test
drwxr-xr-x 2 root root 4096 Apr 21 09:14 /opt/counterpath/eas/test

Again, thank you for your time!!!

Jamie Strachan

#8Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: Jamie Strachan (#7)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

On Wed, 2010-04-21 at 06:19 -0700, Jamie Strachan wrote:

I don't think there should be any issue with explicitly specifying the
directory in the RPM with a %dir directive.

Yeah, I will do it in next set -- I'm just thinking whether it is worth
to push another build for now or not ;)

I'll let you know.

Regards,
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

#9Lacey Powers
lacey.powers@commandprompt.com
In reply to: Devrim GÜNDÜZ (#8)
Re: BUG #5430: initdb fails due to permissions of /usr/share/pgsql

Devrim GÜNDÜZ wrote:

On Wed, 2010-04-21 at 06:19 -0700, Jamie Strachan wrote:

I don't think there should be any issue with explicitly specifying the
directory in the RPM with a %dir directive.

Yeah, I will do it in next set -- I'm just thinking whether it is worth
to push another build for now or not ;)

I'll let you know.

Regards,

Hello Everyone,

Yes, likewise, I cannot reproduce this on CentOS 4.8.

The permissions for the directory, from a clean RPM install, are 755 for
me.

However, the fixes listed and discussed, make good sense to me, so I
will be sure to include that in future rpm releases.

Jamie, Devrim, thank you both for your input. =)

Sincerely,

Lacey

--
Lacey Powers

The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 ext 104
PostgreSQL Replication, Consulting, Custom Development, 24x7 support