I had a problem while trying to install glibc 2.14, I got this error

/home/myname/glibc_install/glibc-2.14/build/elf/ldconfig: Can't open configuration file /opt/glibc-2.14/etc/ld.so.conf: No such file or directory

The fix suggested this

:/opt/glibc-2.14/etc$ sudo sh -c "echo '/opt/lib' >> ld.so.conf"

AFAIK sudo sh -c "echo '/opt/lib' >> ld.so.conf" means open the sh program(the shell) and give it this command "echo '/opt/lib' >> ld.so.conf" to execute, which creates a file named ld.so.conf in the current directory and save in it /opt/lib, is that right ? what does the entire line means, or what the shell is going to do step by step ?


Breaking down the command: sudo sh -c "echo '/opt/lib' >> ld.so.conf" into bite size chunks:

sudo sh -c means to run shell command via the Bourne shell with super-user privileges.

echo '/opt/lib' >> ld.so.conf is going to APPEND whatever is inside the quotes + a \n (newline) char into ld.so.conf in the tail of the file.

| improve this answer | |
  • Thank you, and what does :/opt/glibc-2.14/etc$ mean ?, because it is the part that I don't understand. – Accountant م Apr 18 '19 at 19:05
  • 1
    That is just the person's terminal prompt output. Which varies from machine to machine depending on what is set for your environment's $PS1 variable. It is there before he starts typing anything, so it's superfluous to your issue and should be ignored. – Jaime Apr 18 '19 at 19:10
  • ............. LOL – Accountant م Apr 18 '19 at 19:15

Yes confusing) It looks like the first bit is the prompt (containing the working directory).

Therefore do

cd /opt/glibc-2.14/etc
sudo sh -c "echo '/opt/lib' >> ld.so.conf"


echo '/opt/lib' | sudo tee >/dev/null -a /opt/glibc-2.14/etc/ld.so.conf
| improve this answer | |
  • Thanks, yes I will do that, if I didn't completely understand the line. – Accountant م Apr 18 '19 at 18:36
  • OMG, I'm sorry I didn't notice the first part "It looks like the first bit is the prompt (containing the working directory)." , this should be the answer I just didn't notice it, i'm sorry. – Accountant م Apr 18 '19 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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