1

I have a computer which is not to be connected to the internet for security reasons. It is running Linux. On a separate computer, I have code and a cross compiler for linux. When I move the program over to the offline Linux computer, I cannot execute it, due to an error " version `GLIBC_2.17' not found "

After checking /lib, I see that I do indeed only have version 2.13 of libc. On my development computer, I have all the relevant files for the 2.22 version which is being used to compile the program. I would like to somehow copy this version of libc on my development computer over to my offline computer so that I can run my program.

The problem is, I cannot seem to copy the files. Attempting to do so gives an error:

mv: error writing ‘./libc.so.6’: No space left on device

or something similar. I know this is not actually due to there not being space left on the device, because I don't have much of anything ON the device, and I can copy the files to other places in the filesystem, just not to the /lib directory. How can I migrate my newer version of libc over to the offline computer?

Zephyr
  • 337
  • 5
  • 23
  • Does your offline computer has some linux distribution installed, and which one? Can you just update your distribution to newer version with recent enough glibc? (Or compile your program statically and it will run **if** kernel of target PC has all features needed by your glibc.) – osgx Apr 15 '17 at 19:09

1 Answers1

2

I would like to somehow copy this version of libc on my development computer over to my offline computer so that I can run my program.

Incorrectly updating libc on your "offline" computer is a very easy way to render it unbootable. You should not attempt this unless you understand what you are doing (which you clearly do not), and unless you know how to restore "offline" computer in case of failure.

The best approach is to use the package manager on the "offline" computer to install libc package correctly (details vary on what package manager is being used).

If the package manager approach doesn't work, you can copy individual files. Hoever note that system ld-linux.so and libc.so.6 must match at all times, or every dynamically linked program (your shell, cp, mv etc.) will break.

Since you need to update two files simultaneously, how could this be done? You need a statically-linked copy of cp. It is best to have a statically-linked copy of $SHELL and ln as well (in case you make a mistake).

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Why `ld-linux.so` and `libc.so` must match? ld-linux should be capable of loading most ELFs, and only misbehave in case of some advanced features like ifunc. Both ld-linux and libc.so can be saved in other place and used (when computer is online) by manual starting of ld-linux and with env variables with path to libc.so... – osgx Apr 15 '17 at 19:07
  • 1
    ld-linux and libc.so.6 *must* match *exactly* (come from the same build) because they have private unversioned binary interface between them. Here is an example of errors when they do not match: http://stackoverflow.com/q/847179/50617 – Employed Russian Apr 15 '17 at 19:19