Thread: yum repository packages 9.0 and 9.1 libpq conflict

yum repository packages 9.0 and 9.1 libpq conflict

From
John R Pierce
Date:
this is probably mostly for Devrim, since he's the packager of the RPM
repository....

So I have a CentOS 6.2 x86_64 system that was running postgres 9.0 from
Devrim's yum repo...   I installed 9.1 and was going to do a parallel
upgrade, but the entry for 9.0 in
/etc/ld.so.conf.d/postgresql-9.0-libs.conf  was causing
/usr/pgsql-9.1/bin/psql to load the wrong libpq,
/usr/pgsql-9.0/lib/libpq.so.5 which was triggering the error...

psql: invalid connection option "client_encoding"


I'm not sure how exactly this is supposed to work with two parallel
versions installed.   ld.so can't exactly sort out two libpq.so.5's ..
I would have expected the 9.1 stuff to be -R path linked with the
correct /usr/pgsql-9.1/lib stuff, and not to have ANY entries in
/etc/ld.so.conf.d  ...




--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: yum repository packages 9.0 and 9.1 libpq conflict

From
Devrim GÜNDÜZ
Date:
Hi John,

On Wed, 2012-03-14 at 21:54 -0700, John R Pierce wrote:
>
> So I have a CentOS 6.2 x86_64 system that was running postgres 9.0
> from  Devrim's yum repo...

It is now a community repo ;)

> I installed 9.1 and was going to do a parallel  upgrade, but the entry
> for 9.0 in  /etc/ld.so.conf.d/postgresql-9.0-libs.conf  was
> causing  /usr/pgsql-9.1/bin/psql to load the wrong libpq,
> /usr/pgsql-9.0/lib/libpq.so.5 which was triggering the error...
>
> psql: invalid connection option "client_encoding"

I have created a ticket for that, but could not close yet. You can see
the progress from here:

http://wiki.pgrpms.org/ticket/77

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Attachment

Re: yum repository packages 9.0 and 9.1 libpq conflict

From
John R Pierce
Date:
On 03/14/12 11:40 PM, Devrim GÜNDÜZ wrote:
> I have created a ticket for that, but could not close yet. You can see
> the progress from here:
>
> http://wiki.pgrpms.org/ticket/77

I don't see anything but the ticket itself?


anyways, I'm quite sure this is the problem...

# cat /etc/ld.so.conf.d/postgresql-9.0-libs.conf
/usr/pgsql-9.0/lib/

# cat /etc/ld.so.conf.d/postgresql-9.1-libs.conf
/usr/pgsql-9.1/lib/



I'm pretty sure that removing the ld.so.conf.d files will fix this.
I'm setting up a test in a spare VM now.

k, stock centos 6.2 with 9.0.7...

$ rpm -qa |grep postgres
postgresql90-libs-9.0.7-1PGDG.rhel6.x86_64
postgresql90-server-9.0.7-1PGDG.rhel6.x86_64
postgresql90-9.0.7-1PGDG.rhel6.x86_64
postgresql90-contrib-9.0.7-1PGDG.rhel6.x86_64
postgresql90-devel-9.0.7-1PGDG.rhel6.x86_64

$ ldd /usr/pgsql-9.0/bin/psql | grep libpq
         libpq.so.5 => /usr/pgsql-9.0/lib/libpq.so.5 (0x00007f340f956000)

so... I install 9.1 ...

# rpm -ivh
http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
Retrieving
http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
Preparing...                ###########################################
[100%]
    1:pgdg-centos91          ###########################################
[100%]

# yum install postgresql91{-server,-contrib}
....
   Installing : postgresql91-libs-9.1.3-1PGDG.rhel6.x86_64         1/4
   Installing : postgresql91-9.1.3-1PGDG.rhel6.x86_64              2/4
   Installing : postgresql91-server-9.1.3-1PGDG.rhel6.x86_64       3/4
   Installing : postgresql91-contrib-9.1.3-1PGDG.rhel6.x86_64      4/4

Installed:
   postgresql91-contrib.x86_64 0:9.1.3-1PGDG.rhel6
   postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel6

Dependency Installed:
   postgresql91.x86_64 0:9.1.3-1PGDG.rhel6
   postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel6

Complete!


and....

# /usr/pgsql-9.1/bin/psql
psql: invalid connection option "client_encoding"

# ldd /usr/pgsql-9.1/bin/psql |grep libpq
         libpq.so.5 => /usr/pgsql-9.0/lib/libpq.so.5 (0x00007f989aa20000)

oooops!  whats 9.0 doing here??

k, so thats the problem.

so... I got evil.   I mv'd /etc/ld.so.conf.d/postgres*.conf to backup.

# ldd /usr/pgsql-9.1/bin/psql |grep libpq
         libpq.so.5 => not found

uh oh.   that means they weren't linked with -R or -rpath
/usr/pgsql-9.1/lib, which they should have been if --prefix
/usr/pgsql-9.1 was used....


OH.

CONFIGURE = '--disable-rpath' '--prefix=/usr/pgsql-9.1' .....


muh oh.   why is that?!?




--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



Re: yum repository packages 9.0 and 9.1 libpq conflict

From
Tom Lane
Date:
John R Pierce <pierce@hogranch.com> writes:
> CONFIGURE = '--disable-rpath' '--prefix=/usr/pgsql-9.1' .....
> muh oh.   why is that?!?

It's distro policy on all Red Hat-based systems (and probably others as
well) not to use rpath; you're supposed to use ldconfig instead.  It's
thus totally unsurprising that removing a package's /etc/ld.so.conf.d
file breaks it.

However, it's not clear to me that this policy can support multiple
packages expecting to install different libraries with the same soname
and major version.  I'm not enough of a packaging weenie to know if
there's a standard workaround for that.  Devrim might have to resort to
something like shipping the latest (9.1.x) version of libpq.so in all of
his packages.

            regards, tom lane

Re: yum repository packages 9.0 and 9.1 libpq conflict

From
John R Pierce
Date:
On 03/15/12 7:27 AM, Tom Lane wrote:
> It's distro policy on all Red Hat-based systems (and probably others as
> well) not to use rpath; you're supposed to use ldconfig instead.  It's
> thus totally unsurprising that removing a package's /etc/ld.so.conf.d
> file breaks it.

ouch.  I didn't realize that.  -1 to RH for that policy.   -rpath is
*EXACTLY* the right solution for this sort of problem, I've always
*HATED* stuff that relies on ld.so or equivalent, or even worse,
LD_LIBRARY_PATH ....   sigh.

> However, it's not clear to me that this policy can support multiple
> packages expecting to install different libraries with the same soname
> and major version.  I'm not enough of a packaging weenie to know if
> there's a standard workaround for that.  Devrim might have to resort to
> something like shipping the latest (9.1.x) version of libpq.so in all of
> his packages.

maybe the postgresql91-libs should supercede the ld.so.conf.d file from
previous versions so there would be only one such .conf file, pointing
everyone at the latest installed version.    otoh, if you removed 9.1, I
don't know how that would be able to put a previous version back, ugh.

--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast