On Monday 20 October 2008 11:30:27 pm Chris Craig wrote:
> I'm helping to develop a MPC8XX-based board that uses a basic
> filesystem, kernel 2.6.12 and busybox v1.11.2, and am having problems
> with halt and reboot. Neither of those commands seem to be using the
> actions specified in inittab. Here's the contents of inittab:
>
> ---------- /etc/inittab ----------
> # This is run first
> ::sysinit:/etc/init.d/rcS
>
> # /bin/login invocation on the console
> # Must be first 'respawn' or 'askfirst' entry to avoid ^C problem
BTW: what is "^C problem" ?
> ::askfirst:/sbin/getty 9600 ttyS0
>
> # multi-user script (network, daemons, etc)
> ::once:/etc/init.d/rcM
>
> ::shutdown:/etc/init.d/rc0
> ::restart:/etc/init.d/rc6
> ----------------------------------
>
> On boot I get the following messages, which suggest to me that the
> actions are initialized:
>
> ---------- boot messages ----------
> init started: BusyBox v1.11.2 (2008-09-19 11:39:25 EDT)
> command='/etc/init.d/rcS' action=1 tty=''
>
> command='/sbin/getty 9600 ttyS0' action=4 tty=''
>
> command='/etc/init.d/rcM' action=16 tty=''
>
> command='/etc/init.d/rc0' action=64 tty=''
>
> command='/etc/init.d/rc6' action=128 tty=''
>
>
> Please press Enter to activate this console.
> -----------------------------------
>
> Now the rcS script runs fine, the rcM script also runs fine (it actually
> checks a uBoot environment variable called "syslevel" to see if it
> should bail out), and getty runs fine.
>
> When I type "halt" or "reboot" at a prompt, it just returns to the
> prompt.
It just sends SIGUSR1, SIGUSR2 or SIGTERM to init.
If nothing happens, it means init did not react correctly
to these signals.
(To other readers - see why I think "signalling init on reboot"
is a stupid idea? It makes fixing it so much more complex
and difficult. Oh well)
> If I run "halt -f" or "reboot -f" the system reboots fine,
It does the "hard reboot" by asking kernel to do it immediately.
> and
> if I run the rc0 script manually it does the needful (aside: my in-laws
> are from India).
>
> Am I wrong in assuming that halt and reboot should perform the actions
> specified in the shutdown/restart lines of inittab, respectively?
Yes.
You need to debug init. This is the signal handler in init.c which should
trigger by these signals. Add debug code as shown below:
static int debug_fd = -1;
static void halt_reboot_pwoff(int sig)
{
const char *m = "halt";
int rb;
debug_fd = xopen("/somewhere/init.log", O_WRONLY | O_TRUNC | O_CREAT, 0777);
write(debug_fd, "1", 1);
kill_all_processes();
write(debug_fd, "2", 1);
rb = RB_HALT_SYSTEM;
if (sig == SIGTERM) {
m = "reboot";
rb = RB_AUTOBOOT;
} else if (sig == SIGUSR2) {
m = "poweroff";
rb = RB_POWER_OFF;
}
write(debug_fd, "3", 1);
message(L_CONSOLE | L_LOG, "Requesting system %s", m);
write(debug_fd, "4", 1);
/* allow time for last message to reach serial console */
sleep(2);
write(debug_fd, "5", 1);
init_reboot(rb);
write(debug_fd, "6", 1);
loop_forever();
write(debug_fd, "7", 1);
}
What do you see in /somewhere/init.log after unsuccessful reboot without -f?
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox