After applying routine updates to a CentOS 7 application server, a systems administrator attempts to start a custom service that was compiled to interact with PostgreSQL. The service immediately fails and the journal records:
error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
Which of the following actions will MOST likely resolve the problem?
Open TCP port 5432 in the host firewall and reload firewalld.
Install the package that provides libpq.so.5 (postgresql-libs) with the system's package manager.
Rebuild the initramfs image and reboot the server to load updated kernel modules.
Run ldconfig to rebuild the sharedâlibrary cache and then restart the service.
The message indicates that the dynamic linker cannot find libpq.so.5, a shared object supplied by the postgresql-libs package. Installing that package places the library in /usr/lib64 (and registers it with ldconfig), allowing the binary to load all required objects and start. Re-running ldconfig alone will not help when the library is completely absent. Firewall ports and kernel-module initramfs rebuilding are unrelated to user-space shared-library resolution, so those actions would not correct the failure.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is libpq.so.5, and why is it important?
Open an interactive chat with Bash
What does ldconfig do, and why does it not solve the problem in this case?
Open an interactive chat with Bash
What does opening TCP port 5432 in the firewall have to do with PostgreSQL?