Re: init (/rescue/sh) died
- In reply to: Bjoern A. Zeeb: "Re: init (/rescue/sh) died"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Aug 2022 21:51:03 UTC
On Mon, Aug 22, 2022 at 12:29 PM Bjoern A. Zeeb < bzeeb-lists@lists.zabbadoz.net> wrote: > On Mon, 22 Aug 2022, Warner Losh wrote: > > Hi, > > > 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. > > /rescue/init was simply "hanging" on earlier boots which is why I > had initially switche dto sh. > > Here's a few things I did overall: > - disable GDB in kernel config (it gave 2 lines of jitterish on > initial kernel printf lines before Copyrights. > - Added bootargs = FreeBSD:-vs to the chosen section in FDT > given I cannot have loader (no EFI); the guard trick is nice if you > know about it ;) > No EFI doesn't mean you can't have a loader :). What environment are you booting in? Seems interesting... > - Removed my previous env file I had added to the kernel to set > tunables. > - linked /bin/sh to /rescue/sh > - put a printf "hello world\n"; exit 1 in the top of /etc/rc just in > case -s wouldn't work > - changed INIT_PATH=/rescue/init > > Got a sh and can run sysctl and dmesg and type echo * in /rescue :) > Even reboot works :) > > Now that basic netbooting and user space work I can start adding SoC > drivers bit by bit over the next weeks/months :) That'll be a lot > more unfun. > > Thanks you two! Along with help from Andy earlier this made my day! > Glad I could help... Warner