We have Beaglebone black based custom board with 256MB RAM and 4GB eMMC.

We upgraded from Linux-3.12 to Linux-4.4 and busybox-1.20.2 to busybox-1.26.2.
Now in busybox-1.26.2 we are seeing and issue which was not there in busybox-1.20.2

I added following code in the one of the last init script.

if [ -f /home/ankur ] ; then
    rm /home/ankur
    echo "----Check Whoami----"
    whoami  #prints root
    echo "--------------------"
    while [ true ]
       count=$((count - 1 ))
       echo "Count = $count"
       if [ $count -le 0 ];then
       echo "Sleep 1"
       sleep 1

I touched the file in /home/ankur and then rebooted the board.
What I observed is, system didn't reboot but counter went down to 0 and then other init script executed and then board rebooted.

So it seems like busybox is getting signal for reboot but handling only after init scripts executed.

Now my question, is there a way to reboot the board before completion of all init scripts. Is there any busybox config which will disable this reboot blockage ?

reboot -f(force reboot without going through init) works but we need to run the stop script also so can't use it.

  • You can run stop scripts also from this script before reboot -f. – Ipor Sircer Dec 12 '17 at 14:09
  • Yeah but that won't be clean. every script where we use reboot -f we need to call stop script for other scripts which are already run, isn't it ? That would not be so clean and maintainable solution. – ART Dec 12 '17 at 14:13
  • Then reboot is also a not so clean and maintainable solution, because it calls all the scripts to stop. – Ipor Sircer Dec 12 '17 at 14:17
  • actually it is to an extent right? or atleast better than running specific stop scripts from other init scripts. On reboot stop scripts will undo whatever other init scripts which ran before did. It is just that we need to write stop script in a such a way that if start script has run then only stop script will do some cleanup otherwise no need to do cleanup. – ART Dec 12 '17 at 14:21

So it seems like busybox is getting signal for reboot but handling only after init scripts executed.

That is exactly how the init in BusyBox now works, yes. No, this is not configurable. You have to alter the program and re-build it.

Further reading

  • Thank you for reply JdeBP. Is there any way to reboot from init script which will go through init? – ART Dec 12 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.