LPIC-1 Exam 101 Practice Questions

Linux Professional Institute LPIC-1 Exam 101 (101-500) exam preparation

LPIC-1 Exam 101 practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 90 minutes.

LPIC-1 Exam 101 free question 3 / 10 · Domain 2: Linux Installation and Package Management

You placed the shared libraries of your own application in /opt/tool/lib. You want the dynamic linker to keep searching this location even after a reboot. Which procedure is correct?

  1. Append /opt/tool/lib to /etc/ld.so.cache and run ldconfig
  2. Append /opt/tool/lib to /etc/ld.so.cache and wait until the program is started next
  3. Put a .conf file containing /opt/tool/lib in /etc/ld.so.conf.d/ and wait until the program is started next
  4. Put a .conf file containing /opt/tool/lib in /etc/ld.so.conf.d/ and run ldconfig
Show the answer and explanation

Answer: D

Why this is correct
When a dynamically linked program starts, the dynamic linker (ld.so, ld-linux.so) searches for the shared libraries and binds them. The places it searches are determined by /etc/ld.so.conf, which these days usually has an include line that reads the .conf files in /etc/ld.so.conf.d/. A .conf file lists the directories of shared libraries as absolute paths. ldconfig reads these settings, rebuilds the links to the libraries, and rewrites /etc/ld.so.cache, the cache the dynamic linker uses, so always run ldconfig after adding or changing a setting.

Why the other options are wrong
"Put a .conf file containing /opt/tool/lib in /etc/ld.so.conf.d/ and wait until the program is started next" … The place to write is right, but the dynamic linker does not read the configuration files at every start. It uses the cache that ldconfig builds, so /opt/tool/lib does not enter the cache until you run ldconfig.
"Append /opt/tool/lib to /etc/ld.so.cache and run ldconfig" … Using ldconfig is right, but /etc/ld.so.cache is a cache created by ldconfig, not a file for people to edit. Running ldconfig rebuilds it from the configuration files, and a line you appended does not survive.
"Append /opt/tool/lib to /etc/ld.so.cache and wait until the program is started next" … Both the place to write and the way to make it take effect are wrong.

Practical notes
ldconfig rewrites /etc/ld.so.cache, which root owns, so run it as root or with sudo. ldconfig -p shows what the current cache contains, and ldconfig -v runs it while showing the directories processed and the links created. It is common for the real shared library file, which carries its exact version in its name, to be pointed to by symbolic links with shorter version names (such as libc.so.6), and tidying those links is also the work of ldconfig.

Go to the LPIC-1 Exam 101 practice app (10 free questions; purchase unlocks all questions)

See the full practice set