Hei hei, some long time after discovering problems with `reboot` called within an init script, I had the opportunity to investigate the issue further, and I'd like to get an idea, if that is a known behaviour or bug and if that can be fixed?
The target BSP is built with ptxdist and uses busybox and busybox init with plain old init scripts. Under certain circumstances one of the early¹ scripts from /etc/init.d just calls `reboot` and with certain busybox versions, no reboot happens, but the script exits and later scripts run, which is not wanted in that case and breaks things. With ptxdist 2014.11.0 and busybox 1.22.1 everything is fine and works as expected. With ptxdist 2015.10.0 and busybox 1.23.2 the above described behaviour occurs, so no actual reboot then. If I revert changeset 2bba9ad67a917de2624d427c8c107ce3e2d3d085, which landed in busybox 1.23.0 later, the reboot succeeds. I studied the busybox sourcecode and found changeset f5e8b4278822f2413bf7e47466f55cc1a0fcca9a which landed in busybox 1.28.0. Backporting that change to 1.23.2 did not fix the not rebooting device. What I understood from the code: with `reboot -f` busybox directly calls the 'reboot' syscall from the kernel, which immediately triggers a reboot. With just `reboot` a SIGTERM is sent to PID 1, which is init from busybox itself in this case. It seemes init is missing this signal somehow. Based on the commit message of the 2017 changeset I tried to backport, I suppose there are time windows, when init does not see signals which should trigger a reboot. Correct? The inittab looks like this: console::sysinit:/etc/init.d/rcS console::respawn:/usr/bin/monit -Ic /etc/monitrc console::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100 ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r The rcS script comes from ptxdist without modification [1]. The init script in question does some operations on UBI volumes and UBIFS partitions and copies some data, nothing more, then reboots (it should). So is that behaviour known or even desired? Should init miss signals while sysinit parts from inittab still run? Or is this some kind of bug? Greets Alex ¹ only syslogd starts before and kernel modules are loaded [1] https://git.pengutronix.de/cgit/ptxdist/tree/projectroot/etc/init.d/rcS?id=ptxdist-2015.10.0 -- /"\ ASCII RIBBON | »With the first link, the chain is forged. The first \ / CAMPAIGN | speech censured, the first thought forbidden, the X AGAINST | first freedom denied, chains us all irrevocably.« / \ HTML MAIL | (Jean-Luc Picard, quoting Judge Aaron Satie)
signature.asc
Description: PGP signature
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
