Date: Mon, 22 Aug 2022 09:56:05 -0600 From: Warner Losh <imp@bsdimp.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, FreeBSD Current <current@freebsd.org> Subject: Re: init (/rescue/sh) died Message-ID: <CANCZdfrwX=60Vi_xo%2B=bkOZhgw2Q6Bui2L-u8jm5Dp0iqRmqhA@mail.gmail.com> In-Reply-To: <YwOd5CeXTZ9p7jRh@kib.kiev.ua> References: <pp3n1s2s-s5os-pp6-67sp-736soo193n6n@mnoonqbm.arg> <YwOd5CeXTZ9p7jRh@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000e791b205e6d67c50 Content-Type: text/plain; charset="UTF-8" On Mon, Aug 22, 2022 at 9:17 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > On Mon, Aug 22, 2022 at 02:56:47PM +0000, Bjoern A. Zeeb wrote: > > Hi, > > > > I am trying to get some arm64 up and running a bit but cannot use > > loader. I have an MD_ROOT embedded in the kernel with /rescue on it. > > I set INIT_PATH=/rescue/sh . > > > > However that doesn't seem to work: > > > > start_init: trying /rescue/sh > > init died (signal 0, exit 0) > > panic: Going nowhere without my init! > > > > Anyone any ideas? > > Kernel does not set up the standard file descriptors for stdin/out/err > for init. When you try to directly exec /rescue/sh (or /bin/sh), it cannot > perform any io. > Agreed. init does lots of magic, in addition to setting up stdin/out/err (like deal with process groups, etc). /bin/sh doesn't do any of that magic, so it can't possibly work as init (PID 1). Your best bet is to boot -s (RB_SINGLE in the kernel boot_single=yes in the boot loader). You'd think you'd be able to symbolically link /etc/rc to /rescue/sh, but that will result in sh trying to execute /rescue/sh as a shell script and no good can come from it. I've had luck with "echo sh > $DESTDIR/etc/rc; chmod +x $DESTDIR/etc/rc" in the past, but I haven't tried that trick in ages... The simple equivalent to a tmp file does work. Warner --000000000000e791b205e6d67c50 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 22, 2022 at 9:17 AM Konst= antin Belousov <<a href=3D"mailto:kostikbel@gmail.com">kostikbel@gmail.c= om</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi= n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex= ">On Mon, Aug 22, 2022 at 02:56:47PM +0000, Bjoern A. Zeeb wrote:<br> > Hi,<br> > <br> > I am trying to get some arm64 up and running a bit but cannot use<br> > loader. I have an MD_ROOT embedded in the kernel with /rescue on it.<b= r> > I set INIT_PATH=3D/rescue/sh .<br> > <br> > However that doesn't seem to work:<br> > <br> > start_init: trying /rescue/sh<br> > init died (signal 0, exit 0)<br> > panic: Going nowhere without my init!<br> > <br> > Anyone any ideas?<br> <br> Kernel does not set up the standard file descriptors for stdin/out/err<br> for init.=C2=A0 When you try to directly exec /rescue/sh (or /bin/sh), it c= annot<br> perform any io.<br></blockquote><div><br></div><div>Agreed. init does lots = of magic, in addition to setting up stdin/out/err (like</div><div>deal with= process groups, etc). /bin/sh doesn't do any of that magic, so it</div= ><div>can't possibly work as init (PID 1).</div><div><br></div><div>You= r best bet is to boot -s (RB_SINGLE in the kernel boot_single=3Dyes in the<= /div><div>boot loader). You'd think you'd be able to symbolically l= ink /etc/rc to /rescue/sh,</div><div>but that will result in sh trying to e= xecute /rescue/sh as a shell script and no good</div><div>can come from it.= I've had luck with "echo sh > $DESTDIR/etc/rc;</div><div>chmod= +x $DESTDIR/etc/rc" in the past, but I haven't tried that trick i= n ages...</div><div>The simple equivalent to a tmp file does work.</div><di= v><br></div><div>Warner</div></div></div> --000000000000e791b205e6d67c50--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrwX=60Vi_xo%2B=bkOZhgw2Q6Bui2L-u8jm5Dp0iqRmqhA>