I've never debugged init scripts before, but it seems like its something I'll be doing today. I'm running a headless debian wheezy on a Cubieboard. It's an ARM board like raspberry pi. I have a serial and ssh connection to the board. The problem is that the linux fails to reboot or poweroff whenever I issue a "reboot" or "shutdown -h now" command on the serial line. The only thing I see in console after issuing a reboot s a line like this:
Then it stops. The serial line stops responding completely, but I can still use SSH normally. The ssh terminal prints out a line telling me that the system is going for reboot now or something along those lines. Then nothing happens. But the weird thing is that it doesn't always get stuck like this. Sometimes it will reboot just fine, and I've tested it with mulitple consecutive reboots successfully. It's just sometimes that it gets stuck.
I've scanned the running processes using "ps", and I think I've found a culprit process. There's an entry in the process list like this:
root 2622 0.0 0.0 1364 452 ? Ss 00:39 0:00 /bin/sh /etc/init.d/rc 6
Seems like that rc script gets stuck somehow, but I have no idea where. No services get terminated, so I am guessing it happens before any scripts in /etc/rc6.d are executed. This only happens on the serial line. If I issue a reboot command over the SSH terminal then it seems to work properly. It even works after the serial line gets stuck. Only the serial line has a problem with rebooting/poweroff.
How can I figure out what's causing the problem?
Can I fix it?