Technical article 105010

My system hangs when I try to shut it down.

OpenServer 5.0.0

Written · Last revised

Problem

After typing "shutdown -g0 -y" my system hangs and I never see the safe to power off prompt.

Cause

The most frequent causes of these types of hangs are:

* a missing system file * a corrupted system file * a syntax error in a user defined or non-SCO shut down script * an NFS mounted filesystem that was not unmounted prior to beginning the shutdown procedure

Solution

If interrupting the system does not free the hang, you will have
to turn the machine off.  When you power the machine on again, fsck
will be cleaning the root filesystem.  When the control-D prompt
appears, enter the root password to enter System Maintenance mode.

To ensure that basic system software is present on your system, either run fixperm or the verify function of software manager, depending on which version of the operating system you have running.

For SCO UNIX Operating System Version 4.x, run fixperm, from the
root directory, to verify software completeness.  For example:
# cd /
# fixperm -cs /etc/perms/*
For SCO OpenServer Release 5, run the verify option of software
manager.  For example:
scoadmin -> software manager -> software -> verify software
choose "Normal system state (quick)" and "Broken/missing symbolic
links"

If the verification process turns up a missing piece of system software, replace it from your last good backup, or from the original installation media, using custom.

At this point, try to shut the system down by typing
/etc/shutdown -g0 -y at root's prompt.  If the system still
hangs, then there is probably a syntax error or corrupt file.
When corrupt files or syntax errors in shut down scripts are the
source of the problem, turn on a trace in the system shut down
files, power cycle the machine, and watch the trace output to see
where the source of the problem is.  This process can take a while.
When the system is going from multiuser mode to the safe to power
off state, it executes a series of shell scripts found in the
/etc/rc0.d directory.  Generally, these scripts are executed one
after another.  On SCO OpenServer 5 systems, scripts that begin
with the letter "P" are executed simultaneously.
When you turn the trace on, commands that are executed during system
shut down (from the shut down scripts in /etc/rc0.d which are
normally silent) are echoed to the screen.  When the system hangs,
you can tell which script was executing and what command was
being run.
To turn the trace on, edit the /etc/rc0 file, in system maintenance
mode, using the editor of your choice.  Add 'set -x' to the top of
the file.  For example:
# vi /etc/rc0
#       "Run Commands" for init state 0
#       Leaves the system in a state where it is safe to turn off the power
#       or go to firmware.
set -x
a=`stty -g`     #save stty values for later restoration
echo 'The system is coming down.  Please wait.'

Once you have corrected the syntax error or replaced the corrupt binary that was causing the system to hang, turn the trace off by editing the /etc/rc0 file and removing the set -x line in the file.

If you suspect that an NFS mounted file system may be at fault, then you must use the umount(ADM) command to release the filesystem prior to beginning the shutdown procedure. You can use the mount(ADM) command, with no options, to view which filesystems are currently mounted.

From the Xinuos technical article database, record 105010. Reproduced with permission. The original is at www.sco.com/ta/105010, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.