There is no option you can supply to ldd
and no ldd
feature you can call upon to cause it to include libnss_dns.so.1
in the list of libraries to copy. That library is loaded dynamically at run time because of the contents of configuration files that have nothing to do with the dynamic linker (namely /etc/nsswitch.conf
) and ldd
simply cannot know what libraries the program might or might not load dynamically in this way.
You will find that there is probably going to be a whole assortment of other files that you need to copy in manually to make a working chroot: everything from /dev/null
to locale configuration, depending on what you're using.
PS: I don't want to copy it manually because I want my script to be cross architecture.
Unfortunately, getting a chroot
just right is an inherently non-portable thing. That is, there are no standard APIs you can use to set one up.
(I think you don't mean "cross architecture" here: assuming you have a working procedure to set up a chroot on, say, SPARC, the exact same procedure should work just fine on, say, x86_64, given the same operating system.)
You might try to use something like debootstrap
to set up a new chroot. At least it's tied to a package manager so it ensures that all the dependencies are present. Even then, debootstrap
does leave several system files (like /etc/fstab
) in a kind of TODO state.
manpreet
Best Answer
2 years ago
I created a script which creates a chroot and sets up s://forum.tuteehub.com/tag/php">php-fpm and apache2 to make the site work. In my script I'm copying all required lib(s) to my chroot lib(s) dir(s) using this:
but I saw that if I use a little script like this:
It doesn't resolve unless there is libnss_dns.so.1 in libs. Now my question is: what is the file I need to 'ldd' to copy libnss_dns to my chroot?
PS: I don't want to copy it manually because I want my script to be cross architecture.