What I want to do is set up a very minimal chroot environment where it is almost exactly the same as the underlying system except for some configuration differences.
Basically I want to bind across most stuff except the /etc directory so that I can use the linker with a different cache file. I looked at two palemoon wrapper files:
/usr/local/bin/palemoon-plugin-container.sh
/usr/local/bin/palemoon.sh
Which use the following commands respectively to start palemoon.
Code: Select all
exec /usr/lib/glibc219/lib/ld-linux.so.2 --library-path /usr/lib/glibc219/lib:/usr/lib/glibc219/usr/lib:/usr/lib/glibc219/libstdc++:/usr/X11R7/lib:$PMDIR $PMDIR/plugin-container_exec "$@" #exec avoids segfault after flashplayer
Code: Select all
/usr/lib/glibc219/lib/ld-linux.so.2 --library-path /usr/lib/glibc219/lib:/usr/lib/glibc219/usr/lib:/usr/lib/glibc219/libstdc++:/usr/X11R7/lib:$PMDIR $PMDIR/palemoon "$@"
I noticed that with ldconfig I can specify a different cache file. So if I create a file called
/usr/lib/glibc219/etc/ld.so.conf
Code: Select all
/usr/lib/glibc219/lib
/usr/lib/glibc219/usr/lib
/usr/lib/glibc219/libstdc++
/usr/X11R7/lib
/opt/palemoon
#/lib
#/usr/lib
#/usr/local/lib
#/usr/X11R7/lib
#/root/my-applications/lib
Code: Select all
ldconfig -n -f /usr/lib/glibc219/etc/ld.so.conf -C /usr/lib/glibc219/etc/ld.so.cache
Also note that the lines commented out above in ld.so.conf are causing the bus error. So mabye we just pick what we need from these directories and either rbind it across or symbolically link it across..
Anyway, I haven't tried chroot before but I'll take a guess based on the archwiki article
Code: Select all
cd /usr/lib/glibc219
mount -t proc proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
mount --rbind /lib lib/
mount --rbind /usr/lib usr/lib/
mount --rbind /usr/local/lib usr/local/lib/
mount --rbind /usr/X11R7/lib usr/X11R7/lib/
mount --rbind /root/my-applications/lib root/my-applications/lib/
mount --rbind /root/my-applications/lib root/my-applications/lib
mount --rbind /usr/bin usr/bin/
mount --rbind /usr/local/bin usr/local/bin/
mount --rbind /usr/local/bin usr/local/bin/
mount --rbind /usr/X11R7/bin usr/lX11R7/bin
#mount --rbind /run run/ #The wiki mentions this. Do we need it?
mount --rbind root/my-applications/sbin root/my-applications/sbin/
chroot /usr/lib/glibc219 /usr/local/bin/palemoon
I might try this tommorow and see what happens
P.S. The wiki says that I also need to copy the following to use the internet
Code: Select all
cp /etc/resolv.conf /usr/lib/glibc219/etc/resolv.conf