when I was installing PostgreSQL from source code I had to install the libreadline.so.6 library.
From that moment I can't update my kubuntu system.

The error is:

Setting up ubuntu-keyring (2011.11.21.1) ...

gpggpg: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: UP

: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: UP
dpkg: error processing ubuntu-keyring (--configure):
 subprocess installed post-installation script returned error exit status 127

Errors were encountered while processing:
 E: Sub-process /usr/bin/dpkg returned an error code (1)'

For this reason I want remove libreadline.so.6

What will happen to my PostgreSQL if I do it? Both of them are important for my project.


I checked my system and have:

In /usr/local/lib three files:


and in /usr/lib/x86_64-linux-gnu/:


What are these? Which one of these does PostgreSQL use?

  • 1
    You can probably fix this by re-ordering your LD_LIBRARY_PATH so that /usr/local/lib/ is at the end, rather than the beginning. Edit your question with the output from: ldd `which gpggpg`
    – Philᵀᴹ
    Commented Dec 28, 2012 at 23:12
  • @Phil Thank you for your answer, how can I do the re-ordering?
    – DarkCoffee
    Commented Dec 29, 2012 at 8:56

1 Answer 1


You installed a version of readline different than the one already installed by ubuntu. You may probably safely remove it, since postgresql will get the other one.

BTW, why do you recompiled postgresql on ubuntu? If you don't like to version provided in your ubuntu release, just point your apt to http://pgapt.debian.net/ and get the version you like more.

  • thank you for your answer. I'm afraid of recompile postgresql because I'm doing a project on it and I don't want that the situation become worst. So, you are sure that I can delete the libreadline in /usr/local/lib, aren't you?
    – DarkCoffee
    Commented Dec 29, 2012 at 20:27
  • Yes, I am quite sure. Moreover the readline is probably only used by psql executable, not by the server itself. Just in case: rename it instead of deleting it. BTW, did you really needed it? I think Debian/Ubuntu postgresql moved from readline to libedit.
    – eppesuig
    Commented Dec 30, 2012 at 0:10
  • Thank you. I deleted it and worked! But, when I restarted the system that file was still there! And also when I re-run the upgrade, it give me errors like before.
    – DarkCoffee
    Commented Dec 30, 2012 at 5:50
  • I don't know why your library appear once again. Have a look at your init scripts and check who is responsible for that. Anyway, in order to execute apt or any other command ignoring that library, just run it this way: env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libreadline.so apt-get ARGS
    – eppesuig
    Commented Dec 30, 2012 at 16:50
  • 1
    of course, you should use the right arguments. For example, in order to fix the installation, try env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libreadline.so apt-get -f install, while for upgrading your system, use env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libreadline.so apt-get dist-upgrade
    – eppesuig
    Commented Dec 31, 2012 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.