Subject: reboot problems
To: None <port-vax@netbsd.org>
From: Rumen Svobodnikov <rumen@l2.tu-varna.acad.bg>
List: port-vax
Date: 05/28/1999 15:58:15
  I have problems with /sbin/shutdown (or /sbin/reboot) - when i do 
"shutdown -r now" it doesn't reboot, instead drops reboot.core. But if i just
type /sbin/reboot it reboots OK. Anyway here is more info:

[--snip--]
alpha# shutdown -r now
Shutdown NOW!
shutdown: [pid 161]
alpha#                                                                                
*** FINAL System shutdown message from root@alpha.tu-varna.acad.bg ***
System going down IMMEDIATELY



System shutdown time has arrived

About to run shutdown hooks...

Done running shutdown hooks.

alpha# ls -l
total 86
-rw-r--r--  1 root  wheel     20 May 18 17:30 .bash_history
-rw-r--r--  2 root  wheel    897 Apr 29 02:37 .cshrc
-rw-------  1 root  wheel     59 Apr 29 02:37 .klogin
-rw-r--r--  1 root  wheel    122 Apr 29 02:37 .login
-rw-r--r--  2 root  wheel    454 Dec 31  1969 .profile
-rw-------  1 root  wheel  82100 May 28 15:16 reboot.core
alpha# gdb --core=reboot.core /sbin/reboot
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "vax--netbsd"...(no debugging symbols found)...
Core was generated by `reboot'.
Program terminated with signal 11, Segmentation fault.
#0  0xc in ?? (79482913, 547410000, -581509807, -1325204656)
(gdb) bt
#0  0xc in ?? (79482913, 547410000, -581509807, -1325204656)
#1  0x500ca950 in ?? (Cannot access memory at address 0xa9c55003.
)
Cannot access memory at address 0xc7515014.
[--snip--]

Here is ktrace of shutdown -r now (actualy only part of it - at the end)

[--snip--]
   174 shutdown CALL  write(0x1,0x34000,0x1e)
   174 shutdown GIO   fd 1 wrote 30 bytes
       "Done running shutdown hooks.\r
       "
   174 shutdown RET   write 30/0x1e
   174 shutdown CALL  execve(0x1fa0,0x7ffffc50,0)
   174 shutdown NAMI  "/sbin/reboot"
   174 reboot   EMUL  "netbsd"
   174 reboot   PSIG  SIGTRAP caught handler=0x800ce2f0 mask=() code=0x0
   174 reboot   PSIG  SIGSEGV SIG_DFL
   174 reboot   NAMI  "reboot.core"
[--snip--]

Here is ktrace of a successfull reboot (i.e. directly calling /sbin/reboot)

[--snip--]
   197 ktrace   RET   ktrace 0
   197 ktrace   CALL  execve(0x7ffffd77,0x7ffffd44,0x7ffffd4c)
   197 ktrace   NAMI  "/sbin/reboot"
   197 reboot   EMUL  "netbsd"
   197 reboot   CALL  geteuid
   197 reboot   RET   geteuid 0
   197 reboot   CALL  __getlogin(0x214e4,0x10)
   197 reboot   RET   __getlogin 0
   197 reboot   CALL  gettimeofday(0x7fffeff4,0)
   197 reboot   RET   gettimeofday 0
   197 reboot   CALL  __sysctl(0x7fffef80,0x2,0x31f80,0x7fffef7c,0,0)
   197 reboot   RET   __sysctl 0
   197 reboot   CALL  break(0x32140)
   197 reboot   RET   break 0
   197 reboot   CALL  break(0x32ffc)
   197 reboot   RET   break 0
   197 reboot   CALL  break(0x34ffc)
   197 reboot   RET   break 0
   197 reboot   CALL  access(0x5ea4,0x4)
   197 reboot   NAMI  "/etc/localtime"
   197 reboot   RET   access 0
   197 reboot   CALL  open(0x5ea4,0,0)
   197 reboot   NAMI  "/etc/localtime"
   197 reboot   RET   open 5
   197 reboot   CALL  read(0x5,0x7fffcc88,0x1f08)
   197 reboot   GIO   fd 5 read 735 bytes
[cut]
   197 reboot   RET   read 735/0x2df
   197 reboot   CALL  close(0x5)
   197 reboot   RET   close 0
   197 reboot   CALL  socket(0x1,0x2,0)
   197 reboot   RET   socket 5
   197 reboot   CALL  fcntl(0x5,0x2,0x1)
   197 reboot   RET   fcntl 0
   197 reboot   CALL  connect(0x5,0x21504,0xe)
   197 reboot   NAMI  "/var/run/log"
   197 reboot   RET   connect 0
   197 reboot   CALL  sendto(0x5,0x7ffff448,0x2c,0,0,0)
   197 reboot   GIO   fd 5 wrote 44 bytes
       "<10>May 28 15:46:23 reboot: rebooted by root"
   197 reboot   RET   sendto 44/0x2c
   197 reboot   CALL  open(0x1d24,0x9,0)
   197 reboot   NAMI  "/var/log/wtmp"
   197 reboot   RET   open 6
   197 reboot   CALL  __fstat13(0x6,0x7ffffc20)
   197 reboot   RET   __fstat13 0
   197 reboot   CALL  gettimeofday(0x7ffffbf8,0)
   197 reboot   RET   gettimeofday 0
   197 reboot   CALL  write(0x6,0x7ffffc80,0x24)
   197 reboot   GIO   fd 6 wrote 36 bytes
       "~\0\0\0\0\0\0\0shutdown\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^_\M^PN7"
   197 reboot   RET   write 36/0x24
   197 reboot   CALL  close(0x6)
   197 reboot   RET   close 0
   197 reboot   CALL  sync
   197 reboot   RET   sync 0
   197 reboot   CALL  kill(0x1,0x12)
   197 reboot   RET   kill 0
   197 reboot   CALL  __sigaction14(0x1,0x7ffffc98,0x7ffffc80)
   197 reboot   RET   __sigaction14 0
   197 reboot   CALL  __sigaction14(0x2,0x7ffffc98,0x7ffffc80)
   197 reboot   RET   __sigaction14 0
   197 reboot   CALL  __sigaction14(0x3,0x7ffffc98,0x7ffffc80)
   197 reboot   RET   __sigaction14 0
   197 reboot   CALL  __sigaction14(0xf,0x7ffffc98,0x7ffffc80)
   197 reboot   RET   __sigaction14 0
   197 reboot   CALL  kill(0xffffffff,0xf)
   197 reboot   RET   kill 0
   197 reboot   CALL  nanosleep(0x7ffffcb0,0x7ffffca8)
   197 reboot   RET   nanosleep 0
   197 reboot   CALL  sync
   197 reboot   RET   sync 0
   197 reboot   CALL  nanosleep(0x7ffffcb0,0x7ffffca8)
   197 reboot   RET   nanosleep 0
   197 reboot   CALL  kill(0xffffffff,0x9)
   197 reboot   RET   kill -1 errno 3 No such process
   197 reboot   CALL  reboot(0,0)
[--snip--]

  It seems that when called from shutdown, reboot segfaults somewhere at the
beginning (before even calling geteuid()).
  Btw shutdown -h doesnt work either - it results in halt.core