When I run $ reboot on my embedded FreeNAS 0.7 (FreeBSD 7.2) it does start the shut down procedure but seemingly hangs.

I have registered a command to start a service script which is executed on PostInit:


It has works flawlessly so far.

Now I registered a second service


and had to realize that the PostInit script seems to be blocked by the first service (because it runs infinitely) and seemingly does not allow the PostInit to resume to it's next task. Consequently service 2 is never started.

To allow the script to continue I appended the & to the commands to be executed.

/myscripts/startService1.sh &


/myscripts/startService2.sh &

This works as intended, both services are started up and run as expected. But when I $ reboot the system will not shutdown within seconds like before (it eventually seems to complete the reboot after hours [I let it sit over night]).

When the reboot is initialized the ssh session (I am dropped) and all services are gone within seconds - however I can still ping the machine. Reconnecting with ssh does not work (connection refused).

Cleanly exiting (or even killing) the services before $ reboot has no effect. The whole issue also is reproducible with only one service as long as I appended the & at it's call. Apparently a simple self ending process like ps -Auw > /myLogs/postInit.log & will cause the issue too.

I am stumped and could really need a hint.

Update: I don't know how to say this but... it's fixed. And I have no idea how. All I did was let some time pass (writing this question) then tried with $ shutdown -r now which worked. Then tried $ reboot which now worked too. Since then everything now runs as intended but I do not know what I did to fix it! There was nothing after writing this, that I haven't done before - except for running shutdown -r that one time after which everything magically worked. I have tried to forcefully reproduce the problem but haven't been able to do so, before I could easily test by adding or removing that little &. I still have to explicitly run the scripts as background processes, else the PostInit script is blocked.

  • Do you have physical access to the console? Watching the shutdown sequence from there might prove to be helpful. You have provided some good detailed information, but I fear more information may be needed to debug this. – Tim May 30 '13 at 14:40
  • If you use shutdown -r now do you see the same symptoms? – schaiba May 30 '13 at 15:25
  • Thanks for your feedback. @Tim: no I do not as it's a bare custom NAS and I am remote controlling it. Right now I cannot attach a monitor and keyboard for that. – zsawyer May 30 '13 at 15:36
  • @schaiba I believe reboot for that case is just a rewrite to shutdown -r but I will check. Thanks – zsawyer May 30 '13 at 15:37
  • Try editing your /etc/syslog.conf to redirect the console messages to a file then you can check those messages to see if there is anything useful. There should be comments in the default /etc/syslog.conf explaining how to send the console messages to a file. – Craig May 30 '13 at 16:08

Your Answer

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

Browse other questions tagged or ask your own question.