Thread: psql undefined symbol error on Ubuntu
Hello Friends, I have installed postgres client on an Ubuntu machine. However, when I try to run 'psql', I get this error message: # psql /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: /usr/local/lib/libreadline.so.5: undefined symbol: PC Here is some information about the machine: # uname -a Linux hostname.domain.net 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64 GNU/Linux Client installed: postgresql-client - front-end programs for PostgreSQL (latest version) Please let me know if more information is needed. Thanks, Harsha Hegde Database Developer, Vonage | 23 Main Street | Holmdel, NJ 07733 t: 732-203-7562 e: harshaDOThegdeATvonageDOTcom NOTE: The information contained in this email message is considered confidential and proprietary to the sender and is intended solely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited. If you have received this message in error, please advise the sender by reply email and delete the message.
"Harsha Hegde" <harsha.hegde@vonage.com> writes: > I have installed postgres client on an Ubuntu machine. However, when I > try to run 'psql', I get this error message: > # psql > /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: > /usr/local/lib/libreadline.so.5: undefined symbol: PC This is a readline problem --- it's missing some underlying library, probably libtermcap. regards, tom lane
On Thu, Jul 9, 2009 at 3:23 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
This is library missing error and you have to soft link with libedit.so.2. use below command to soft link with library.
ln -s /lib/libreadline.so.5 /lib/libedit.so.2
Run the psql as a postgres user,like
psql -d <database name> -p <port> -U <username>
Thanks & Regards,
Raghu Ram
"Harsha Hegde" <harsha.hegde@vonage.com> writes:This is a readline problem --- it's missing some underlying library,
> I have installed postgres client on an Ubuntu machine. However, when I
> try to run 'psql', I get this error message:
> # psql
> /usr/lib/postgresql/8.3/bin/psql: symbol lookup error:
> /usr/local/lib/libreadline.so.5: undefined symbol: PC
probably libtermcap.
regards, tom lane
This is library missing error and you have to soft link with libedit.so.2. use below command to soft link with library.
ln -s /lib/libreadline.so.5 /lib/libedit.so.2
Run the psql as a postgres user,like
psql -d <database name> -p <port> -U <username>
Thanks & Regards,
Raghu Ram
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
On Thu, Jul 9, 2009 at 3:54 AM, Harsha Hegde<harsha.hegde@vonage.com> wrote: > > Hello Friends, > > I have installed postgres client on an Ubuntu machine. However, when I > try to run 'psql', I get this error message: > > # psql > /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: > /usr/local/lib/libreadline.so.5: undefined symbol: PC Something has installed libreadline in /usr/local/lib (the one the PostgreSQL packages are supposed to use is in /lib), andsomehow you have configured things so this version takes precedence over the system installed one. Possibly you installedsome software that wasn't a Debian or Ubuntu package and it has damaged your system? -- Stuart Bishop <stuart@stuartbishop.net> http://www.stuartbishop.net/
Attachment
Raghu Ram, Thanks for responding. This link already seems to exist: # ln -s /lib/libreadline.so.5 /lib/libedit.so.2 ln: creating symbolic link `/lib/libedit.so.2': File exists Regards, Harsha NOTE: The information contained in this email message is considered confidential and proprietary to the sender and is intended solely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited. If you have received this message in error, please advise the sender by reply email and delete the message. ________________________________ From: raghu ram [mailto:raghuchennuru@gmail.com] Sent: Wednesday, July 08, 2009 11:48 PM To: Tom Lane Cc: Harsha Hegde; pgsql-novice@postgresql.org Subject: Re: [NOVICE] psql undefined symbol error on Ubuntu On Thu, Jul 9, 2009 at 3:23 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: "Harsha Hegde" <harsha.hegde@vonage.com> writes: > I have installed postgres client on an Ubuntu machine. However, when I > try to run 'psql', I get this error message: > # psql > /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: > /usr/local/lib/libreadline.so.5: undefined symbol: PC This is a readline problem --- it's missing some underlying library, probably libtermcap. regards, tom lane This is library missing error and you have to soft link with libedit.so.2. use below command to soft link with library. ln -s /lib/libreadline.so.5 /lib/libedit.so.2 Run the psql as a postgres user,like psql -d <database name> -p <port> -U <username> Thanks & Regards, Raghu Ram -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice
I meant to send this to the list: Hi 2009/7/9 raghu ram <raghuchennuru@gmail.com>: > > > On Thu, Jul 9, 2009 at 3:23 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> >> "Harsha Hegde" <harsha.hegde@vonage.com> writes: >> > I have installed postgres client on an Ubuntu machine. However, when I >> > try to run 'psql', I get this error message: >> >> > # psql >> > /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: >> > /usr/local/lib/libreadline.so.5: undefined symbol: PC >> >> This is a readline problem --- it's missing some underlying library, >> probably libtermcap. >> >> regards, tom lane > > This is library missing error and you have to soft link with libedit.so.2. This looks to me like the official Ubuntu postgresql-client-8.3 package. It could, of course, be a third party package, but I think that's unlikely based on where the psql command is installed. Because of this it was likely installed in the usual way with apt-get (or similar), which would have made sure to install any required dependencies, so it seems unlikely that the problem would be a missing library or that libreadline.so.5 should be symlinked to libedit.so.2. It's more likely that the version of libreadline.so.5 that ld.so finds first on the library path is the wrong one. This is especially likely, since the one it appears to be finding is in /usr/local/lib instead of where official Ubuntu packages install libraries (/lib or /usr/lib). > use below command to soft link with library. > > ln -s /lib/libreadline.so.5 /lib/libedit.so.2 That will have no effect here, because his "psql" is not using /lib/readline.so.5. It is trying to use /usr/local/lib/libreadline.so.5 instead. :) -- Michael Wood <esiotrot@gmail.com>
I sent this directly to Harsha by mistake: Hi 2009/7/8 Harsha Hegde <harsha.hegde@vonage.com>: > > Hello Friends, > > I have installed postgres client on an Ubuntu machine. However, when I > try to run 'psql', I get this error message: > > # psql > /usr/lib/postgresql/8.3/bin/psql: symbol lookup error: > /usr/local/lib/libreadline.so.5: undefined symbol: PC Google returns many results for the error "/usr/local/lib/libreadline.so.5: undefined symbol: PC". It is not clear to me why so many people encounter this error, though. By the way, why do you have a libreadline.so.5 in /usr/local/lib? Official Ubuntu packages are never installed to /usr/local. I think the problem is that psql is finding the wrong libreadline. What does this give you: ldd /usr/lib/postgresql/8.3/bin/psql In order to get psql to use the correct libreadline, you have several options. 1.) Remove the one from /usr/local/lib and then run "ldconfig", but this might break other things. Since it should not have been installed there by official Ubuntu packages, I hope you know what it is that needs it and can decide if this is a problem. If you try this, first rename it to something else and see what breaks. Then you can rename it back again if necessary. 2.) Configure ld.so.conf (or ld.so.conf.d/*) to ignore /usr/local/lib (i.e. comment it out. It should be in /etc/ld.so.conf.d/libc). Then run "ldconfig". This is similar to option 1. i.e. it could break other things, but should not break any official Ubuntu packages. 3.) Configure ld.so (same files as for option 2) so that /lib and /usr/lib are before /usr/local/lib when you run "ldconfig -v". Not sure about this, but you might just be able to put them above /usr/local/lib in /etc/ld.so.conf.d/libc. This should be safe, but keep a live CD handy in case. Remember to run "ldconfig" after changing the files. 4.) Use LD_PRELOAD to force psql to use the correct libreadline. This is the ugliest solution and you would have to do it every time you run psql (or write a script that does this), so I don't recommend it: LD_PRELOAD=/lib/libreadline.so.5 psql also, I haven't tested it. It won't break anything and I'm pretty sure it will work, but as I said, it's ugly. The best solution, I think, is number 1, but only if you don't actually need the version in /usr/local for some reason. I hope this helps and is not too confusing :) -- Michael Wood <esiotrot@gmail.com>
Michael Wood <esiotrot@gmail.com> writes: > Google returns many results for the error > "/usr/local/lib/libreadline.so.5: undefined symbol: PC". It is not > clear to me why so many people encounter this error, though. Historically the problem with readline has been that it can function with either of two underlying libraries (termcap or ncurses, if memory serves) and somebody thought it would be a brilliant idea to postpone the decision to runtime. Which meant that instead of having a package manager dependency on one or the other, libreadline packages were shipped with no explicit dependency on *either*. Everything was fine if you actually had one of the two installed; if not, not so much. Of course this approach is pretty idiotic in the context of modern package-manager-based distributions. Red Hat started forcing a choice some years ago. I'm not sure what Ubuntu does. I suspect what the OP has got is one of these ill-considered packages with no hard dependency; but as you say, if it were an official Ubuntu package it wouldn't be installing into /usr/local. I don't have anything to add to your advice about how to fix it, just wanted to shed a bit of light on why readline has got a history of this kind of issue. regards, tom lane
2009/7/9 Tom Lane <tgl@sss.pgh.pa.us>: > Michael Wood <esiotrot@gmail.com> writes: >> Google returns many results for the error >> "/usr/local/lib/libreadline.so.5: undefined symbol: PC". It is not >> clear to me why so many people encounter this error, though. > > Historically the problem with readline has been that it can function > with either of two underlying libraries (termcap or ncurses, if memory > serves) and somebody thought it would be a brilliant idea to postpone > the decision to runtime. Which meant that instead of having a package > manager dependency on one or the other, libreadline packages were > shipped with no explicit dependency on *either*. Everything was fine > if you actually had one of the two installed; if not, not so much. OK, thanks for the explanation, but it still doesn't really explain why so many people seem to have a broken libreadline in /usr/*local*/lib :) > Of course this approach is pretty idiotic in the context of modern > package-manager-based distributions. Red Hat started forcing a choice > some years ago. I'm not sure what Ubuntu does. I suspect what the OP > has got is one of these ill-considered packages with no hard dependency; > but as you say, if it were an official Ubuntu package it wouldn't be > installing into /usr/local. Ubuntu appears to depend on libncurses: $ apt-cache show libreadline5 | grep ^Depends Depends: readline-common, libc6 (>= 2.6-1), libncurses5 (>= 5.6) although dpkg supports dependencies which say that one package depends on one of X or Y. e.g. the dependencies for the gnome-desktop-environment package contains this: totem-gstreamer (>= 2.22.2) | totem-xine (>= 2.22.2) There's also another way to do this sort of thing. Packages can say what they provide, and that can be basically the name of the package, or a sort of virtual package. e.g. all MTAs on Debian and Ubuntu provide "mail-transport-agent": $ apt-cache show exim4-daemon-light | grep ^Provides Provides: exim4-localscanapi-1.0, exim4-localscanapi-1.1, mail-transport-agent so if another package depends on an MTA, but doesn't care which one, it can just depend on mail-transport-agent. I seem to remember RPM also supports this, so I don't see why anyone would have decided not to depend on either one, unless it was possible to use some of the functionality of libreadline without needing ncurses or termcap. > I don't have anything to add to your advice about how to fix it, just > wanted to shed a bit of light on why readline has got a history of this > kind of issue. Thanks :) -- Michael Wood <esiotrot@gmail.com>
Thanks to all for the responses. Systems Ops has resolved this issue. I am able to successfully connect. Thanks, Harsha Hegde Database Developer, Vonage| 23 Main Street | Holmdel, NJ 07733 t: 732-203-7562 e: harshaDOThegdeATvonage.com location: D1-A161 NOTE: The information contained in this email message is considered confidential and proprietary to the sender and is intendedsolely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited.If you have received this message in error, please advise the sender by reply email and delete the message. -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Michael Wood Sent: Thursday, July 09, 2009 1:10 PM To: Tom Lane Cc: pgsql-novice@postgresql.org Subject: Re: [NOVICE] psql undefined symbol error on Ubuntu 2009/7/9 Tom Lane <tgl@sss.pgh.pa.us>: > Michael Wood <esiotrot@gmail.com> writes: >> Google returns many results for the error >> "/usr/local/lib/libreadline.so.5: undefined symbol: PC". It is not >> clear to me why so many people encounter this error, though. > > Historically the problem with readline has been that it can function > with either of two underlying libraries (termcap or ncurses, if memory > serves) and somebody thought it would be a brilliant idea to postpone > the decision to runtime. Which meant that instead of having a package > manager dependency on one or the other, libreadline packages were > shipped with no explicit dependency on *either*. Everything was fine > if you actually had one of the two installed; if not, not so much. OK, thanks for the explanation, but it still doesn't really explain why so many people seem to have a broken libreadlinein /usr/*local*/lib :) > Of course this approach is pretty idiotic in the context of modern > package-manager-based distributions. Red Hat started forcing a choice > some years ago. I'm not sure what Ubuntu does. I suspect what the OP > has got is one of these ill-considered packages with no hard > dependency; but as you say, if it were an official Ubuntu package it > wouldn't be installing into /usr/local. Ubuntu appears to depend on libncurses: $ apt-cache show libreadline5 | grep ^Depends Depends: readline-common, libc6 (>= 2.6-1), libncurses5 (>= 5.6) although dpkg supports dependencies which say that one package depends on one of X or Y. e.g. the dependencies for the gnome-desktop-environment package contains this: totem-gstreamer (>= 2.22.2) | totem-xine (>= 2.22.2) There's also another way to do this sort of thing. Packages can say what they provide, and that can be basically the nameof the package, or a sort of virtual package. e.g. all MTAs on Debian and Ubuntu provide "mail-transport-agent": $ apt-cache show exim4-daemon-light | grep ^Provides Provides: exim4-localscanapi-1.0, exim4-localscanapi-1.1, mail-transport-agent so if another package depends on an MTA, but doesn't care which one, it can just depend on mail-transport-agent. I seem to remember RPM also supports this, so I don't see why anyone would have decided not to depend on either one, unlessit was possible to use some of the functionality of libreadline without needing ncurses or termcap. > I don't have anything to add to your advice about how to fix it, just > wanted to shed a bit of light on why readline has got a history of > this kind of issue. Thanks :) -- Michael Wood <esiotrot@gmail.com> -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice
For the sake of information, Systems had installed a customized version of the readline (I don't know what was customized),which was the cause of conflict. Once that was removed, everything worked fine. Regards, Harsha NOTE: The information contained in this email message is considered confidential and proprietary to the sender and is intendedsolely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited.If you have received this message in error, please advise the sender by reply email and delete the message. -----Original Message----- From: Harsha Hegde Sent: Thursday, July 09, 2009 3:50 PM To: pgsql-novice@postgresql.org Subject: RE: [NOVICE] psql undefined symbol error on Ubuntu Thanks to all for the responses. Systems Ops has resolved this issue. I am able to successfully connect. Thanks, Harsha Hegde Database Developer, Vonage| 23 Main Street | Holmdel, NJ 07733 t: 732-203-7562 e: harshaDOThegdeATvonage.com location: D1-A161 NOTE: The information contained in this email message is considered confidential and proprietary to the sender and is intendedsolely for review and use by the named recipient. Any unauthorized review, use or distribution is strictly prohibited.If you have received this message in error, please advise the sender by reply email and delete the message. -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Michael Wood Sent: Thursday, July 09, 2009 1:10 PM To: Tom Lane Cc: pgsql-novice@postgresql.org Subject: Re: [NOVICE] psql undefined symbol error on Ubuntu 2009/7/9 Tom Lane <tgl@sss.pgh.pa.us>: > Michael Wood <esiotrot@gmail.com> writes: >> Google returns many results for the error >> "/usr/local/lib/libreadline.so.5: undefined symbol: PC". It is not >> clear to me why so many people encounter this error, though. > > Historically the problem with readline has been that it can function > with either of two underlying libraries (termcap or ncurses, if memory > serves) and somebody thought it would be a brilliant idea to postpone > the decision to runtime. Which meant that instead of having a package > manager dependency on one or the other, libreadline packages were > shipped with no explicit dependency on *either*. Everything was fine > if you actually had one of the two installed; if not, not so much. OK, thanks for the explanation, but it still doesn't really explain why so many people seem to have a broken libreadlinein /usr/*local*/lib :) > Of course this approach is pretty idiotic in the context of modern > package-manager-based distributions. Red Hat started forcing a choice > some years ago. I'm not sure what Ubuntu does. I suspect what the OP > has got is one of these ill-considered packages with no hard > dependency; but as you say, if it were an official Ubuntu package it > wouldn't be installing into /usr/local. Ubuntu appears to depend on libncurses: $ apt-cache show libreadline5 | grep ^Depends Depends: readline-common, libc6 (>= 2.6-1), libncurses5 (>= 5.6) although dpkg supports dependencies which say that one package depends on one of X or Y. e.g. the dependencies for the gnome-desktop-environment package contains this: totem-gstreamer (>= 2.22.2) | totem-xine (>= 2.22.2) There's also another way to do this sort of thing. Packages can say what they provide, and that can be basically the nameof the package, or a sort of virtual package. e.g. all MTAs on Debian and Ubuntu provide "mail-transport-agent": $ apt-cache show exim4-daemon-light | grep ^Provides Provides: exim4-localscanapi-1.0, exim4-localscanapi-1.1, mail-transport-agent so if another package depends on an MTA, but doesn't care which one, it can just depend on mail-transport-agent. I seem to remember RPM also supports this, so I don't see why anyone would have decided not to depend on either one, unlessit was possible to use some of the functionality of libreadline without needing ncurses or termcap. > I don't have anything to add to your advice about how to fix it, just > wanted to shed a bit of light on why readline has got a history of > this kind of issue. Thanks :) -- Michael Wood <esiotrot@gmail.com> -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice