You are not logged in.
I've followed the Arch Tor wiki up to the point where I enter the command
# chroot /opt/torchroot /usr/bin/torI get the error message,
chroot: failed to run command ‘/usr/bin/tor’: No such file or directoryOf course, /usr/bin/tor exists in both / and in /opt/torchroot/ I am using a 64-bit system, so I did set a symlink from /opt/torchroot/lib64 to /opt/torchroot/usr/lib/ and copy /usr/lib/ld-linux-x86-64.so* to /opt/torchroot/usr/lib/ I modified the script to include those actions; the script is as so:
#!/bin/bash
export TORCHROOT=/opt/torchroot
mkdir -p $TORCHROOT
mkdir -p $TORCHROOT/etc/tor
mkdir -p $TORCHROOT/dev
mkdir -p $TORCHROOT/usr/bin
mkdir -p $TORCHROOT/usr/lib
mkdir -p $TORCHROOT/var/lib
ln -s /usr/lib $TORCHROOT/lib
ln -s $TORCHROOT/usr/lib $TORCHROOT/lib64
cp /etc/hosts $TORCHROOT/etc/
cp /etc/host.conf $TORCHROOT/etc/
cp /etc/localtime $TORCHROOT/etc/
cp /etc/nsswitch.conf $TORCHROOT/etc/
cp /etc/resolv.conf $TORCHROOT/etc/
cp /etc/tor/torrc $TORCHROOT/etc/tor/
cp /usr/bin/tor $TORCHROOT/usr/bin/
cp /lib/libnss* /lib/libnsl* /lib/ld-linux.so* /lib/libresolv* /lib/libgcc_s.so* $TORCHROOT/usr/lib/
cp /usr/lib/ld-linux-x86-64.so* $TORCHROOT/usr/lib/
cp $(ldd /usr/bin/tor | awk '{print $3}'|grep "^/") $TORCHROOT/usr/lib/
cp -r /var/lib/tor $TORCHROOT/var/lib/
chown -R tor:tor $TORCHROOT/var/lib/tor
sh -c "grep ^tor /etc/passwd > $TORCHROOT/etc/passwd"
sh -c "grep ^tor /etc/group > $TORCHROOT/etc/group"
mknod -m 644 $TORCHROOT/dev/random c 1 8
mknod -m 644 $TORCHROOT/dev/urandom c 1 9
mknod -m 666 $TORCHROOT/dev/null c 1 3The closest thread I can find on this issue is here, but the OP's output is completely different from mine, so I do not expect to have the same problem. Some searching on Google has given me some ideas. I have some suspicions:
-Something is wrong with the chroot jail I created (most likely)
-I had made sure to be careful to handle the most recent news item on the Arch homepage correctly, but it's possible the binary move could have something to do with my problem.
-I'm using linux-ck from the AUR; I don't know if this may have something to do with it
I've verified that /opt/torchroot/usr/lib/ld-linux-x86-64.so.2 exists. I have a feeling that I'm missing something very simple here, but I'm stumped. I'd greatly appreciate if someone can point me in the right direction.
Last edited by vyu223 (2013-07-14 09:28:26)
Offline
...
# ln -s $TORCHROOT/usr/lib $TORCHROOT/lib64
ln -s /usr/lib $TORCHROOT/lib64
...Offline
I am fairly certain that you cannot symlink to somewhere that is going to be beyond the reach of the chroot. That is, $TORCHROOT is going to be the new /, so how is it going to get to the directories below that root? I think you'll have to use bind mounts to achieve this... or create the necessary directory structure and hard link everything that is necessary.
Offline
... but it works! ...then I found a better solution: create links with relative paths.
ln -sr $TORCHROOT/usr/lib $TORCHROOT/lib
ln -sr $TORCHROOT/usr/lib $TORCHROOT/lib64Offline
Thanks cargoan, your solution works (I tried the first one), and along with WonderWoofy's explanation I now have a better understanding of links and chroot. Following the link to /usr/lib inside the chroot jail goes to /usr/lib inside the chroot jail, which is /opt/torchroot/usr/lib outside of the chroot jail.
Offline