Init.c, making it chroot

Erik Udo erik.udo at gmail.com
Wed Jan 3 10:19:25 UTC 2007


I just made patch. It's supposed to run /etc/rc before chrooting. This is
the NetBSD "way" of doing it. All i can say is that it compiled. So if
anyone can look at it before i get to test it becouse i might be forgetting
something. (i can't even test it now)

diff attached.

On 12/27/06, Erik Udo <erik.udo at gmail.com> wrote:
>
> How can i make init chroot after executing /etc/rc, and executing
> /etc/rc again in the chrooted enviroment?
>
> For this to work, i'd like to know at what point do i call chroot(),
> becouse init.c uses fork() at the point where it runs the rc script.
>
> The thing is, i want to run a whole system in a chrooted enviroment in
> this livecd i'm making. But the command "chroot /mnt/root /etc/rc"
> returns after the /etc/rc has been run, dropping me back from the
> chrooted enviroment. And if it doesn't, init never starts the multiuser
> mode.
>
> So how can i go to the multiuser mode in a chrooted enviroment? I guess
> the only way to do that is to modify init.c
>
> Any help/feedback is appreciated.
>
> Cheers, Erik
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.diff
Type: application/octet-stream
Size: 2640 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20070103/0aac093f/init.obj


More information about the freebsd-hackers mailing list