[GTALUG] How much do you know about how linux executes binaries?

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Wed Dec 11 16:50:54 EST 2019


On Wed, Dec 11, 2019 at 03:28:30PM -0500, Sergio Durigan Junior via talk wrote:
> Everything that could be moved was moved under /var, because it's the
> last directory (alphabetically) on /.
> 
> You will have to invoke the dynamic loader by hand in this case, because
> it has been moved as well.  On Debian GNU/Linux 64-bit, you can find it
> at /var/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2.  You will also have
> to set LD_LIBRARY_PATH accordingly, otherwise the binary to be executed
> will not be able to find its required libraries (mainly libc.so, in this
> case):
> 
> # export LD_LIBRARY_PATH=/var/lib/x86_64-linux-gnu
> # /var/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /var/bin/ls
> 
> You can now invoke 'mv' and move the contents back to /.

Congratulations.  You know your dynamic loader. :)

This particular system is yocto multilib based, so it was /var/lib64 that
had the needed files, and mv happens to be in busybox with a symlink
pointing the wrong way so it needed busybox called explicitly with mv
as an argument, but that wasn't the important part.

-- 
Len Sorensen


More information about the talk mailing list