Re: Can't shutdown processes



On Fri, Dec 14, 2001 at 02:49:37AM -0800, Jeffrey Cobb wrote:
> telinit 0 halts the system.

Excelent.

> smb is NOT running.  I have to start it to access shares.
> 
> I had the system crash a while ago and it hasn't been shutting down proper.
> When I boot everything seems to come up okay, no errors or failures.  But
> when I shutdown I get failures because these processes I guess really didn't
> start.  It's confusing because everything "looks" okay when I boot, but the
> processes that are listed "ok" on boot aren't actually running.
> 
> There must be over a dozen processes that don't shut down proper (I assume
> because they never start).

If its that run-level 3 shutdown, then its not shutting down at all. Its shifting to a different run level, with different processes running (eg. Might not run X. If so It might *look* like its shutting down, but its just stopping X.). So if you shift to run-level 3 and then power off, its just the same as powering off while its running (I presume youre not running a journalling fs) which is bad.

How are you initiating the shutdown that isn't really a shutdown, that actually takes it to run level 3?

If you go

shutdown -h now

or

halt

Does it shutdown (run level 0)?

If so, then the shutdowns are working. Whatever your doing to 'shut it down' isn't actually initiating a shutdown at all.

> If this is the case then why aren't they starting?

Dunno. Why aren't they?

What system are you using? For the rest of this Im gonna assume Debian because the paths are shorter to type. If your using redhat or similar, then insert a /rc.d/ between the etc and the rest of the path (theres an extra directory in the way for some reason on those systems)

OK. to try and explain how the system works.

Run levels weve covered.

There are these scripts that start and stop things. For instance

/etc/init.d/ssh stop

stops the ssh server
type them in without an argument to see the possibilities

water:~# /etc/init.d/ssh
Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}

so to start ssh Id go

/etc/init.d/ssh start

so go

ls /etc/init.d

and look at all the scripts in there. Lots.

now theres these other directories that start with rc. The default runlevel for debian is 2, so its 'control' directory for that runlevel is /etc/rc2.d/

water:~# ls -alF /etc/rc2.d/
total 9
drwxr-xr-x    4 root     root         1024 Dec  7 14:16 ./
drwxr-xr-x  118 root     root         6144 Dec 14 10:09 ../
lrwxrwxrwx    1 root     root           18 Jun  5  2000 S10sysklogd -> ../init.d/sysklogd*
lrwxrwxrwx    1 root     root           18 Jun  7  2000 S10watchdog -> ../init.d/watchdog*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 S12kerneld -> ../init.d/kerneld*
lrwxrwxrwx    1 root     root           16 Nov  2 17:39 S13pcmcia -> ../init.d/pcmcia*
lrwxrwxrwx    1 root     root           18 Nov 12 17:35 S20arpwatch -> ../init.d/arpwatch*
lrwxrwxrwx    1 root     root           14 Feb 13  2001 S20exim -> ../init.d/exim*
lrwxrwxrwx    1 root     root           15 Jun  5  2000 S20inetd -> ../init.d/inetd*
lrwxrwxrwx    1 root     root           18 Jun  7  2000 S20iplogger -> ../init.d/iplogger*
lrwxrwxrwx    1 root     root           14 Jun 25  2000 S20ippl -> ../init.d/ippl*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 S20logoutd -> ../init.d/logoutd*
lrwxrwxrwx    1 root     root           15 Jun 26  2000 S20lprng -> ../init.d/lprng*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 S20quota -> ../init.d/quota*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 S20samba -> ../init.d/samba*
lrwxrwxrwx    1 root     root           18 Dec  7 14:16 S20sendmail -> ../init.d/sendmail*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 S20ssh -> ../init.d/ssh*
lrwxrwxrwx    1 root     root           13 Jul  3 17:55 S20xfs -> ../init.d/xfs*
lrwxrwxrwx    1 root     root           17 Jun  7  2000 S20xfs-xtt -> ../init.d/xfs-xtt*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 S20xfstt -> ../init.d/xfstt*
lrwxrwxrwx    1 root     root           17 Mar 22  2001 S30sensors -> ../init.d/sensors*
lrwxrwxrwx    1 root     root           13 Aug 23  2000 S88esd -> ../init.d/esd*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 S89atd -> ../init.d/atd*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 S89cron -> ../init.d/cron*
lrwxrwxrwx    1 root     root           18 Apr 13  2001 S90vmware -> /etc/init.d/vmware*
lrwxrwxrwx    1 root     root           19 Jun  5  2000 S99rmnologin -> ../init.d/rmnologin*

