I have a script that runs on startup, but it wont launch a application in chroot.
#!/bin/sh
/usr/sbin/chroot /root/chrootdir/ /bin/sh -c "lighttpd -f /etc/lighttpd.conf -m /lib"
echo "script activated" >> /log/www.log
the log file is written/appended on startup, but the lighttpd server is not starting. Running the script when the box is running works fine and launches lighttpd. This is a embedded system running a linux kernel and busybox. inittab triggers /etc/init.d/rcS that in turn run my start_www script. the start_www script is the last thing rcS launches.
Update:
/bin/sh: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
but libm.so.6 is located in /root/chrootdir/lib/libm.so.6 what to do now? how do i specify the libm.so path? tried the command "export LD_LIBRARY_PATH=/lib; lighttpd -f /etc/lighttpd.conf -m /lib" without success.
Update 2: . when i run the command:
chroot /root/chrootdir/ /sbin/lighttpd -f /etc/lighttpd.conf -m /lib
it launches the webserver without any warning or error. But when I launch the same script during startup, the script suddenly is unable to find the libs. Inside my chrootdir i got a .profile file containing:
export LD_LIBRARY_PATH=/lib
my guess is that the .profile settings file is not used during startup how do i set the library path?