When calling pthread_exit in a program which has called chroot, the program exits with the error message libgcc_s.so.1 must be installed for pthread_cancel to work The problem is that the nptl library needs the stack unwind code from libgcc_s.so.1, and it uses dlopen to load this library. I tried to install arlad, configured to use posix threads. This program chroots to /usr/arla/cache at startup, before doing any interesting thread operations. Then the later dlopen by the nptl code naturally fails, and it displays the above error message and calls _exit. I'm not terribly familiar with the POSIX standard or with POSIX threads, but it seems unintuitive and probably not standards compliant that a threaded server program can't use chroot at startup. A workaround seems to be to link the program with an explicit -lgcc_s on the command line, in addition to -lpthread, but as far as I understand, one should never need to link explicitly with libgcc_s. I'm running linux-2.4.17.4 on a debian x86 box. (I reported this bug on the debian glibc package a while ago, http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=360933, but I haven't seen any progress there and I don't think the problem is debian specific in any way).
Many parts of a program are dynamically linked, not just libgcc_s. iconv modules, nss modules, libcidn, ... It your responsibility to copy everything you need into the chroot.