Technical article 104907

What are some of the basic utilities to verify system integrity?

OpenServer 5

Written · Last revised

Problem

I am concerned about the integrity of my SCO system software. What are some of the basic utilities that I can run as a System Administrator to help verify and correct system software problems?

Cause

The causes can be widely varied.  There could be some kind of
hardware or software corruption, operator error, accidental
or malicious file removal.

Solution

Here are some utilities that help to check and correct some basic
possible problem areas in the system.  Unless otherwise noted,
a specific command applies to any of the operating environments
as mentioned in the RELEASE section above.  Be sure you are in
System Maintenance (single-user) mode when you perform these.
1. Filesystem check:
# dtype /dev/rroot                       (Should return HTFS)
eg: dtype /dev/root
    /dev/root
    # dtype /dev/rroot
    /dev/rroot      : HTFS filesystem
For HTFS/DTFS filesystems:
# fsck /dev/root
For Non HTFS/DTFS filesystems:
# fsck -D /dev/root

If this fails then add the -ofull flag to the "fsck" command.

Notes regarding fsck:
- If you see "BOOT UNIX (NO SYNC)" at the end of fsck, it
  means you should power off the computer without typing any
  more commands.  This ensures that changes made to the hard
  drive during fsck will not get undone by typing further
  commands.
-D    This option checks directories for bad blocks. This is
       useful after system crashes.
       This option does not apply to HTFS (TM) or DTFS filesystems.

See also the "-s/-S" options for additional troubleshooting.

- For SCO OpenServer Release 5.0.0, it is recommended you do
  a full filesystem check.  To do so, you must boot up from
  your emergency boot/root floppy set and at the prompt type:
# fsck -s -ofull -D  /dev/hd0root

- For a pre-OpenServer 5.0.0 Release, be sure you have enough directory entries available in lost+found before you run fsck. To check this, type:

# cd /lost+found
# hd . | wc -l        # the output should be at least 40

2. Verify and fix permissions, check for missing system files:

===== For SCO OpenServer Release 5.0.0: =====
# scoadmin
OR
# scoadmin software manager
OR
# custom
Then highlight the product you wish to verify and, from the
pull-down menu, select:  Software -> Verify Software.  Checkmark
the types of tests you wish to do.  At the minimum, you
should run the verification one time through for "Normal system
state (Quick)" and then again for "Broken/Missing Symbolic Links".
===== For Pre-OpenServer Release 5.0.0: =====
# cd /
# fixperm -cs -dRTS -dBASE -dEXT  /etc/perms/*  2>&1  | more
===== For OpenServer 5.0.0 onwards: ======
Notes regarding fixperm:

- You can ignore the messages regarding "not an empty file".

- The first time through, it is recommended you run fixperm on all the files in /etc/perms, including the -n option, which signifies to fixperm to report errors but make no changes:

# fixperm -n /etc/perms/*  2>&1  | more

- There are various ways to limit fixperm's scope. The above is the most general, as it operates on all the files in /etc/perms.

The first way to limit the scope is to specify one or
more -d options.  For example, if you wanted to only check
and repair the files for the LPR package, you could do:
# fixperm  -cs -dLPR  /etc/perms/*
The second way to limit fixperm's scope is to specify the
fixperm files you wish to check.  Each fixperm file can
contain one or more package names.  As an example, to check
and repair the files for the extended utilities, you can
specify the perms file /etc/perms/ext.  This file contains
the various packages belonging to the suite of extended
utilities.  You can run:
# fixperm  -cs  /etc/perms/ext

You can combine more than one -d option, and/or more than one perms filename, depending on what you need.

- To check all permissions then run:

# fixperm -cs /etc/perms/* 2>&1 | more

- To quickly check for missing files:

# fixperm -n /etc/perms/*  2>&1  | grep "not found"

'fixperm' is also available with SCO UnixWare7.

'fixperm' refers to missing files in /etc/perms with SCO OpenServer6. This issue has been reported to SCO Engineering.

An example of how 'fixperm' can be used can be see below in the NOTE section.

3. Restoring missing files.
Files that are missing may have been moved to the lost+found
directory, where their names have been changed to inode numbers.
Check the lost+found directories (one should be located in each
filesystem) for files that were put there during fsck.  You
may want to use "file", "what" or "dtype" commands to try and
determine file types, and "more" or "hd <filename>|more" to try
and determine what the file actually is.  If you make this
determination, you can move (mv) the file back to its original
name and location.  Otherwise, you can restore the missing files
from either your backup or possibly from original release media
using the "customextract" (OpenServer Release 5.0.0) or "custom"
(pre-OpenServer 5.0.0).

4. Verify and correct security subsystems problems:

# /tcb/bin/authck -a | more
# /tcb/bin/integrity -e | more
# /etc/fixmog -v | more
# /etc/custom -x -V symlinks
Notes regarding authck/fixmog:

- Individual users from /etc/passwd file have related information in /tcb/file/auth/?/<logname>, where '?' is the first character of login name.

- Subsystem authorizations are maintained in the files under /etc/auth/subsystems.

5. Check the root filesystem for large files with:

# dfspace
and
# df -v

If the available space is low then use the following to determine the directories with the large size files in them:

To find the files I ran:
# cd /
# du -s -k *

For example, if you notice /dev is high then:

# cd /dev
# du -s -k *
to find the offending file(s)

Please note, "df" / "dfspace" and "du" calculate disk usage differently.

"du" will use raw, physical space; while "df" and "dfspace" will include overhead for the filesystem and incomplete, allocated inode space.

For example, if a 2K block is only 1K full, "df" and "dfspace" would show 2K of space and "du" would show 1K of space.

In which case, it is suggested to run:

# du -r -s -k *
as this overrides any permission problems.
In addition, applications occasionally will create a file and then
unlink the file name while keeping the file open.  This gives the
application a file to write to that is invisible to the rest of the
system, but the space is not freed until the last process that has it
open closes the file.

If you are running an application that does this, that could result in space being used but not being visible to du.

If you reboot the system and still see a discrepency before any applications start up, then you may need to consider re-creating the filesystem.

NOTE:     To recreate filesystems on the root disk (other than the / root
          filesystem).
# divvy /dev/hd0a - First Active disk

For reference, files which can be divvy'ed:

hd00 - Entire Disk hd01 - first partition hd02 - second partition

NOTE:     An example of where fixperm can be used is in the following example:

User's are having trouble logging in and getting the following:

slab7(5.0.7)# su - testuser
Last   successful real login for testuser: NEVER
logname: error while reading /etc/utmp: Permission denied (error 13)
TERM = (ansi)
tput: no terminfo database
prwarn: Cannot determine your username!
$ idit
uid=17162 gid=50 groups=50

After running 'fixperm -n /etc/perms/*' we can see /var permissions were set to 700 rather than 755.

Changing this permission fixed the issued.

See also

In the SCO Reference manual or scohelp online man pages:

fsck(ADM), fixperm(ADM), authck(ADM), fixmog(ADM),
custom(ADM), customextract(ADM)

From the Xinuos technical article database, record 104907. Reproduced with permission. The original is at www.sco.com/ta/104907, which is reachable but blocked from search engines.

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.