Each of these is a symbolic link to an init.d script we saw above. The scripts that start and stop things. If the link start with an 'S', thats a start. If it starts with a 'K' thats a stop (kill). The numbers are the orders they are run in. So when the system enters run level 2, it looks in this directory, and first runs S10sysklogd. Its an S, so it runs it with a start command. So it would run /etc/init.d/sysklogd start. That starts the syslog. and so on down to the end, starting one after the other.

Although it may look like all these start, thats not entirely true. I dont run sendmail, but S20sendmail -> ../init.d/sendmail is in there.

If I go 

/etc/init.d/sendmail start

nothing happens, because I have no sendmail binaries installed.


Lets look at another runlevel. Say, run level 6, reboot

water:~# ls -alF /etc/rc6.d/
total 8
drwxr-xr-x    2 root     root         2048 Dec  7 14:16 ./
drwxr-xr-x  118 root     root         6144 Dec 14 10:09 ../
lrwxrwxrwx    1 root     root           13 Mar 27  2001 K01gdm -> ../init.d/gdm*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 K01xdm -> ../init.d/xdm*
lrwxrwxrwx    1 root     root           18 Apr 13  2001 K08vmware -> /etc/init.d/vmware*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 K11cron -> ../init.d/cron*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 K12kerneld -> ../init.d/kerneld*
lrwxrwxrwx    1 root     root           16 Jun  7  2000 K13dhcpcd -> ../init.d/dhcpcd*
lrwxrwxrwx    1 root     root           13 Jun  5  2000 K14ppp -> ../init.d/ppp*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 K19bind -> ../init.d/bind*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 K20alsa -> ../init.d/alsa*
lrwxrwxrwx    1 root     root           16 Jun  7  2000 K20apache -> ../init.d/apache*
lrwxrwxrwx    1 root     root           20 Jun  7  2000 K20apache-ssl -> ../init.d/apache-ssl*
lrwxrwxrwx    1 root     root           18 Nov 12 17:35 K20arpwatch -> ../init.d/arpwatch*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 K20cipe -> ../init.d/cipe*
lrwxrwxrwx    1 root     root           14 Jun  7  2000 K20dhcp -> ../init.d/dhcp*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 K20dictd -> ../init.d/dictd*
lrwxrwxrwx    1 root     root           14 Feb 13  2001 K20exim -> ../init.d/exim*
lrwxrwxrwx    1 root     root           16 Jun  7  2000 K20fakebo -> ../init.d/fakebo*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 K20gpm -> ../init.d/gpm*
lrwxrwxrwx    1 root     root           15 Jun  5  2000 K20inetd -> ../init.d/inetd*
lrwxrwxrwx    1 root     root           18 Jun  7  2000 K20iplogger -> ../init.d/iplogger*
lrwxrwxrwx    1 root     root           14 Jun 25  2000 K20ippl -> ../init.d/ippl*
lrwxrwxrwx    1 root     root           19 Jun  7  2000 K20linuxlogo -> ../init.d/linuxlogo*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 K20logoutd -> ../init.d/logoutd*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 K20lpd -> ../init.d/lpd*
lrwxrwxrwx    1 root     root           15 Jun 26  2000 K20lprng -> ../init.d/lprng*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 K20makedev -> ../init.d/makedev*
lrwxrwxrwx    1 root     root           20 Jun  7  2000 K20mgetty-fax -> ../init.d/mgetty-fax*
lrwxrwxrwx    1 root     root           18 Jun  5  2000 K20modclean -> ../init.d/modclean*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 K20quota -> ../init.d/quota*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 K20rplay -> ../init.d/rplay*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 K20samba -> ../init.d/samba*
lrwxrwxrwx    1 root     root           18 Dec  7 14:16 K20sendmail -> ../init.d/sendmail*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 K20ssh -> ../init.d/ssh*
lrwxrwxrwx    1 root     root           17 Jun  7  2000 K20sslwrap -> ../init.d/sslwrap*
lrwxrwxrwx    1 root     root           12 Jun  7  2000 K20ud -> ../init.d/ud*
lrwxrwxrwx    1 root     root           13 Jul  3 17:55 K20xfs -> ../init.d/xfs*
lrwxrwxrwx    1 root     root           17 Jun  7  2000 K20xfs-xtt -> ../init.d/xfs-xtt*
lrwxrwxrwx    1 root     root           15 Jun  7  2000 K20xfstt -> ../init.d/xfstt*
lrwxrwxrwx    1 root     root           26 Jun  7  2000 K20xshipwars-server -> ../init.d/xshipwars-server*
lrwxrwxrwx    1 root     root           21 Jun  7  2000 K20yiff-server -> ../init.d/yiff-server*
lrwxrwxrwx    1 root     root           20 Aug 11  2000 K25hwclock.sh -> ../init.d/hwclock.sh*
lrwxrwxrwx    1 root     root           19 Jun  5  2000 K30setserial -> ../init.d/setserial*
lrwxrwxrwx    1 root     root           21 Jun  7  2000 K41dhcp-client -> ../init.d/dhcp-client*
lrwxrwxrwx    1 root     root           17 Jun  7  2000 K50proftpd -> ../init.d/proftpd*
lrwxrwxrwx    1 root     root           27 Jun  7  2000 K80nfs-kernel-server -> ../init.d/nfs-kernel-server*
lrwxrwxrwx    1 root     root           18 Jun  7  2000 K80watchdog -> ../init.d/watchdog*
lrwxrwxrwx    1 root     root           20 Jun  7  2000 K81nfs-common -> ../init.d/nfs-common*
lrwxrwxrwx    1 root     root           16 Nov  2 17:39 K87pcmcia -> ../init.d/pcmcia*
lrwxrwxrwx    1 root     root           13 Jun  7  2000 K89atd -> ../init.d/atd*
lrwxrwxrwx    1 root     root           18 Jun  5  2000 K90sysklogd -> ../init.d/sysklogd*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 S10portmap -> ../init.d/portmap*
lrwxrwxrwx    1 root     root           18 Jun  5  2000 S20sendsigs -> ../init.d/sendsigs*
lrwxrwxrwx    1 root     root           17 Jun  5  2000 S30urandom -> ../init.d/urandom*
lrwxrwxrwx    1 root     root           22 Aug 11  2000 S31umountnfs.sh -> ../init.d/umountnfs.sh*
lrwxrwxrwx    1 root     root           20 Jun  5  2000 S35networking -> ../init.d/networking*
lrwxrwxrwx    1 root     root           18 Jun  5  2000 S40umountfs -> ../init.d/umountfs*
lrwxrwxrwx    1 root     root           16 Jun  5  2000 S90reboot -> ../init.d/reboot*

Here theres a whole bunch of K symlinks. These the system runs as /etc/init.d/blah stop. So all those K links will stop those services. At the end theres some S's. The last one is S90reboot. It runs /etc/init.d/reboot start. That reboots the system.

/etc/rc0.d is similar. But it has a whole bunch of K's and ends with a

lrwxrwxrwx    1 root     root           14 Jun  5  2000 S90halt -> ../init.d/halt*

So when we went telinit 0, we told it to shift to run level 0, and it ran all the things in /etc/rc0.d in order.

So why aren't things starting up?

First find out what your default run level is. Look in /etc/inittab for it. Its a line that looks like

# The default runlevel.
id:2:initdefault:

The number is the default run level it starts up into. Then go to its rc directory. Whats in that? Mail back a ls -alF listing of it. That will show exactly whats going on at startup.

Oh, and give us a listing (-alF) of the rc3.d directory as well.

Kind Regards

Crispin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]