[Pkg-sysvinit-devel] Bug#345741: Would a restricted form of the
INIT_PROG feature suffice?
Dana How
danahow at gmail.com
Tue Jan 17 07:53:53 UTC 2006
The procedure below, which depends on "mount --bind",
does work. So for my purposes INIT_PROG is not needed.
Some things to note when using "mount --bind" to re-exec
from a different place:
* If you _are_ unmounting the fs holding the current init,
you _will_ need the bash script trampoline below.
Otherwise you will have a file open which is on top
of something you want to unmount.
* Re-exec'ing occurs to a hardwired path, "/sbin/init",
which is NOT altered by starting the initial init from a different path.
This hardwired path IS altered by a re-exec,
so if you did a second "telinit u" after running the script below
then /etc/init would be re-exec'ed. I don't know if this NOT/IS
inconsistency is a feature or a defect.
Thanks for helping me with this problem.
I hope our conversation can be easily found by anyone
else trying to do the same thing.
On 1/12/06, Dana How <danahow at gmail.com> wrote:
> On 1/12/06, Thomas Hood <jdthood at yahoo.co.uk> wrote:
> > Your unionfs scenario leads me to ask this: why not just bind mount a
> > different program on top of /sbin/init and do "telinit u"?
>
> That is, to switch from ro /sbin/init on fs you want to umount
> to /etc/init that won't be umounted:
>
> cat >/etc/init.sh <<EOT
> #!/bin/bash
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
> PATH=$PATH; export PATH
> exec $LD_LINUX /etc/init \$*
> EOT
> chmod +x /etc/init.sh
> mount --bind /etc/init.sh /sbin/init
> telinit -u
> sleep 2
> umount /sbin/init
>
> It looks like this might work. I need the bash script trampoline
> anyway to redirect ld-linux.so.2 and the libraries it loads
> (since /lib could get umount'd too ;-) ).
Thanks,
--
Dana L. How danahow at gmail.com +1 650 804 5991 cell
More information about the Pkg-sysvinit-devel
mailing list