[SM-Grimoire-Bugs] [Bug 13114] simpleinit doesn't stop services during shutdown on recent kernels

bugzilla-daemon at bugs.sourcemage.org bugzilla-daemon at bugs.sourcemage.org
Tue Feb 27 19:31:01 EST 2007


http://bugs.sourcemage.org/show_bug.cgi?id=13114





------- Additional Comments From jblosser-smgl at firinn.org  2007-02-27 18:31 -------
(In reply to comment #36)
> (In reply to comment #33)
> > strace takes a -p pid command to attach to a pid.  It can attach to up to 32
> > processes according to the manual.  I'm not going to try attaching to the box
> > I'm typing on, but that should work to attach to init.
> 
> Yeah, except you can't attach to some processes, like init:
> 
> # strace -p 1
> attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted

I got an strace onto init by booting with bash as init and then running init
manually.  When you do this it switches to 'user mode init' where not everything
is there, but it lets me strace it anyway.

Of course, doing it this way, everything looks normal on the shutdown.  :-|  But
at least we can see what it's supposed to look like...

bash-3.1# strace init&
[1] 759
bash-3.1# execve("/sbin/init", ["init"], [/* 7 vars */]) = 0
brk(0)                                  = 0x8051000
...
everything starts up, then it gets to its wait loop:

read(3, 0xbfc9366c, 4096)               = -1 EAGAIN (Resource temporarily
unavailable)
rt_sigsuspend([]
bash-3.1#

I can send it SIGCHLDs here to wake it up:
bash-3.1# kill -SIGCHLD 760
bash-3.1# )                       = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now ~[KILL STOP RTMIN])
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, 0xbfc948c4, WNOHANG)        = -1 ECHILD (No child processes)
read(3, 0xbfc9366c, 4096)               = -1 EAGAIN (Resource temporarily
unavailable)
rt_sigsuspend([]
bash-3.1#

So this is the state it's in when initctl starts its thing.  Once we do that we
 get:

bash-3.1# initctl -f -r
INIT_ROOT environment variable not set, using current directory!
)                       = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now ~[KILL STOP RTMIN])
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, 0xbfc948c4, WNOHANG)        = -1 ECHILD (No child processes)
read(3, "\2\0\0\200b\n\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7e936f8) = 2659
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7e936f8) = 2660
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, 0xbfc948c4, WNOHANG)        = 0
read(3, 0xbfc9366c, 4096)               = -1 EAGAIN (Resource temporarily
unavailable)
rt_sigsuspend([])                       = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now ~[KILL STOP RTMIN])
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 2659
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
kill(2660, SIGKILL)                     = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
write(1, "init: ", 6init: )                   = 6
write(1, "Stopped service: rc\n", 20Stopped service: rc
)   = 20
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7e936f8) = 2661
rt_sigprocmask(SIG_SETMASK, [], Leaving runlevel default...
NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7e936f8) = 2662
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}], WNOHANG) = 2660
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
open("/root/tmp/var/run/utmp", O_RDWR)  = -1 ENOENT (No such file or directory)
open("/root/tmp/var/run/utmp", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/root/tmp/var/run/utmp", O_RDWR)  = -1 ENOENT (No such file or directory)
open("/root/tmp/var/run/utmp", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], NULL, 8) = 0
waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 2661
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
kill(2662, SIGKILL)                     = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
write(1, "init: ", 6init: )                   = 6
write(1, "Stopped service: %default\n", 26Stopped service: %default
) = 26

and it goes on for quite a while.  Does anyone want the whole thing?  I'm not
sure how useful it would be, we really need to go into simpleinit.c and see what
we can see there I think.  Who wants to take the next turn?  :-P


-- 
Configure bugmail: http://bugs.sourcemage.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the SM-Grimoire-Bugs mailing list