TOC BACK FORWARD HOME

UNIX Unleashed, Internet Edition

- 27 -

AIX

by Chris Byers

If someone were to ask you how much you knew about AIX or RS6000, what would your response be? Everything? An adequate amount? What's AIX?

Obviously, no one person could possibly know everything there is to know about every version of AIX running on all platforms, given IBM's astounding variety of hardware and software.

This chapter takes an in-depth look into many of the common questions that people often have about their particular system, with each section focusing on a specific area of AIX. The areas covered are:

This arrangement will make it easier to quickly find information on the specific topic you have questions about. This chapter is comprehensive, but not all-inclusive. If you can't find the specific answer to a problem you are having, there's a good possibility you will at least find clues to solve your particular problem.

General Concepts

In this section, we will deal with some basic concepts of AIX.

What Are the Differences Between AIX and Other UNIX Flavors?

AIX has several text files located in /usr/lpp/bos with specific information that is useful for someone coming over from another flavor of UNIX.

The README file in particular goes into some general information on the differences, as does the bsd file. The bsd file is particularly useful to someone from a BSD or System V background.

AIX generally is a combination of System V and BSD. In creating the operating system, IBM followed the conventions of IEEE, POSIX 1003.1, ANSI C, FIPS, and the X/Open Issue 3.

What Is Meant by the Object Database and What Does It Do?

Unlike most UNIX flavors, AIX provides a "layer of abstraction", allowing one to dynamically reconfigure the system kernel without the necessity of rebooting.

AIX uses the Object Database to allow this dynamic configuration. It stores the bulk of system management information in /etc/objrepos, /usr/lib/objrepos, and /usr/share/lib/objrepos. The Object Database Manager (ODM) is used to administer the files, or objects, in those directories.

The ODM is simply a set of library routines and programs that enable basic object oriented database facilities used to modify the system dynamically.

The System Management Utility Tool menu, known as SMIT, should, in most cases, be used to manipulate the system object classes.

How Can I Tell Which Version of AIX I Have?

In version 3.2.5 and above, you can run the oslevel command. Check out the options you have with this command by using the -h option.

On all versions, you can use the command lslpp -h bos.obj to show all the database lines that refer to the Basic Operating System (BOS). This will also show the specific fix ID and release number of each patch loaded onto the system, as well as the date and time of loading and whether or not the loading and commit were successful.

Starting with AIX 3.2.4, the OS was broken down into subsystems to help avoid confusion with multiple versions of patches and fixes. This way an update can be applied to an entire subsystem.

You can also use another option with lslpp (for example, lslpp -m bos.obj) to show the specific updates and levels the system is running. It is highly recommend that you update to at least 3.2.4, unless you have an application that can run only on earlier versions.

The SMIT Utility

SMIT is a very handy system administration utility. Like SAM in HP-UX and admintool in Solaris, it simply compiles all the required command line commands with all the correct options needed to perform a task. These are stored in your home directory in the files smit.log and smit.script.

Because AIX has a layer of abstraction, certain system commands might not only be named differently, but they might work quite differently as well. SMIT can keep you out of trouble in most cases, so even if you are used to command line administration, it is well worth your while to pick up SMIT.

How Would I Import an /etc/passwd and /etc/group File from Another Machine?

To do this successfully, you need to run usrck and pwdck on /etc/passwd, and run grpck on /etc/group. AIX will then incorporate the passwords and groups into its database.

How Would I Get Rid of the running man in SMIT (GUI Interface)?

You can either just use the text version of SMIT by running smitty, or you can add an alias to your .kshrc file:

alias smit="smit -C"

How Do I Clean Up utmp?

This was a problem found while running X11R5 on AIX version 3.2. This can be alleviated by adding the following lines at the top of the X11R5mit/clients/xterm/main.c file:

#ifdef AIXV3
#define USE_SYSV_UTMP
#define HAS_UTMP_UT_HOST
#define WTMP_FILENAME "/var/adm/wtmp"
#endif

For xterminal sessions that will go into the wtmp file, you need to define -DWTMP in the Imakefile and be sure the WTMP_FILENAME is set to the right directory and filename.

How Do I Run fsck on /usr?

Any time you run fsck on a file system, it must be unmounted. Unfortunately, you cannot unmount /usr because /bin is symbolically linked to /usr/bin. In addition, /etc/fsck is symbolically linked to /usr/sbin/fsck.

The workaround to this is to boot from the boot or maintenance disks and enter the maintenance mode. At this point, you should enter getrootfs hdisk0 sh instead of getrootfs hdisk0. You can then run "fsck /dev/hd2".

How Can I Run fsck on the Root File System?

Like the /usr file system, you must boot from the maintenance or boot disks and get into maintenance mode. At this point, however, at the prompt you must type /etc/continue hdisk0 exit (hdisk0 should be replaced with the boot disk if it's not the same). You can then run the fsck:

fsck /dev/hd4

How Can I Create a File System that is Greater Than 2 GB in Size?

With the advent of AIX 4.1, it became possible to create file systems greater than 2 GB in size (up to 64 GB). However, each individual file was still limited to only 2 GB.

A limit can also be placed on accounts for file sizes. If a limit is enabled, it defaults to 1 MB. You can change this setting in either smit users or the file /etc/security/limit.

Previous to 4.1, the largest file systems were 2 GB because the largest signed integer possible was 2**31-1. The only way to get around this limitation is to use "raw" partitions (also known as non-file systems).

Is It Possible to Shrink the Size of the /usr File System?

Yes, but it isn't easy. The following sections outline the procedures for each version of AIX.

AIX 3.1

1. Make a backup of /usr find /usr -print | backup -ivf /dev/rmt0.

2. Shutdown into maintenance mode: shutdown -Fm.

3. Export LANG=C.

4. Remove the file system and the logical volume. Ignore an error about the dpmsg not found. Umount /usr rmfs /usr.

5. Make a new logical volume named hd2. Mount it on rootvg with the desired size.

To do this, run the following command:
Mklv -yhd2 -a'e' rootvg NNN
where NNN is equal to the number of 4 MB partitions.

6. Create a file system on /dev/hd2.
rfs -vjfs -dhd2 -m'/usr' -Ayes -p'rw'
7. Mount the new /usr/file system and manually check on it.
/etc/mount /usr
df -v
8. You must restore from the tape at this point. If you skip this step, you won't be able to reboot your system!
restore -xvf /dev/rmt0
9. Now just sync and reboot your system. You will now have a smaller /usr file system.

If You're Using AIX 3.2É

1. Remove all the unnecessary files from /usr.

2. Double-check to make sure all the file systems in the root volume group are mounted. Those that aren't mounted won't be restored to the reinstalled system.

3. Type the command mkszfile. This creates the file /.fs.size that contains a list of the active file systems in the root volume group that will be included in the installation procedure.

4. Now change the size of /usr by editing the .fs.size file. For example, if the /usr is set to 48 MB, the line for /usr in .fs.size will read rootvg 4 hd2 /usr 12 48 jfs. The 12 shows the number of 4 MB physical partitions used, making 48 MB. The physical partition size is 4 MB by default on most systems, except for the model 320, which has a default PP size of 2 MB. In order to reduce the size of /usr from 48 to, say, 32 MB, edit that line to read rootvg 4 hd2 /usr 8 32.


NOTE: Do not enter a size that will be less than that required to fit all of the files back onto /usr during re-installation. Doing so will cause the procedure to fail, and you'll really be up a creek then.
5. Enter the following command:
chdev -l rmt0 -a block=512 -T
6. At this point, make sure to unmount all filesystems that are not in the root volume group.

7. Do a varyoff of all user-defined volume groups if any are present.

varyoffvg VGname
8. If any user-defined volume groups exist, then export them.
 exportvg VGname
9. Now put a tape in the tape drive and do a mksysb.
 mksysb /dev/rmt0 
By doing this, you are doing a complete system backup, including information from the .fs.size file, which is used during the installation procedure for defining how large the file systems will be.

10. Now re-install the system from the mksysb tape you created, using the procedures for BOS installation from a System Backup. If you are using a version previous to 3.2.5, you must choose the option "Install AIX with Current System Settings" for the logical volume size changes to take effect. If you are using version 3.2.5, you need to select the option "Install from a mksysb tape".

11. After you are done re-installing, you can then import any of the user-defined volume groups you exported with the following command:
importvg -y VGname Pvname
VGname is the volume group name you are importing and PVname is can be the name of any one of the physical volumes in the volume group.

12. Now varyon the user-defined volume groups.
varyonvg VGname

Now you have a reduced file system. As you can see, this is a real pain, especially with the downtime and the chance of loosing critical data, so it's best to make the sizes small to start with. Increasing the size of file systems is much easier.

How Can I Change the Tunable Parameters in the Kernel, such as the Number of Processes Per User?

There are two ways of doing this. You can either use SMIT or you can use lsattr to view the current settings and chdev to change the parameters. An example of using lsattr to check the number of processes is:

# lsattr -E -l sys0 -a maxuproc
maxuproc 40 Maximum # of processes allowed per user True

If you want to increase it, you would do the following:

# chdev -l sys0 -a maxuproc=200
sys0 changed

If you want to use SMIT, follow these choices in the menu:

"System Environments and Processes"

"Change / Show Operating System Parameters"

At this screen, you change the parameters by overtyping these fields:

"Maximum number of PROCESSES allowed per user"

"Maximum number of pages in block I/O BUFFER CACHE"

"Maximum number of Kbytes of real memory allowed for MBUFS"

You can also toggle these fields:

"Automatically REBOOT system after a crash (false/true)"

"Continuously maintain DISK I/O history (true/false)"

Can You Mount a Floppy as a File System?

Yes. It will, however, only allow read-access to that disk. That's because, starting with 3.1.5, AIX cannot create a journal log on a disk, because IBM only intended this strategy to be used for temporary access for read-only data.

If you build a file system and mount it on a floppy, it must always be unmounted after use and during the system backup procedures, or this could error out.

To make a file system on a floppy:

1. Create a subdirectory on another file system and put all the files intended to go into the file system there.

2. You must create a prototype file that will contain information about the new file system.
proto /(directory) > (filename)
3. Put a formatted floppy in the drive, and then edit the prototype file and change the first line to <noboot> 0 0.

4. Enter the following command to make the file system on the floppy:

mkfs -p (filename) -V jfs /dev/fd0
5. Create the directory where you will mount the floppy-based file system, usually called /mnt. To mount the file system:
mount -r -V jfs /dev/fd0 /mnt
6. To unmount the file system, just use the umount command as you usually do.
umount /dev/fd0

Just about the only thing this is useful for is if you are going to use it for utility programs or other data that will remain static. Unfortunately, the only way to make changes to anything on this file system is to copy the directory from the floppy into another directory, make the changes, and remake the file system using the preceding steps.

Why Does the Swapper Take Up So Much Paging Space?

When you see this from the ps utility, it is actually showing the entire paging space plus real memory allocated when it shows the swapper process. This is just the way that ps reads that processes, so it is actually normal behavior.

How Can I Reduce the Size of the Default Paging Size on hd6?

To do this, you should follow this procedure:

1. Create a temporary paging space.
mkps -s 20 -a rootvg
2. Change the default paging space so it's not used at the next boot-up.
chps -a n hd6
3. Edit the /etc/rc.boot to change to change swapon /dev/hd6 (in AIX 3.1, edit the /etc/rc.boot4 file) to swapon /dev/paging00.

4. You have to update the information in boot logical volume for 3.1.

bosboot -a for 3.2: bosboot -a -s hdisk0
5. Now you should shutdown and reboot the system.

6. When you're system comes back up you should remove the current hd6 and create a smaller one.

rmps hd6 mklv -y hd6 -t paging rootvg <paging space size in 4Mb blocks>
7. Edit the /etc/rc.boot (or /etc/rc.boot4) file again to change the swapon value back.
swapon /dev/hd6
8. You also have to update the boot logical volume again.
3.1: bosboot -a 3.2: bosboot -a -d hdisk0
9. Now you change the current paging device (paging00) to an inactive state for the next boot.
chps -a n /dev/paging00
10. Finally, shutdown, reboot again, and remove paging00 when it comes back.
rmps paging00

You can display your paging space at any time with the command lsps -a.

How Do You Make Boot Disks for AIX 3.2?

This will require you to have four disks already formatted. To create the appropriate disks, you must do the following:

1. For the boot disk, run bosboot -d /dev/fd0 -a.

2. For the display disk, run mkdispdskt.

3. For the display extension disk, run mkextdskt.

4. And for the Install/Maintenance disk, run mkinstdskt.

How Can I Get Rid of a Committed lpp (Licensed Program Product)?

The only way to do this (that I could find, anyway) is to install the lpps/ptfs with the force option and then reject the particular package.

In AIX 4.1, there is a new option for installp. The -u option can be used to remove the lpps.

Is It Possible to Log Information about FTP Accesses to a Log File?

You can do this relatively simply be doing the following:

1. Add the following line to /etc/syslog.conf.
daemon.debug /tmp/daemon.log
2. Create the log file and restart the syslog daemon.
# touch /tmp/daemon.log # refresh -s syslogd
3. Now you must modify your inetd.conf through SMIT. Using smit inetdconf you will add the -l and the -d option.

Now all of the syslog messages from ftpd and other daemons will now appear in the file /tmp/daemon.log.

By Default, Where Does AIX Keep All the Log Files?

To see where your specific machine is sending logs, look in the /etc/syslog.conf file. This will define which type of errors go into which log files.

By default, the system log files are:

/var/adm/messages For system mail messages
/var/adm/lpd-errs For lp daemon errors
/var/log/authlog For authentication messages
/var/log/syslog For general system messages

After Installing Updates, What's the Best Way to Recover Lost Space?

While installing packages, installp creates a large number of files in /usr, which it uses to clean up the system after failed or rejected installs as well as for de-installing the uncommitted lpps.

After you have fully committed the packages, you can safely remove these files, which can be anywhere from hundreds to thousands.

These files end up being located in directories associated with their product; the directories being named /usr/lpp/(product abbreviation)/deinstl* and /usr/lpp/(product abbreviation)/inst_U4*.


NOTE: If you have a number of other machines with NFS mounts to /usr, you shouldn't use this because these files mentioned are needed for the clients.

If I'm Given an inode Number, Can I Actually Find the Associated File?

There is a little known option in the find command that allows you to do just that:

find /(mountpoint) -xdev -inum NNNN -print

where NNNN is the inode number.

What Can I Use for Performance Monitoring?

There are some tools available in /usr/lpp/bosperf to monitor traces, I/O events, CPU stats, virtual memory, disk block usage, kernel extensions, and many other events.

rmms is also a tool to see how different memory size configurations will impact performance.

Another good text-based tool is monitor, which allows you to easily monitor the following events:

This file is available from the FTP site ftp.funet.fi:pub/unix/AIX/RS6000/monitor-1.12.tar.Z.

Another monitor that can be used on X-based systems is called xsysstats. This is available from the FTP site ftp.x.org:/contrib.

How Can I Find Out What Virtual Printer a Print Queue Is Using?

By using the command lsvirprt without any options, it will run in an interactive mode. This will bring up a menu of all virtual printers on the system with queue and device for each one.

Why Are There Two srcmstrs Running My Machine?

This happens on a system that either has no console or a system with an asysnc terminal as the console that is either not attached or turned off. One of the symptoms of this situation is that a second srcmstr runs. This one is useless because you can't use the sstop/startscr commands, refresh inetd, and the qdaemon won't start.

There is, however, a simple way to resolve this. Start the SMIT chgtty menu and add the keyword clocal as values in the associated brackets:

STTY attributes for RUN TIME
STTY attributes for LOGIN

How Can I Change the tty Name Associated with a PhysicalPort?

First you get into the smit interface by typing smit. Then you choose the devices option. Next you choose the TTY option, then the Change / Show characteristics of a TTY menu. Here you can change the name of the port number associated with the tty, as well as other options for various settings such as line speed.

Can I Use mksysb to Copy an Entire System to Another Box?

To do this, you can use the following steps on the master machine to clone an AIX system:

1. Delete the password from root.

2. In the /etc/group file you must get rid of the last line containing a + sign, which is used by NIS.

3. You must change the run level designations at least for rc.nfs and the rc.tcpip from level 2 to level 3 in the /etc/inittab file. (This is to prevent them from being started with the new system.) These can be changed by editing the /etc/inittab file and changing the number in the second field of the lines. The first field of these lines will be rcnfs and rctcpip, respectively.

4. Boot the master machine into service mode and change the name and ip address to avoid collisions.

5. Clear all the temp files (/tmp, /usr/tmp, and /usr/spool/lpd/stat).

6. Run the mkszfile utility and edit it to be sure /usr/ is as small as possible.

7. You can now do a mksysb from the command line.

When you load the mksysb on the new machine for the first time, it will be able to boot into the normal mode. You can now get in as root, change the files back to the original settings, and continue configuring the new system.

The same must be done to the master machine if you intend to keep it operational.

How Can You Force mksysb to Retain timestamps?

From version 3.2.5 on, the bosrest command preserves timestamps and permissions. The pax command will do this as well.

In AIX 3.2.2, /usr/lpp/bosinst/bosnet (net installations) and bosrest, the pax c commands, all have the available option -pmop, where the m tells it to not retain the modification times. All you have to do is change all the -pmop options to -pop and remake your mksysb tapes.

What's a Good Way of Updating a Number of Machines to 3.2.5?

If you don't have many machines, this may not be worth your while, as it involves a number of lines of scripting. If you do have a network of machines to update, then this is for you.

1. Get the PMP3250 tape from AIX support, PTF (Program Temporary Fix)number U493250.

2. Create a file system with 240 MB of space and mount it as /pub/pmp3250 (on an lv called /dev/pmp3250).

3. Install the PTF U422467 from the tape with the command installp -Bxacgq -d /dev/rmt0 bos.obj 3.2.0.0.U422467.

4. Create a script to load the tape in the new file system:
#!/bin/ksh
#@(#) mktape2disk.sh creates files from tape on disk
#This will change the name prefix
NAME="f"
# from file #i to file #j
integer i=1
integer j

#test arguments
if [ -z "${1}" ]
then
 echo "/nusage: $(basename ${0})<drive_no><#files>\n"
 echo "\t<drive_no>: tape drive number (e.g. 0)"
 echo "\t<#files> :number of files to copy from the tape\n"
 exit
fi
devices=/dev/rmt${1}.1
# test arguments
if [ -z "${2}" ]
then
 echo "\nousage: $(basename ${0})<drive_no><#files>\n"
 echo "\t<drive_no>: tape drive number (e.g. 0)"
 echo "\t<#files>: number of files to copy from the tape\n"
 exit 1
fi j=${2}

tctl -f ${device} rewind
if [ $? -ne 0 ]
then
 exit 1
fi

# This will create the tape
while [ ${i} -le ${j} ]
do
 echo "Copy file #${i} of #${j} from (${device}) to disk as (${NAME}${i})"
 dd if=${device} of="${NAMW}${I}" bs=200k
 i=i+1
done
tctl -f ${device} rewind
exit 0
Now that you have created the script, you can run it as follows:
# cd /pub/pmp3250
# mktape2disk.sh 0 447 (this will make it read the 447 files from rmt0)
5. You must create a new .toc file.
# cd /pub/pmp3250 # inutoc . # pg .toc
6. Then you must create another script called runme.sh into the PMP directory:
#!/bin/ksh
#@(#) runme.sh for PMP3250
#
INSTP="/usr/sbin/installp"
LOG="/tmp/installp.log"
TEE="/usr/bin/tee"
PATCHDIR=$(pwd)
#
/usr/bin/cp /usr/lpp/info/data/ispaths /usr/lpp/info/data/ispaths.save
#
INFODIR="/usr/lpp/info/$LANG/aixmin"
/usr/bin/mkdir ${INFODIR} 2>/dev/null >/dev/null
if [ ! -w ${INFODIR} ]
then
 print "\n\t*ERROR* Can not (write) acces [${INFODIR}]."
 print "\tPlease unmount CD or NFS file systems.\n"
 exit -1
fi
#
# Commit all the PTF's
#
${INSTP} -Xc all 2>&1 | ${TEE} ${LOG}.0
#
# Install latest installp patch
#
${INSTP} -Bxacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422463 2>&1 | ${LOG}.1
#
# Install latest installp patch
#
${INSTP} -Bxacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422467 2>&1 | ${LOG}.6
# Now run the ptfdir clean utility.
#
/usr/sbin/ptfdir_clean -y -f -v 2>&1 | ${TEE} ${LOG}.2
#
# Install the PMP version 1
#
/usr/lib/instl/sm_inst installp_cmd \
-T m -q -a -g -B    \
-d ${PATCHDIR}      \
-S `3250 AIX Maintenance Level U493250'\
-c -N -X
2>&1 | ${TEE} ${LOG}.3
#
# Install the PMP version 2
# /usr/sbin/update_all
#
# Install the latest installp patch
#
/usr/bin/lppchk -v | ${TEE} ${LOG}.4
#
# Show the level of installp patch
#
/usr/bin/lslpp -m bos.obj | ${TEE} ${LOG}.5
#
# Reboot now.
#
sync;sync
print - "\n\n\tDone ......reboot now !\n"
exit 0
7. Now that you have created the scripts you can run them on your server. Before you do, however, it is best to check your installation instructions first.
# cd /pub/pmp3250 # ./runme.sh # /etc/shutdown -Fr
8. When the system comes up, you can export the PMP directory as read-only to all clients.

9. To update a client system, first mount the PMP file system from the server. Then cd to the mounted file system. Run the runme.sh, unmount the PMP file system, and reboot. Your system should now be updated.

Is There a General Fix Strategy for AIX?

In AIX 3.1, the strategy was to do cumulative updates, so every few months IBM would put all of the available fixes on one big package and send it to all their client sites. Except for the occasional emergency patch, there was no method for tracking them. Chances are that if you weren't careful and you got a second patch, you would load it and overwrite the first.

IBM tried a selective fix strategy for AIX 3.2 to support individual fixes. These packages would contain information about other fixes that were required for that fix to work properly. By using this strategy, it allowed the installed fixes to be tracked so that they did not become overwritten. Initially, this had certain problems:

As the AIX 3.2.4 was developed, a large amount of effort was put into resolving the problems with selective fixes, as well as improving AIX 3.2. At this point everything was split into subsystems, which are logically related files. The advantage of this was that changes to a subsystem were unlikely to affect other subsystems, meaning much fewer problems with patches and fixes. Now, with 3.2.4:

The icing on the cake came with the Preventative Maintenance Package (PMP). PMP allows you to install the latest cumulative subsystem package, which can be installed by selecting a single fix. Along with PMP came the oslevel command, which shows what packages are installed and at what level the operating system is running.

Why Is the Fix I Received So Large for My 3.2.4?

This fix might be part of the 3.2.5 update. AIX 3.2.5 is really just a PMP for 3.2.4. This contains all of the fixes to date, including enhancements to support the PowerPC model 250, as well as the high-end RS/2 model 590 and 990. It also has support for new disk and tape drives, graphics and adapters, and so on.

Why Couldn't I Just Build a Fix on 3.2.4?

In fact, there is no such thing as 3.2.1, 3.2.2, or 3.2.4 for that matter. These are just handles that have been put on the fixes and enhancement levels of the 3.2 base. If the fix for a specific problem was built before 3.2.5 came along, you can get the older version. If your fix was available for the first time in a 3.2.5 subsystem, then that's the only version of the fix in existence.

In AIX, Can I Have More than an Eight-Character Password?

You can create a password that is greater than eight characters in length, but all of the characters over the eighth will be ignored.

If you are running NIS, you will have to be careful about the passwords on other machines. They all must be eight characters or less to be compatible with AIX.

If you are running DCE, you can save more than eight characters to the password because DCE supports kerberos, which is an X windows function.

Can I Get More ptys than the 64 Limit?

SMIT will only allow 64 ptys, but you can get around this by manually changing the ODM files. This can be done by doing the following:

odmget -q"attribute=num and uniquetype=pty/pty/pty"PdAt |
sed "s/0-64/0-512/" |
odmchange -q"attribute=num and uniquetype=pty/pty/pty" -o PdAt

chdev -l pty0 -anum=256 -P
reboot

Are There Any Fixes that I Should Be Aware of?

There have been problems that need to be taken care of in sendmail and xterm. The associated patch tapes are designated as follows:
sendmail This fix is available as U426396
xterm for X11R4 This is available as U422575
xterm for X11R5 This is available as U425811

How Can I Remove a Non-Existent Physical Volume from the ODM?

To do this, you have to use reducevg with the pvid instead of the disk name. The pvid will actually be given in error messages that occurs when you run a command to modify a volume group or the logical volume on the disk. To get rid of the missing disk from the database, just enter the following command:

reducevg -f <pvid>

I Can't Seem to Kill a Process with quit, kill, or stop. How Can I Kill It?

You are probably out of luck. If there is I/O pending in a device driver and the driver doesn't get the signal, then you simply can't kill it. You can only reboot to get it out of the process list.

You can do a trace on the process by using the following command:

# echo trace -k $(expr<pid> / 256) | crash | tee stack

You can use that stack trace to find out what's wrong on the system. (You'll probably have to send it to an IBM system engineer to decipher it though.)

Is There a Way to See console Messages?

You can use the swcons command to redirect the console to a file, or you can use the chcons command to permanently move the messages to a file.

What Should I Do If I Loose the Root Password?

You don't have to do anything as radical as reloading AIX and restoring everything from tape (checked your backups lately?). Just follow this procedure:

1. Boot from the boot disks, tape, or CD.

2. At the Installation/Maint menu, select item 4, "Start a limited function maintenance shell."

3. At the # prompt, enter the command:
getrootfs hdisk N 
(where N is the number of the disk on rootvg)

4. When the # prompt comes back, you will be logged in as root in single user mode.

5. While here, cd to the /etc/security directory and edit the passwd file. Here you need to delete the three lines under root and save the file.

6. Now you can give root a new password with passwd command.

7. Now all you have to do is shut down and reboot in normal mode.

8. Write down that password and lock it up in a safe place. Just don't forget where you put it.

On Running a chlv a Warning Appears. Is the First 4 KB of the LV Okay?

On raw partitions the first 4 KB is used to store control block information. Some applications, particularly databases such as Oracle and Sybase, will actually overwrite this section. Any command that calls getlcb will give a warning but succeed anyway because the control block information also exists in ODM. Do not run synclvodm unless you really want to erase this first 4k and replace it with the ODM control block information.

Doing Backups

This is one of the more important sections of the chapter, since backups often equal job security!

How Do I Do Remote Backups?

There are a couple of ways of doing this. The first (and by far the simplest) is a tar command:

  tar -b1 -cf - . | rsh REMOTEHOST "dd ibs=512 obs=1024 of=/dev/TAPEDEVICE"

Because mksysb will not back up to remote tape devices, you have to create a script to make it do your bidding. I ran across this script originally written by Frank Kramer from IBM. The following will work for remote backups:

#!/bin/ksh
# @(#) Create a backup tape of the private user data.
#=================================================================#
#   Script :  usave.sh                                            #
#   Author :  F. Kraemer                                          #
#   Date   :  92/02/19                                            #
#   Update :  92/10/29                                            #
#   Info   :  the ultimative backup script                        #
#   Example:  usave.sh /dev/rmt0      -  save to local tape       #
#             usave.sh /save/save.me  -  save to local file       #
#             usave.sh /tmp/pipe      -  save to remote tape      #
#-----------------------------------------------------------------#
PS4="(+) "
#set -x
PROG=$(basename $0)
HOST=$(hostname)
TODAY=$(date +%H:%M:%S)
#
# cleanup
#
cleanup ()
{
ec=$1
error=$2
case "$ec"
in
   "$USAGE_EC")    # usage error
     error="Usage:\t$PROG DeviceName\n" 1>&2
    ;;
   "$NOTAP_EC")    # Tape error
     error="error:\t$PROG: $DEVICE is not available on the system.\n" 1>&2
    ;;
   "$LISTE_EC")    # list error
     error="error:\t$PROG: could not create tar list for $LOGNAME.\n" 1>&2
    ;;
   "$NOTAR_EC")    # tar command error
     error="error:\t$PROG: tar command failed.\n" 1>&2
    ;;
   "$PIPEP_EC")    # pipe error
     error="error:\t$PROG: mknod command failed.\n" 1>&2
    ;;
   "$NORSH_EC")    # rsh error
     error="error:\t$PROG: rsh - Remote Shell command failed.\n" 1>&2
    ;;
   "$RHOST_EC")    # remote host error
     error="error:\t$PROG: Remote Host unknown.\n" 1>&2
    ;;
   *)
   ;;
esac
case "$DEVICE"
in
    #
    # Fix the block size if $DEVICE is a tape device
    #
    /dev/rmt[0-9]*)
        echo "\n\t$PROG: Rewinding tape to begin.........(please wait)\n"
        tctl -f $DEVICE rewind 2>/dev/null
        ;;
    *) ;;
esac
rm -f ${LIST} ${PIPE} 2>/dev/null
[ -n "$error" ] && echo "\n${error}\n"
trap '' 0 1 2 15
exit "$ec"
}
#
# Variables
#
USAGE_EC=1                         # exit code for usage error
NOMNT_EC=2                         # exit code wrong device name
NOTAP_EC=3                         # exit code no tape available
LISTE_EC=4                         # exit code backup list error
NOTAR_EC=5                         # exit code for wrong tar
TRAPP_EC=6                         # exit code for trap
PIPEP_EC=7                         # exit code for pipe
RHOST_EC=8                         # exit code for bad ping
NORSH_EC=9                         # exit code for bad rsh
DEVICE="$1"                        # device to tar into
LIST="/tmp/.tar.$LOGNAME.$$"       #
REMOTEH=""                         # Remote host for backup
REMOTET=""                         # Remote tape for backup
tapedev=                           #
PIPE="/tmp/pipe"                   # Pipe for remote backup
#
# main()
#
tput clear
echo "\n\t$PROG started from $LOGNAME@$HOST on $TERM at $TODAY.\n"
rm -f $LIST 2>/dev/null
#
# Trap on exit/interrupt/break to clean up
#
trap "cleanup $TRAPP_EC \"Abnormal program termination. $PROG"\"  0 1 2 15
#
# Check command options
#
[ "$#" -ne 1 ]  &&  cleanup "$USAGE_EC" ""
#
# Check device name
#
[ 'expr "$DEVICE" : "[/]"' -eq 0 ] && cleanup "$NOMNT_EC" \
        "$PROG: Backup device or file name must start with a '/'."
#
# Check tape device
#
case "$DEVICE"
in
    #
    # Fix the block size if $DEVICE is a tape device
    #
    /dev/rmt[0-9]*)
        #
        echo "\n\t$PROG: Verify backup media ($DEVICE)............\n"
        #
        # see if a low or high density tape device was specified
        # (eg rmt0.1)
        density="'expr $DEVICE : \
                "/dev/rmt[0-9]*\.\([0-9]*\)"'"
        #
        # strip /dev/ from device name and
        # get the base name (eg translate:
        # /dev/rmt0.2 to rmt0)
        #
        tapedev="'expr $DEVICE : \
                "/dev/\(rmt[0-9]*\)[\.]*[0-9]*"'"
        #
        # Check if the tape is defined in the system.
        lsdev -C -c tape -S Available -F "name" | grep $tapedev >/dev/null 2>&1
        rc=$?
        [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
        #
        # Restore old tape name.
        #
        [ "${density:-1}" -lt 4 ] && density=1 || density=5
        DEVICE="/dev/${tapedev}.${density}"
        echo "\n\t$PROG: Insert a tape in ($DEVICE)........(press enter)\n"
        read TEMP
        echo "\n\t$PROG: Rewinding tape to begin...........(please wait)\n"
        tctl -f $DEVICE rewind 2>/dev/null
        ;;
    #
    # Backup is done on remote host. The remote shell facility
    # must be set up and running.
    #
    ${PIPE}*)
        #
        echo "\n\t$PROG: Assuming remote backup via network.\n"
        echo "\t$PROG: Enter name of Remote Host   ===> \c"
        read REMOTEH
        echo "\n\t$PROG: Pinging Remote Host to test connection.\n"
        ping ${REMOTEH} 1 1 >/dev/null 2>&1
        rc=$?                                    # give up unknown host
        [ "$rc" -ne 0 ] && cleanup "$RHOST_EC" ""
        JUNK=$(rsh ${REMOTEH} "/usr/sbin/lsdev -C -c tape -S Available")
        rc=$?                                    # give up rsh failed
        [ "$rc" -ne 0 ] && cleanup "$NORSH_EC" ""
        echo "\t$PROG: Available Tapes on ${REMOTEH} are :\n\n\t\t${JUNK}\n"
        echo "\t$PROG: Enter name of Remote Tape (e.g. /dev/rmt0) ===> \c"
        read REMOTET
        echo "\n\t$PROG: Insert tape on ${REMOTEH} in ${REMOTET}..(press enter)"
        read TEMP
        echo "\t$PROG: Rewinding Remote Tape ${REMOTET} on ${REMOTEH}.\n"
        rsh ${REMOTEH} "tctl -f ${REMOTET} rewind"
        rc=$?                                    # give up rsh failed
        [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
        rm -f ${PIPE} 2>/dev/null
        mknod ${PIPE} p
        rc=$?                                    # give up mknod failed
        [ "$rc" -ne 0 ] && cleanup "$PIPEP_EC" ""
        cat ${DEVICE} | rsh ${REMOTEH} "dd of=${REMOTET} obs=100b 2>/dev/null" &
        ;;
    *)  ;;
esac
#
# Prepare the list
#
echo "\n\t$PROG: Create list of files to be saved...."
find $HOME -print > $LIST
rc=$?
[ "$rc" -ne 0 ] &&  cleanup "$LISTE_EC" ""
#
# tar the files
#
echo "\n\t$PROG: Changing current directory to (/)...."
cd / > /dev/null 2>&1
echo "\n\t$PROG: Running tar format backup from user ($LOGNAME)...."
tar -cvf "$DEVICE" -L "$LIST"
rc="$?"
[ "$rc" -ne 0 ]  && cleanup "$NOTAR_EC" ""
#
# Backup completed
#
TODAY=$(date +%H:%M:%S)
echo "\n\t$PROG ended at $TODAY............................\n\n"
cleanup 0

How Can I Put Multiple Backups on One 8mm Tape?

You can do this one of two ways. Both of these methods use the device /dev/rmt0.1 because it is non-rewinding.

In the first solution, you can use either rdump or backup with /dev/rmt0.1. Here is an example:

# rsh remote1 -l root /etc/rdump host:/dev/rmt0.1 -Level -u /u
# rsh remote2 -l root /etc/rdump host:/dev/rmt0.1 -Level -u /u
# tctl -f /dev/rmt0.1 rewind (this will rewind the tape)

These commands are implemented from the host. In order to restore the table of contents of the first, I would use:

# restore -f /dev/rmt0.1 -sl -tv

In this example, the -sl flag tells restore to go to the first record on the tape. If you type the exact command again to get the second record, the -sN (where N is an integer) tells it to go to N records from this spot.

The second solution uses a script created by Steve Knodle at Clarkson University. The Dump.sh file contents are:

CONTENTSFILE='date |dd conv=lcase |sed -e 's/19//' |awk '{print $6 $2 $3}''
set -x
LEVEL=$1
shift

backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /
backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /usr
backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /u
tctl -f /dev/rmt0 rewind

touch /usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /usr" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -q -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /u" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -q -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
tctl -f /dev/rmt0 rewind

Is It Possible To Make an Exact Duplicate of a Tape Over the Network?

Yes. It would be easy enough to move the contents to a temporary file, but if disk space is a consideration (and when isn't it?), then we would have to be a little more inventive.

This script should work, but be careful in a heterogeneous network:

LOCAL=/dev/<tape_dev>
REMOTE=/dev/<tape_dev>
dd if=$LOCAL ibs=64k obs=512 | rsh <remote_host> dd ibs=512 \         obs=64k of=$REMOTE

Daniel Packman wrote the following Perl script to convert every function code into AIX for compatibility on tape formats:

#!/bin/perl
# Wrapper to convert input rmt requests to
# AIX 3.2 ioctl numbers.  We pass on all commands we don't understand
# I0 MTWEOF -> I10  STWEOF write and end-of-file record
# I1 MTFSF  -> I11  STFSF  forward space file
# I2 MTBSF  -> I12  STRSF  reverse space file
# I3 MTFSR  -> I13  STFSR  forward space record
# I4 MTBSR  -> I14  STRSR  reverse space record
# I5 MTREW  -> I6   STREW  rewind
# I6 MTOFFL -> I5   STOFFL rewind and unload tape
# I7 MTNOP  -> I0   (no-op? should ignore following count)
# I8 MTRETEN-> I8   STRETEN retension tape, leave at load point
# I9 MTERASE-> I7   STERASE erase tape, leave at load point
#I10 MTEOM (position to end of media ... no ibm equivalent?)
#I11 MTNBSF  (backward space file to BOF ... no ibm equivalent?)
@iocs = (10,11,12,13,14,6,5,0,8,7);
open(RMT,"|/usr/sbin/rmt") || die "Can't open pipe to rmt\n";
select(RMT);
$| = 1;
while (<STDIN>) {
  s/(^I)(\d$)/I$iocs[$2]/;
  exit 0 if $_ =~ /^[Qq]/;
  print RMT $_ ; }
exit 0;

How Do I "Unstick" a Hung Tape Drive?

This happens when a process accesses a tape drive and the process stops or exits, yet still holds onto the drive. When this happens, the process cannot be ended until the machine is rebooted (as we saw in a previous FAQ). There are certain reset functions that can be used with the SCSI bus to reset the device.

One is a Bus Device Reset (a standard SCSI message) to the tape drive using the following program. If this doesn't work, then a full SCSI Bus Reset will be sent, which will reset every device on that SCSI controller, which is quite extreme. (This could affect certain disk drives, so take care in using this utility.) Sometimes this is the only way to reset a tape device, short of rebooting the machine. The code is as follows:

/* taperst: resets the tape drive by sending a BDR to the drive. */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/scsi.h>

int main(int argc, char **argv)
{
         /* This can be run only by root */

         if (argc != 2) {
             fprintf(stderr, "Usage: %s /dev/rmt#\n", argv[0]);
             return 1;
         }

         if (openx(argv[1], O_RDONLY, 0, SC_FORCED_OPEN) < 0) {
             perror(argv[0]);
             return 2;
         }
         return 0;
}

Can I Read a mksysb Tape with tar?

You should be able to do this by running the following commands:

# tctl fsf 3
# tar xvf /dev/rmt0.1 ./<filename>

Memory and Process Management

This section covers some of the more commonly asked questions about process management.

Does AIX Eat Up More Paging Space than Other UNIX Systems?

In most cases, yes. The virtual memory manager in AIX uses a technique called early allocation of paging space. As a page is allocated in RAM and is not an NFS or disk file storage page, then it is considered as a working storage page. These working stored pages are commonly an application's stack, data, and any shared memory segments. So, when a program's stack is increased and RAM is accessed the virtual memory manager will allocate space in RAM and space on the paging device.

The result is that even before the RAM gets filled up, paging space is already being used.

So How Much Paging Space Will I Need?

Generally, the guideline is to have twice the amount of RAM in disk space set aside for paging. This may be too simplistic to cover every situation, however. For example, in a machine that is used mainly for data storage versus heavy duty computations, this would actually be a lot of wasted space, because it is unlikely that a stack will grow to the size of the amount of RAM on the system. However, it's always better to be on the safe side and stick to this guideline if you are unsure.


TIP: You should never have more than one paging space per disk as this will severely hinder your I/O throughput. Also, try to get as much RAM as you can on your system. The more you get, the better it will run.

Why Do I See No Free RAM Pages in vmstat?

The OS is probably using RAM as a great big disk buffer. If you open up a file and leave it there and nothing else needs the RAM, then it will stay there until you close the file.

Since There Are No Free RAM Pages Showing, Am I Out of RAM?

More than likely, no. Because disk files will be mapped into RAM, if vmstat shows lots of RAM pages free, then it could be possible that you have too much RAM.

What Are the avm and fre Fields from vmstat Anyway?

The avm field will tell you how much Active Virtual Memory AIX is interpreting as being in use. This will closely resemble the paging space that is in use. This number doesn't have a thing to do with the amount of RAM you are using, nor does it include your mapped files (disk files).

You can tell how much RAM is on your system by running the command:

/usr/sbin/bootinfo -r

The fre field shows the number of free page frames. It is normal for this number to be less than 500 pages. If this number is consistently greater than 4000 pages, then you actually have more memory than you need in this machine.

What Does the ps Show About Memory Reports?

If you use the ps vg, you can get a per process tally of the memory usage by running procfess. The man pages are a little fuzzy, but this should help in understanding what is being reported:

The fields here only report on a process's text and data segments. The segment size that cannot be reported on to date are:

In 3.1, the %MEM and RSS report for process 0 are bogus values. The RSS value is misleading large because the kernel segment 0 is counted twice.

To sum up, ps isn't very god at measuring system memory usage. It gives some indication of where some of the memory goes, but many of the questions remain unanswered about the total usage.

What Is kproc?

kproc (which is always PID 514) is simply the kernel's idle process.

Shells, Commands, and the InfoExplorer in AIX

This section will cover some of the questions often asked about shells, command and the InfoExplorer program in AIX.

What's the Best Way To Give More Information in My Shell Prompt?

The three major shells have different ways of doing this.

In the Korn shell, there is a variable in that can be set. This is the PS1 variable, and it can be set manually as follows:

$ export myhost='hostname'
$ PS1='$LOGNAME@$myhost $PWD \$'

This will give you a prompt with your login name, the hostname of the machine, and the current directory, followed by the $ sign.

Note that this will only last as long as you are currently logged in. You will lose this as soon as you log out. In the Korn shell, you can set this variable permanently in the $HOME/.profile file.

In the C shell, you can do the following to set your prompt:

% set myhost='hostname'
% alias cd `chdir \!* >/dev/null; set prompt="$LOGNAME@$myhost $cwd % "'
% cd

In the Bourne shell, there is no PS1 or set prompt, so for all intents and purposes there is no easy way of doing this. In most cases, using the Korn shell over the Bourne shell is highly recommended because it is mostly just an enhancement to the Bourne shell.

How Can I Set Up My Korn Shell To Use Emacs for Command Mode Editing Instead of the vi Editor?

There is a way of doing this that is undocumented. The key mappings can be bound in your .kshrc file by adding the following lines:

alias __A='echo "\020"' # up arrow = ^p = back a command
alias __B='echo "\016"' # down arrow = ^n = down a command
alias __C='echo "\006"' # right arrow = ^f = forward a character
alias __D='echo "\002"' # left arrow = ^b = back a character
alias __H='echo "\001"' # home = ^a = start of line

Type set -o emacs or put this line in your .profile to set this permanently.

If you are using a version previous to 3.2.5, you must have a patch from IBM for this to work. The PTF is U406855, and the APAR (authorized program analysis report) # for the problem is IX25982.

When I List Files in a Directory with ls I Get a Core Dump. Why?

This is a problem that occurs on some machines when a directory is shared by more than 200 users. Usually this will only occur when you use the -l and -o options, showing the user names and group names.

This problem should be fixed by the PTF tape U407548. There is another tape with the APAR IX31403 fix that you may want to load as well. This will fix problems associated with large numbers of accounts and the associated lookup problems and performance issues.

Can I Put My Own Text into InfoExplorer?

With 3.2 and after, there is a product called InfoCrafter that will allow you to do that.

What Keys Can Be Used to Move Around in InfoExplorer?

At startup there is an option you can choose called Basic Screen Operations. This will show a few options. There is also a page called Using Keys and Key Sequences in the InfoExplorer ASCII Interface. This will describe the key sequences and their associated actions. Here are some of the more commonly used ones:

Is There a Way To Add man Pages to the System?

You can put the new man pages into /usr/man (for example, /usr/man/man1/tcsh.1 for the tcsh man page). In AIX 3.1.10 and above, you can use /usr/lib/makewhatis to update the makewhatis-database /usr/man/whatis, so that apropos and whatis are aware of the added man pages.

Why Doesn't man Work on My Machine, and Why Don't I Have nroff?

Neither nroff or troff are included in the base installation prior to 3.2.5. Even on 3.2.5, it is shipped, but it may not be installed on your machine.

In order to install these, use SMIT to install the software package txtfmt.tfs.obj from the 3.2.5 distribution media.

Why Is It That My Environment Only Loaded Once, Even Though I Have More than One Shell Open? I Am Using ksh.

The .profile file is loaded only once as it is called by your login shell. All shells after that will be initialized by the $HOME/.kshrc file. The setting in .profile is ENV=$HOME/.kshrc.

Why Can't I Find the nawk command?

nawk is really just an enhanced version of awk. Where most other UNIX systems have a /bin/nawk, AIX simply incorporated all of the extra functionality of nawk into /bin/awk. These include such features as atan2(), rand(), srand(), match(), sub(), gsub(), system(), close(), and getline functions.

The quickest and most effective way to support compatibility for systems or applications requiring the nawk utility is to create a link file /bin/nawk linked to /bin/awk. If you don't have root access to the AIX machine, you'll have to set all nawk references on AIX program runs to /bin/awk.

Video and Graphics

This section covers video and graphics capabilities of the AIX operating system.

How Can I Find Out Which Version of X11 I Am Running?

To do this, you can run the command lslpp -h X11rte.obj.If your output gives a line like this:

COMPLETE COMMIT 05/22/93 02:05:11 root

then you have version X11 R4.

If your output shows something like this:

U491068 01.02.0003.0000 COMPLETE COMMIT 08/05/93 7:35:11 root

then you have version S11 R5 installed. On AIX, these X windows versions are sometimes referred to as AIXwindows 1.2.0 and 1.2.3.

How Can I Disable the Escape Sequence, Ctrl-Alt-Backspace, from Killing the X Session?

All you have to do is start X with the command xinit -T to disable that escape sequence from killing your X session.

Where Can I Get the termcap/terminfo Source for an HFT Console?

You can get lots of termcaps in the /lib/libtermcap/termcap.scr file, including the one I included here. The terminfo sources are stored in /usr/lib/terminfo/*.ti.

hf|hft|hft-c|ibm8512|ibm8513|IBM_High_Function_Terminal:\
    :co#80:li#25:am:ht:\
    :cm=\E[%i%d;%dH:ti=\E[25;1H:te=\E[20h:\
    :nd=\E[C:up=\E[A:do=^J:ho=\E[H:\
    :bs:sf=\E[S:ec=\E[%dX:\
    :cl=\E[H\E[J:cd=\E[J:ce=\E[K:\
    :AL=\E[%dL:DL=\E[%dM:al=\E[L:dl=\E[M:\
    :im=\E[4h:ei=\E[4l:mi:\
    :dm=\E[4h:ed=\E[4l:\
    :so=\E[7m:se=\E[m:ul=\E[4m:ue=\E[m:\
    :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\
    :as=^N:ae=^O:sc=\E[s:rc=\E[u:\
    :kl=\E[D:kb=^H:kr=\E[C:ku=\E[A:kd=\E[B:kh=\E[H:\
    :kn#10:k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:k5=\E[005q:\
    :k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:k0=\E[010q:\
    :is=\Eb\E[m^O\E[?7h:rs=\Eb\E[m^O\E[?7h\E[H\E[J:

Is There a Good Way To Look at PostScript Files?

In X11R5, there is a utility called showps. X11R5 is identified the 1.2.3 version of the X11rte.ext.obj lpp. This is a highly functional viewer that was developed by Adobe, Inc. This replaced the xpsview utility previous to the 1.2.3 version update.

Is It Possible To Have the Machine Check Its Local /etc/hosts File Before Trying To Resolve to the DNS Server?

You can't reset the order necessarily, but you can set a timeout parameter for resolv.conf. In the patch tape PTF U412845, there is an environment variable implemented called RES_TIMEOUT. You can set this variable to the number of seconds you want before it times out and checks the /etc/hosts file.

How Can You Tell an X Application Where Your Client Console Is If the Console Is Set to unix:0?

If you have X11R5, you can use :<display>.<screen>. X11R4 clients may not be able to understand :0. In this case, you can use unix:0 to set the display variable. For example, display variable can be set as DISPLAY=unix:0.

If you don't specify either UNIX or the hostname, you can actually get the fastest transport mechanism. While at present the only two methods for transport are UNIX sockets and TCP sockets, some vendors are taking a look at shared memory as a possible transport mechanism.

If I Use the Standard 'hostname':0 as the DISPLAY Setting, Is It Actually Slowing Me Down?

As a matter of fact, it does. The UNIX socket connections (unix:0) is significantly faster than using the standard TCP socket ('hostname':0) connections.

How Do I Set My VT100 Key Bindings for aixterm?

This refers to starting a vax session from a telnet on AIX.

To do this, you have to add these lines to your .Xdefaults file:

vt100.foreground: Wheat
vt100.background: MidnightBlue
vt100.font: Rom14.500
vt100.geometry: 80x25+0+0
vt100.vt102: true
vt100.fullcursor: false
vt100.pointerColor: coral
vt100.cursorColor: gray100
vt100.translations:    <Key>F1: string(0x1b) string("OP") \n\
                       <Key>F2: string(0x1b) string("OQ") \n\
                       <Key>F3: string(0x1b) string("OR") \n\
                       <Key>F4: string(0x1b) string("OS") \n\
                       <Key>KP_0: string(0x1b) string("Op") \n\
                       <Key>KP_1: string(0x1b) string("Oq") \n\
                       <Key>KP_2: string(0x1b) string("Or") \n\
                       <Key>KP_3: string(0x1b) string("Os") \n\
                       <Key>KP_4: string(0x1b) string("Ot") \n\
                       <Key>KP_5: string(0x1b) string("Ou") \n\
                       <Key>KP_6: string(0x1b) string("Ov") \n\
                       <Key>KP_7: string(0x1b) string("Ow") \n\
                       <Key>KP_8: string(0x1b) string("Ox") \n\
                       <Key>KP_9: string(0x1b) string("Oy") \n\
                       <Key>KP_Divide: string(0x1b) string("OQ") \n\
                       <Key>KP_Multiply: string(0x1b) string("OR") \n\
                       <Key>KP_Subtract: string(0x1b) string("OS") \n\
                       <Key>KP_Add: string(0x1b) string("Om") \n\
                       <Key>KP_Enter: string(0x1b) string("OM") \n\
                       <Key>KP_Decimal: string(0x1b) string("On") \n\
                       <Key>Next: string(0x1b) string("Ol") \n\
                       <Key>Left: string(0x1b) string("OD") \n\
                       <Key>Up: string(0x1b) string("OA") \n\
                       <Key>Right: string(0x1b) string("OC") \n\
                       <Key>BackSpace : string(0x7f) \n\
                       <Key>Down: string(0x1b) string("OB")

You also have to add the following in your .profile:

XENVIRONMENT=$HOME/.Xdefaults
export XENVIRONMENT

Is There a Screen Saver That Doesn't Chew Up All My CPU?

You can use the xlock utility with the following options:

xlock -mode life -count 1500 -nice 20 -root

In addition to xlock there is the mlock utility, which can be used with the -hide to hide the background. You can actually modify the settings in /usr/local/tools/mlock. By default, the timeout value is set to 0, which turns off the screen saver. You can modify this to the number of seconds you want. If you use a timeout value of 120 and an interval time of 60, this will use very little CPU time.

Where Is There a List of the Colors Available for an X Session?

There is a file called /usr/lp/x_st_mgr/bin/rgb.txt that lists all the colors available and their associated RGB values.

Why Did My Application Hang the X Server But Not My X Station?

X client/server communication by default uses a 64kb buffer size. There is an environment variable that controls this buffer size called X_SHM_SIZE. If you increase this number, this should prevent this situation from occurring again.

How Do I Go About Switching the Key Bindings of the Control Key and the Caps Lock Key?

You can perform this procedure for any key switch you want following the guidelines of the example here. Just be careful you don't do something like change the "a" key to the "Del" key.

The following can be added to the xmodmaprc file:

  remove Lock = Caps_Lock
  remove Control = Control_L
  keysym Control_L = Caps_Lock
  keysym Caps_Lock = Control_L
  add Lock = Caps_Lock
  add Control = Control_L

How Do I Get More Fonts?

You can try running a font server (X11R5). You can do this on your X server by editing the /usr/lib/X11/fs/config file and running the command:

fsconf && startsrc -s fs

You then have to make sure that your font path for your client machine is set to that font server.

Why Am I Getting Errors When I Start an X11 Application Binary from aixpdslib?

There have been problems with dynamic links when running the prebuilt of X-stuffs from the aixpdslib. This is because the programs where built using the X11 libraries for the MIT, which are not compatible with the IBM libraries. The error messages usually associated with this problem are:

The only solution to the problem is to get the source code instead and recompile them on your system with your libraries.

Why Am I Getting .XShm* Link Errors While Building X Windows Applications?

This is probably due to compiling applications that work with the Shared Memory extension of the X server. You can do one of two things: Recompile without the calls for shared memory or load the shared memory extensions.

Networking

This section covers some frequently asked questions on networking issues with AIX.

Why Does the Named daemon on the Network's Primary Name Server Get Killed So Often? The Machine is Running 3.2.

You might want to use the 3.1 memory allocation on this machine. You can do this as follows:

stopsrc -s named
setenv MALLOCTYPE 3.1
/etc/named

You can also use the Berkeley bind utility, preferably bind 4.9, which works without changing to MALLOCTYPE=3.1.

There are two patches that should fix this problem as well. These are U412332 and U414752.

What Does AIX Offer To Trace Ethernet Packets on My Systems?

There are two utilities you can use: iptrace and ipreport. To use iptrace you can do the following:

iptrace -i en0 /tmp/ipt

where en0 is the Ethernet network designation and ipt is the name of the file where statistics will be placed. This command will run and write to the ipt file until you find its PID and kill it, so don't just run it and forget it.

Once you are done with your trace and have killed the iptrace process, you can look the output with ipreport:

ipreport -rns /tmp/ipt > /tmp/ipr
where ipr will be an ascii file you can look at.

What's a Good Way of Starting Automount on System Startup?

In the /etc/inittab, you need to add (or modify) the following line:

automount:2:once:/usr/etc/automount -T -T -T -T -v >/tmp/au.se 2>&1

Can I Set a tty Port to be Both Dial-In and Dial-Out?

Yes. All you have to do is set the mode of the tty to be either shared or delayed. Your best bet would be to do this is SMIT.

What Is the Best Way To Move or Copy Complete Directory Trees Across a Network, While Keeping All the Permissions?

You can do this by rcp or by tar.

With rcp, you can copy the entire directory with subdirectories, while keeping all modification times and permissions intact. The command would be in the form:

rcp -rp /(directory) (hostname):/(directory)

where -r will allow you to copy subdirectories and the -p option will keep all permissions, user ids, and group ids intact. rcp may flood a network, however, because of the nature of the rcp command.

Another method that may prove to be less encumbering to the network would be the tar option. You can use tar in conjunction with rsh as follows:

rsh (remote hostname) "cd (target directory); tar -cBf - ." | tar -xvBf -

What happens here is that. rsh is used to start tar on the remote system which writes the `tar image' to stdout, returned to the local system via the pipe. On the local system, tar is then used to read stdin from the pipe and `unpack' its file contents to their original location. The `movement' occurs as a result of writing/reading the tar image via the pipe over the network.

Both of these options require you to either have accounts on the remote system with the same username or a .rhosts file with your machine hostname and your username defined. This can be cause for grave security concerns in secure environments, consider this long and hard if you choose this.

Can I Send Mail to Systems That Don't Have a Hostname?

In AIX 3.2, you can only send mail to addresses that have a hostname. This can be reconfigured, however. A lot of sites use a mail address whose hostname part is not really a hostname but an MX name.

To change the configuration, you must login as root and edit the /etc/sendmail.cf file. First, you must uncomment the beginning of the line:

# OK MX

Next you recompile sendmail with:

sendmail -bz

And finally, you have to restart the sendmail daemon in order for it to load the new configuration. You can do it by rebooting, stopping, and starting sendmail:

stopsrc -s sendmail
startsrc -s sendmail

or you can use the following command:

kill -1 'cat /etc/sendmail.pid'

How Can I Configure Dialup SLIP on My System?

First, make sure the command slattach is working properly. If it isn't, you need to load the PTF U411505. If this is up and running, follow these steps:

1. Create a new group called slip.

2. Using SMIT, create a user called slip with the following fields:
[Entry Fields]
* User NAME                                          [slip]
  ADMINISTRATIVE User?                                true
  User ID                                            []
  LOGIN user?                                         true
  PRIMARY group                                      [slip]
  Group SET                                          [slip]
  ADMINISTRATIVE groups                              [system]
  SU groups                                          [slip]
  HOME directory                                     [/home/slip]
  Initial PROGRAM                                    [/bin/sh]
  User INFORMATION                                   [SLIP-Dialup]
  Another user can SU to user?                        false
  User can RLOGIN?                                    true
  TRUSTED PATH?                                       nosak
  Valid TTYs                                         [/dev/tty1]
  AUDIT classes                                      []
  PRIMARY authentication method                      [SYSTEM]
  SECONDARY authentication method                    [NONE]
  Max FILE size                                      [2097151]
  Max CPU time                                       [-1]
  Max DATA segment                                   [262144]
  Max STACK size                                     [65536]
  Max CORE file size                                 [2048]
  Max physical MEMORY                                [65536]
  File creation UMASK                                [022]
  EXPIRATION date (MMDDhhmmyy)                       [0]
3. Create a tty with getty on it:
                                   Add a TTY
                                               [Entry Fields]
  TTY type                                     tty
  TTY interface                                rs232
  Description                                  Asynchronous Terminal
  Parent adapter                               sa0
* PORT number                                  [s1]
  BAUD rate                                    [38400]
  PARITY                                       [none]
  BITS per character                           [8]
  Number of STOP BITS                          [1]
  TERMINAL type                                [dumb]
  STATE to be configured at boot time          [available]
  DMA                                          on
  Read Trigger                                 0,1,2,3
  Transmit buffer count                        [16]
  Name of initial program to run               [/etc/getty]

  Note: The following attributes are only applicable if /etc/getty is
        specified as the initial program to run.

  Enable program?                              respawn
  Run level                                    2
  Enable LOGIN                                 share
  TIME before advancing to next port setting   [0]
  STTY attributes for RUN TIME                 [hupcl,cread,brkint>
  STTY attributes for LOGIN                    [hupcl,cread,echoe,>
  RUN shell activity manager                   no
  Optional LOGGER name                         []
4. Change the hardware characteristics so that it uses NO XON/XOFF handshake.

5. Here is the .profile for User slip to manage dialups:
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/local/bin:.

ENV=$HOME/.kshrc
HISTSIZE=128

export PATH ENV HISTSIZE
#
# Search for a LCK-File for our tty if there is one
#

if test -f /etc/locks/LCK..tty1
then
  SHPID='cat /etc/locks/LCK..tty1'
else
 echo 'date' " No LCK-File !!!" >>slip.log
 exit 64
fi

#
# Search for our own Shell to get the PID for checking against LCK-File
#

SH2PID='ps -aef |
        sed -n -e 's/^ *slip  *\([0-9][0-9]*\) .*-sh *$/\1/p'

#
# Is it the the same PID as in the LCK File so that we can start working ??
#

if test $SHPID = $SH2PID
then
#  remove the LCK-File because slattach does not like it.
   rm -rf /etc/locks/LCK..tty1
#  Add RTS/CTS Handshakeing to our own tty
   stty add rts
#  Startup slattach. Slattach has to have mode 4755 to be started up !!!
   /usr/sbin/slattach tty1
#  Just say that we are up.
   echo 'date' " Starting up slip-daemon " >>slip.log
#  leave slattach enough time to startup
   sleep 4
else
# Something must be wrong with the LCK-File
  SH3PID='ps -aef | awk ' {print $2}' | grep $SHPID'

  if test ."$SH3PID" = .""
  then
    SH3PID="NO_SUCH_PROCESS"
  fi

  if test $SHPID = $SH3PID
    then
#  There is a living process which owns the LCK-File !!
       echo 'date' " Can't remove LCK-File, not owner !!!" >>slip.log
       exit 64
    else
#   Who the hell didn't remove the LCK-File (should never happen)
       echo 'date' " LCK-File with no owner found !!!" >>slip.log
       exit 64
    fi
fi

# Get the pid of slattch so that we can kill him later on.
SLPID='ps -aef |
 sed -n -e 's/^ *slip  *\([0-9][0-9]*\) .*-.*\/usr\/sbin\/slattach tty1 *$/\1/p'

# Kill slattach if we get a signal 1 (Carrier Lost ? / Otherside-slattach
# terminated )
trap "kill $SLPID; exit 0" 1

# We  will have a nice sleep and nice dreamings
while sleep 256
do
:
done

Interface issues with different AIX versions.

The AIX implementation of SLIP is slightly different from most others. The ifconfig command is used to bring up a serial interface, and the slattach command is used to connect the interface to the serial port used for the connection. Dialer device commands can also be issued when invoking the slattach command, using UUCP chat syntax.

The following describes a connection between two machines:

     local.j.k.l
         ethernet IP address 129.128.127.21
         slip interface IP address 129.1.2.1

     remote.a.b.c
         ethernet IP address 129.11.22.44
         slip interface address 129.11.22.1

The following are the relevant issues which must be addressed.

1. Interface Configuration.

Each machine must have a separate IP address dedicated to the SLIP interface. On remote.j.k.l, start the SLIP interface with:
         ifconfig sl0 129.11.22.1 129.128.127.1  up
and on local.a.b.c:
         ifconfig sl0 129.128.127.1 129.11.22.1  up
It is important in later versions of AIX 3.2.3+ to use the same SLIP interface # as the ptty port #, (that is, if you use tty12, use ifconfig sl12 instead of sl0).

At this point, the interfaces are ready to be connected.

2. tty Configuration.

The tty ports on both machines were configured in an identical manner using SMIT.

                                                 [Entry Fields]
 TTY type                                           tty
 TTY interface                                      rs232
 Description                                        Asynchronous Terminal
 Parent adapter                                     sa0
 PORT number                                        []                       +
 BAUD rate                                          [38400]                  +
 PARITY                                             [none]                   +
 BITS per character                                 [8]                      +
 Number of STOP BITS                                [1]                      +
 TERMINAL type                                      [dumb]
 STATE to be configured at boot time                [available]              +
 DMA                                                on                       +
 Read Trigger                                       0,1,2,3
 Transmit buffer count                              [16]                      #
 Name of initial program to run                     [etc/getty]


NOTE: The following attributes are only applicable if /etc/getty is specified as the initial program to run.

 Enable program?                                    respawn
 Run level                                          2
 Enable LOGIN                                       disable                  +
 TIME before advancing to next port setting         [0]                      +#
 STTY attributes for RUN TIME                       [hupcl,cread,brkint,icr>
 STTY attributes for LOGIN                          [hupcl,cread,echoe,cs8,>
 RUN shell activity manager                         no                       +
 Optional LOGGER name                               []
On older versions of AIX, we encountered some problems disabling getty, and resorted to changing the /etc/inittab file directly. For example, change
tty0:2:respawn:/etc/getty /dev/tty0
to
   tty0:2:off:/etc/getty /dev/tty0
This will disable getty. After creating the SLIP tty device, you will need to change its hardware configuration to disable Xon/Xoff flow control. Software flow control should not be used for SLIP. Type smit chtty, and then select sub item 2: Hardware settings.

Most of the parameters in the tty configuration are the defaults.

3. Modem Configuration.

The modems were configured as follows:

RTS/CTS flow control enabled.
   Xon/Xoff software flow control disabled. Usually this is automatic if
      RTS/CTS is enabled.
   Data rate, terminal to modem = fixed.
      This is the baud rate from the tty port to the modem. We used a
      fixed modem-port transfer rate, set to the fastest speed supported
      by both the tty port and the modem. Newer modems can use a higher
      transfer rate between the modem and serial port than the modem to
      modem rate, which is necessary to use data compression effectively.
      In our setup, we used 14.4 kBaud modems with a port speed of 38.4
      kBaud. If your modem supports this feature, use it, otherwise set
      the port speed equal to the modem connection rate. On the USR
      Sportster at&b1 fixes the serial port rate to that of the last
      AT command. The speed parameter of the slattach command can be
      used to ensure that this rate is that set in the tty configuration.
   Error Correction enabled - not mandatory, but a good idea
   Data Compression - not required, but it helps, especially for text
      transfers.
   Auto Answer - If the SLIP connection is to be initiated from either
      machine, both modems should be set to auto answer, otherwise, just
      the answering modem.
It is a good idea to configure the modem and then save the settings to NVRAM, so that the correct settings can always be restored by the slattach command.

4. UUCP Configuration Files.

   /usr/lib/uucp/Devices
   /usr/lib/uucp/Dialers
The Devices file must contain an entry with the tty and serial port speed used for the interface. In our example,
      Direct tty0 38400 slipdialer
The keyword slipdialer is merely an index into the Dialers file. For our purposes, the slipdialer entry in the Dialers file is simply:
      slipdialer
This entry can also contain UUCP chat commands, or the chat commands can be included in the slattach command.

5. slattach Invocation.

slattach connects the device on the tty port to the SLIP interface created by ifconfig, and sends any commands to the tty device if needed. For our example, remote.j.k.l would never initiate a call, only answer incoming calls. Therefore, we execute:
         slattach tty0 38400 '"" ATZ OK ""'
which connects the tty at 38400 baud. We could also simply run
         slattach tty0
without any modem commands, but the modem to port speed may not be correctly set this way. In addition, the ATZ command ensures the modem is set to the NVRAM settings.

On local.a.b.c type:
         slattach tty0 38400 '"" ATZ OK \pATDT4925871 BIS ""' 4
This establishes the link at 38400 baud, and executes the dial string as shown. The dial string is a UUCP chat string and is configured in an expect send expect ... send format. The string:
         '"" ATZ OK \pATDT4925871 BIS ""'
is interpreted as:
   expect "" (null string) from modem
   send   ATZ              to modem
   expect OK               from modem
   send   \pATDT4925871    to modem
   expect BIS              from modem
BIS is the end of the CONNECT STRING. You could use any portion of the string returned by the modem upon a connection as the expect string. It may be wiser to simply expect CONNECT since all connections should return this string.

The null strings are necessary because the first parameter of the UUCP is an expected string from the modem, which can only be a null string until the modem has been given a command.

The last parameter (4) of the slattach command is the debug level.

A debug level of 4 displays the UUCP chat strings, which is useful for checking the modem status.

6. Routing.
   ifconfig is sufficient if all you want to do is talk between the
   two hosts.  If you are running SLIP so that you can talk to more
   than just that one other host you have to advertise your address.

   1) arp -s 802.5 iago 10:00:5a:b1:49:d8 pub
        where 802.5 is a token-ring network the hardware address can
        be obtained with 'netstat -v' and iago was the SLIP client (My
        PC at home :)  pub is the important part it means "published"
        You may want to run this at boot time.

   Routing through the SLIP link is similiar to routing of any gateway.
   Invoking the ifconfig command automatically sets up a route between
   the two SLIP machines. An entry in /etc/hosts or the named database
   should be made, with the same machine name used for the SLIP address
   as the ethernet address on each machine. For example, in /etc/hosts
   on remote.a.b.c (and any other machine on remote.a.b.c ethernet):

     129.11.22.44 remote.a.b.c # ethernet address
     129.11.22.1  remote.a.b.c # slip address

   It is preferable to place the ethernet address in the hosts file
   before the SLIP address so remote.a.b.c will resolve to the
   ethernet address. When using named, it is important to have both
   addresses in the reverse file with the same name. We experienced
   difficulties with NFS mounting over the slip link, owing to some
   machine interpreting NFS requests from one of the two SLIP machines
   as coming from the SLIP address, while the SLIP machine believed it
   was sending the request from the ethernet address. This problem was
   eliminated by having both addresses reverse resolve to the same name.
7. Performance.
   At a modem speed of 14.4 kBaud and a port speed of 38.4 kBaud, we
   realized a transfer rate through ftp of about 3.5 kB/s for text
   files, and 1.3 kB/s for compressed files.

What Exactly Is DCE?

DCE stands for the Distributed Computing Environment. In general terms, it refers to a heterogeneous client-server architecture.

Is It Possible To Make the Mail Spooler (/var/spool/mail) Mountable?

It is possible, but it may not be a wise choice. You can do this by creating a shared disk, such as /usr/local/spool/mail, with the file system /var/spool/mail soft-linked to it. That way you can have NFS mounts to the mail spooler from other machines.

There are a number of problems with this, however. Because of NFS's locking mechanism, you will encounter problems when one or more sendmail daemons or mail readers attempting to access a user's mail file at the same time.

There is another method that may make more sense. In each user's $HOME directory, you place a file called .forward that contains one line:

NNN@(hostname.domain.name)

where NNN is the user node. When mail comes into all the machines, it is forwarded to that server, while that server will ignores this line.

Why Am I Constantly Getting the Message on the System Console "getty spawning too rapidly"?

This problem always points back to modem settings. Number one on the list is that echo is not disabled on modems that are to accept incoming calls. In the language that is used by Hayes (most modems use something similar), ATE0 will disable the echo.

You might also have to set the Q register that controls the modem's response to the DTE. The Hayes command ATQ0 enables results codes. The Q register works in conjunction with the X and V registers, which report back to the DTE (computer) the status of incoming or outgoing calls, and the type of connection established. If you have outgoing calls, you would want to enable result codes, but not for incoming calls. Some "intelligent" modems will automatically disable this. To turn it off for outgoing calls, the ATQ1 string must be entered.

The DSR setting can be a problem as well. In a perfect world, the modem would raise DSR only when CD is detected and the modem raises CTS. The DSR should be set to the be raised when a carrier has been detected. The Hayes setting should be AT&S1.

The DCD setting should be checked as well. It should be set to AT&C1.

You should have a setting on your modem to reload saved settings from disk on a DTR transition. This will allow you to reset a modem when a call gets dropped. The Hayes setting is AT&C1.

In summary, for a dial-in machine, set the settings in the initialization string to AT E0 Q1 &C1 &D3 &S1 &W. The &W will store the settings in memory. (You must consult your manual for your particular modem for variations in these settings.)

How Do I Setup My Box as an Anonymous FTP Site?

There is a shell script that comes packaged with AIX for setting up an anonymous FTP site. Take a look at /usr/lpp/tcpip/samples/anon.ftp. Once you run this script, everything should get set up automatically.

Miscellaneous Administration

This section covers the odds and ends of system administration.

After I Unplugged My Keyboard and Plugged It Back In, the Key Mappings Were Changed. How Do I Get Them Back?

This happens on most machines. For most models, you can get back the correct mapping by entering this command:

/usr/lpp/diagnostic/da/dkbd

Your screen will go blank, it'll beep a few times, and then it will come back.

For certain older models, you will have to use a different command. For the 230 and the M20, use this command:

/usr/lpp/diagnostics/da/dkbd

For the 220, use this command:

/usr/lpp/diagnostics/da/dkbdsal

How Can I Set Up the DOS Emulator?

The utility pcsim will work as a DOS emulator. To set this up, you must have a bootable DOS disk. DOS 3.3, 4.x, or 5.0 will work.

With the disk in the drive, do the following:

touch /u/dosdrive (this is the AIX file for DOS emulation)
pcsim -Adiskette 3 -Cdrive /u/dosdrive

At this point, you will get an A prompt. At this prompt, type fdisk. Next, you will create the virtual C drive and give it a size. Note that you cannot change the size later.

format c: /s

Next, you exit from pcsim by pressing Esc and typing pcsim.

You then create a file called simprof. A sample simprof file follows:

Adiskette :3
Cdrive  :/u/dosdrive
lpt1 : (name of printer queue)
refresh : 50
dmode: V
mouse : com1

Once this file is created, you can start pcsim by typing pcsim.

How Can I Transfer Files Between AIX and DOS Disks?

AIX has a number of tools available for DOS manipulation, such as dosread, doswrite, dosdir, dosdel, and dosformat. Using these tools you should be able to do just about any file transfer you want.

How Can I Get the crypt Program?

Believe it or not, the U.S. government classifies all encryption technology as munitions, which means that you cannot sell it overseas or to non-U.S. nationals. In order to get it, you must be a United States citizen residing in the U.S., and you have to contact an IBM sales office.

C/C++ Programming

This section will cover some of the more common questions that pop up in C and C++ Programming.

I Can't Get alloca() To Work. Any Suggestions?

alloca() allocates memory in such a way that it is automatically freed when the block is exited. Most programs do this by adjusting the stack pointer.

To make the compiler aware of its presence, you must put the following line in before any other statements in the C source module where alloca is called:

#pragma alloca

Without this, xlc won't recognize alloca and errors will occur during linking.

How Can I Recompile My BSD Programs?

In the file /usr/lpp/bos/bsdport, you will find information on how to port programs from BSD to AIX.

For the bulk of BSD programs, you can compile the source code as follows:

cc -D_BSD -D_BSD_INCLUDES -o (loadfile) (sourcefile.c) -lbsd

If the code has system calls predefined with prototype parameters, include the -D_NO_PROTO flag as well.

Does the AIX Linker Act Differently?

In fact, it does work quite differently. The order of objects and libraries is normally not important. The linker reads all objects including those from libraries into memory and does the actual linking in one go. Even if you need to put a library of your own twice on the ld command line on other systems, it is not needed on the RS/6000--doing so will even make your linking slower.

One of the features of the linker is that it will replace an object in an executable with a new version of the same object:

  $ cc -o prog prog1.o prog2.o prog3.o  # make prog
  $ cc -c prog2.c                       # recompile prog2.c
  $ cc -o prog.new prog2.o prog         # make prog.new from prog
                                        # by replacing prog2.o
  $ cc -c prog1.c prog2.c prog3.c
  $ ar cv libprog.a prog1.o prog2.o prog3.o
  $ ld -r -o libprog.o libprog.a
  $ cc -o someprog someprog.c libprog.o

This will solve all internal references between prog1.o, prog2.o, and prog3.o and save this in libprog.o. Then using libprog.o to link your program instead of libprog.a will increase linking speed, and even if someprog.c only uses, say prog1.o and prog2.o, only those two modules will be in your final program. This is also due to the fact that the binder can handle single objects inside one object module as noted previously.

If you are using an -lprog option (for libprog.a) above, and still want to be able to do so, you should name the prelinked object with a standard library name, for example libprogP.a (P identifying a prelinked object), that can be specified by -lprogP. You cannot use the archiver (ar) on such an object.

You should also have a look at section 3.01 of this article, in particular if you have mixed Fortran/C programs.

Dave Dennerline (dad@adonis.az05.bull.com) claims that his experiences in prelinking on AIX does not save much time because most people have separate libraries that do not have many dependencies between them, thus, not many symbols to resolve.

Can I Link My Program with a Non-Shared Library /lib/libc.a?

If, for example, you have three objects, you can do this with the following command:

cc -o prog -bnoso -bI:/lib/syscalls.exp obj1.o obj2.o obj3.o

In 3.2.5, you can install the Shared Memory Transport. Once this is installed, you must link with -bI:/usr/lpp/X11/bin/smt.exp. Also, this executable will only run on a machine with SMT installed.

Why Is the Linker Failing with Strange Errors?

The linker, or binder, cannot get enough memory. This could be because the ulimits are too low or because you don't have enough paging space. The AIX linker also uses a lot more virtual memory than most normal linkers.

Specifically, if a BUMP error occurs, either ulimits or paging spaces is low. If the Binder killed by signal 9 error comes up, then this definitely points to paging.

To check you memory and data ulimits, run ulimit -a (in the ksh). To increase the ulimits, run ulimit -m NNNNN and ulimit -d NNNNN, where NNNNN is the number that you will set it. If this doesn't clear up the problem, then your paging space is too small.

If you are stuck with the amount of paging space you currently have, you can try the following:

Also, if you do increase your paging space, you might want to consider adding it to another disk instead of just increasing the present one. This may improve performance, as well as maintenance of the paging space.

Why Am I Getting extern char *strcpy() Messages While Running xlc?

In the header <string.h>, there is a strcpy macro that expands strcpy(x,y) to _strcpy(x,y). The latter is used by the compiler to generate inline code for strcpy. This macro will cause errors because your extern declaration contains an invalid macro expansion. The real fix is to remove the extern declaration, but adding -U_STR_ to your xlc will also work.

What Other Errors Are Caused by Something in xlc?

Here are a few other common errors with xlc:

305 |     switch((((np)->navigation_type) ? (*((np)->navigation_type)) :
      ((void *)0)))
      .a...........
a - 1506-226: (S) The second and third operands of the conditional
operator must be of the same type.

The reason for this is that xlc defines NULL as (void *)0, and it does not allow two different types as the second and third operand of ?:. The second argument is not a pointer and the code used NULL incorrectly as a scalar. NULL is a nil pointer constant in ANSI C and in some traditional compilers.

You should change NULL in the third argument to an integer 0.

Can the Compiler Generate Assembler Code?

You can do this if you have version 1.3 or above of xlc and xlf. You can use the -S option to generate assembly code before optimization. If you use the option -qlist, it will give a readable file the extension .lst.

What Is deadbeef?

When you run the debugger (dbx), you will occasionally see deadbeef in the registers. oxdeadbeef is a hexadecimal number that somehow forms a word. This hex number is used to pad registers, usually during startup of programs. (Also, keep in mind that the RS6000 was designed and built in Texas!)

In 3.2, How Would I Statically Link?

Use the following command:

xlc -bnso -bI:/lib/syscalls.exp -liconv -bnodelcsect

FORTRAN Programming

Why Am I Having Problems Mixing FORTRAN and C Code?

Some routines cross programming languages, such as getenv, signal, and system. However, they have different parameters for each. If you have a mixed program that calls gentenv from both C and FORTRAN code, you have to link them by specifying the correct library first on the command line. As of version 1.5 of both compilers, this is not necessary.

How Do I Check Whether a Number Is Truly an Integer or Decimal and Not NaN?

This can be a problem because the RS6000 system uses IEEE floating point arithmetic (NaN stands for "Not a Number").

The test you can use for this is the fact that if a variable is NaN, then it is not equal to anything, including itself. All you have to do to test for this is:

IF (X .NE. X) THEN

This will only return true if X is NaN.

GNU and Other Public Domain Software

This may be a very valuable section to a lot of people, since by default public domain software comes with very little documentation.

How Can I Find Sources on Public Domain Software?

There is actually a newsgroup just for posting about how to get sources. You can read the article How_to_find_sources(READ_THIS_BEFORE_POSTING) at the anonymous FTP site rtfm.mit.edu. This will be in the directory /pub/usenet/comp.sources/wanted/.

Where Are the FTP Sites for RS/6000-Specific Software?

There are a number of sites that you can check out. The following might have changed because of the volatility of anonymous FTP sites:

U.S. Sites:
aixpdslib.seas.ucla.edu 128.97.2.211 pub
acd.ucar.edu 128.117.32.1 pub/AIX
acsc.acsc.com 143.127.0.2 pub
byron.u.washington.edu 128.95.48.32 pub/aix/RS6000 (older stuff)
lightning.gatech.edu 128.61.10.8 pub/aix
tesla.ee.cornell.edu 128.84.253.11 pub
European Sites:
nic.funet.fi 128.214.6.100 pub/unix/AIX/RS6000
iacrs1.unibe.ch 130.92.11.3 pub
ftp.zrz.TU-Berlin.DE 130.149.4.50 pub/aix
ftp-aix.polytechnique.fr 129.104.3.60 pub/binaries/rios
ftp.uni-stuttgart.de 129.69.8.13 sw/rs_aix32/

The first one is dedicated to software running on AIX. It might not always be the latest versions of the software, but it has been ported to AIX (normally AIX version 3 only). Once connected, you should retrieve the files README and pub/ls-lR.

Please use the European sites very sparingly. They are primarily to serve people in Europe and most of the software can be found in the U.S. sites.

Here are some more sites, listed with their host domain addresses and their appropriate directories:

Host ibminet.awdpa.ibm.com

Location: pub/announcements #IBM announcements

Location: pub/oemhw #oem hardware

Location: pub/ptfs #PTFs

Host cac.toronto.ibm.com

Location: marketing-info

Host aixpdslib.seas.ucla.edu

Location: ? #AIX archive (sources and binaries)

Host ftp.egr.duke.edu

Location: ? #AIX archive

Host straylight.acs.ncsu.edu

Location: ? #AIX archive

Host alpha.gnu.ai.mit.edu

Location: /rs6000 #AIX archive

Host ftp.uni-stuttgart.de

Location: /sw/rs_aix32

Host iacrs2.unibe.ch

Location: /pub/aix #bunch of goodies)

Host ftp.u.washington.edu

Location: /pub/RS6000 #minimal -- ted)

Host aixive.unb.ca

Location: ? #just announced -- new archive)

Host ftp.ans.net

Location: /pub/misc #wais goodies)

Host uvaarpa.virginia.edu

Location: /pub/misc #minimal -- whois)

Host ux1.cts.eiu.edu

Location: /pub/rs6000 #minimal -- pop3, FAQ, whois)

Host ftp.bsc.no

Location: pub/Src.

Host ftp-aix.polytechnique.fr (129.104.3.60)

Location: pub/binaries/rios

Sites with directories named 'aix':

Host aix1.segi.ulg.ac.be (139.165.32.13)

Location: /pub/aix

Host byron.u.washington.edu (128.95.48.32)

Location: /pub/aix

Host cunixf.cc.columbia.edu (128.59.40.130)

Location: /aix

Host files1zrz.zrz.tu-berlin.de (130.149.4.50)

Location: /pub/aix

Host ftp.rz.uni-augsburg.de (137.250.113.20)

Location: /pub/aix

Host fyvie.cs.wisc.edu (128.105.8.18)

Location: /pub/aix

Host solaria.cc.gatech.edu (130.207.7.245)

Location: /pub/incoming/aix

Location: /pub/aix

Host spot.colorado.edu (128.138.129.2)

Location: /aix

Location: /pub/patches/aix

Host swdsrv.edvz.univie.ac.at (131.130.1.4)

Location: /unix/systems/aix

Host switek.uni-muenster.de (128.176.120.210)

Location: /pub/aix

Host wuarchive.wustl.edu (128.252.135.4)

Location: /systems/aix

Sites with directories named 'AIX':

Host cs.nyu.edu (128.122.140.24)

Location: /pub/AIX

Host karazm.math.uh.edu (129.7.128.1)

Location: /pub/AIX

Host minnie.zdv.uni-mainz.de (134.93.178.128)

Location: /pub0/pub/AIX

Host oersted.ltf.dth.dk (129.142.66.16)

Location: /pub/AIX

Host rs3.hrz.th-darmstadt.de (130.83.55.75)

Location: /pub/incoming/AIX

Sites with directories named 'rs6000':

Host aeneas.mit.edu (18.71.0.38)

Location: /pub/rs6000

Host cameron.egr.duke.edu (128.109.156.10)

Location: /rs6000

Host ifi.informatik.uni-stuttgart.de (129.69.211.1)

Location: /pub/rs6000

Host metropolis.super.org (192.31.192.4)

Location: /pub/rs6000

Host ramses.cs.cornell.edu (128.84.218.75)

Location: /pub/rs6000

Host server.uga.edu (128.192.1.9)

Location: /pub/rs6000

Host unidata.ucar.edu (128.117.140.3)

Location: /pub/bin/rs6000

Host uvaarpa.virginia.edu (128.143.2.7)

Location: /pub/rs6000

Host wayback.cs.cornell.edu (128.84.254.7)

Location: /pub/rs6000

Sites with directories named 'RS6000':

Host alice.fmi.uni-passau.de (132.231.1.180)

Location: /pub/RS6000

Host byron.u.washington.edu (128.95.48.32)

Location: /pub/aix/RS6000

Host milton.u.washington.edu (128.95.136.1)

Location: /pub/RS6000

Host pascal.math.yale.edu (128.36.23.1)

Location: /pub/RS6000

Host uxc.cso.uiuc.edu (128.174.5.50)

Location: /pub/RS6000

Are There Any General Hints To Be Aware Of?

There are a couple of things that don't fit nicely into categories.

As far as curses-based applications, they should always be linked with -lcurses and not with -ltermlib. You can also compile with -DNLS to help it run better.

RS/6000 has two install programs: one with System V behavior in the default PATH (/etc/install, links from /usr/bin and /usr/usg), and one with BSD behavior in /usr/ucb/install.

What Can Be Done About Segmentation Faults in GNU Emacs?

In GNU EMACS 19.*, if you get a segmentation fault during hilit 19 use, you can set the local to C (export LC_All=C) to get around the bug in AIX.

From version 18.57 on, GNU Emacs began to have RS\6000 support. For AIX 3.2, you can use s-aix3-2.h.

What Do I Need To Watch Out For When Running Perl?

There are a couple of things to watch out for. The first deals with malloc(). If you use bsdcc, don't use Perl's built-in malloc(). You should edit config.H to include #define HAS_SYMLINK. In general, it's best just to leave Perl's malloc() alone.

Also, you may want to edit config.sh. You should look for cppstdin and change the setting from the wrapper program to /lib/cpp.

The reason you do the preceding things is that the wrapper name is actually compiled into Perl and it requires its presence in the source directory. This way, if the wrapper get destroyed, /lib/cpp will do the job all by itself.

What Is Bash?

The bash shell is actually a great alternative to the ksh shell. You can download the bash shell from the FTP site prep.ai.mit.edu, or other GNU software mirror sites.

If you intend to make this your default shell, don't forget to edit the file /etc/security/login.cfg.

Where Can Get a Copy of the POP3 mail daemon?

You can get the POP server from the anonymous FTP site ftp.qualcomm.com:/quest/unix/server/popper. There is also a site at ftp.CC.Berkeley.EDU. Here there are two versions: a compressed tar file, popper-version.tar.Z, and a Macintosh StuffIt archive in BinHex format called MacPOP.sit.hq.

If you have problems building a version of popper, you may be able to resolve them by compiling with bsdcc or -D_BSD.

Third-Party Products

This section covers some of the more common questions about third party products and their problems and features.

What Tape Drives Will Work with My RS/6000?

Almost any third-party SCSI tape drive will work fine with RS/6000 machines. However, you will run into trouble if you try to boot from a non-IBM drive. This happens because IBM drives have what they call extended tape marks, which they claim are needed because the standard marks between files stored on the 8mm tapes are unreliable. These extended tape marks are used when building boot tapes. Therefore, when you try to boot with a non-IBM tape drive, it will upchuck all over the place. (Trust me, I've tried it.)

If you are stuck and you have to boot from a non-IBM drive, you might have luck if you try the following procedure:

1. Turn on the machine with the key in the SECURE position.

2. After the LED shows 200 and the 8mm tape has stopped loading, turn the key to the service position and continue to boot.

If you are lucky, this might work. I've tried this on a couple of occasions and sometimes it worked and sometimes it didn't.

There are some brands that do work like IBM 8mm drives. TTI (in particular, the TTI CTS 8210) and Contemporary Cybernetics sell tape drives that will emulate IBM drives.

Can I Buy Memory From Companies Other Than IBM?

Yes. One company that I am aware of is Nordisk Computer Services. You can get 16 MB, 32MB, and 64 MB Upgrade kits. Check around your local area.

Where Can I Get PPP for Free?

Unfortunately, nowhere. PPP does not ship with AIX (at least, not with 3.2.X) and it is not posted anywhere as freeware. Morningstar Software sells PPP for AIX.

Does Anyone Sell Graphic Adapters?

There is a company called Abstract Technologies, Inc. in Austin, Texas, that sells high performance graphics adapters for RS/6000. Again, check your local area for other companies.

Miscellaneous

Even though this is a somewhat in-depth FAQ, it probably hasn't even scratched the surface. So, if you have any more questions, check these other sources.

AIXServ is a service tool that allows users on the Internet and usenet to report problems via UNIX mail. AIXServ is free. To receive instructions on using AIXServ, send a note with "Subject: package" to one of the following e-mail addresses:
Usenet: uunet.UU.NET!aixserv!aixbugs
Internet: aixbugs@austin.ibm.com (transactions request)
services@austin.ibm.com (administrivia)
aasc@austin.ibm.com (test cases under 100Kb)

Using AIXServ, customers have the ability to do the following:

1. Open new problem reports.

2. Update existing problem records.

3. Request a status update on an existing problem record. Currently, this service is available to United States customers only.

Canadian customers can get support from their BBS, cac.toronto.ibm.com at 142.77.253.16.

German customers with ESS (extended software service) contracts can get support by e-mail too. They can obtain information by sending mail with Subject: help to aixcall@aixserv.mainz.ibm.de.

You can get some informative faxes by dialing IBM's Faxserver at 1-800-IBM-4FAX. If you're calling for the first time, push 3, then 2 to request a list of RS/6000 related faxes.

Document Number Title
1453 Recovering from LED 518 in AIX 3.2
1457 Recovering from LED 552 in AIX 3.1 and 3.2
1461 Alternative Problem Reporting Methods
1470 Recovering from LED 223/229, 225/229, 233/235, 221/229, or 221
1537 How To Get AIX Support
1719 Performance Analyzer/6000
1721 Recovering from LED 553 in AIX 3.1 and 3.2
1746 Recovering from LED 551 in AIX 3.1 and 3.2
1755 Recovering Volume Groups
1802 Repairing File Systems with fsck in AIX 3.1 and 3.2
1803 How To Take a System Dump
1804 Setting Up a Modem With the RS/6000
1845 Using iptrace To Track Remote Print Jobs
1867 Clearing the Queuing System
1895 Removing/Replacing a Fixed Disk
1896 Tape Drive Densities and Special Files
1897 Tips on mksysb for AIX 3.2
1909 UUCP (BNU) Helpful Information
1910 Synchronizing Disk Names
1988 Recovering from LED 201 in AIX 3.1 and 3.2
1989 Recovering from LED 727 in AIX 3.2
1991 Recovering from LED c31 in AIX 3.1 and 3.2
2079 AIX 3.2.4
2121 AIX 3.2.4 Installation Tips
2267 How To Reduce /usr in AIX 3.2
2443 Man Pages for AIX 3.2
2446 How To Set Up sar
2447 How To Reduce /tmp
2448 Installing a 5 GB Tape Drive
2462 Bosboot Diskettes
2465 How To Remove ptfs from the ODM

You should contact IBM for an up-to-date listing. Here are some other web sites which will have up to date listings:
aix.boulder.ibm.com (FixDist ptfs)
software.watson.ibm.com (rlogin fixes & more)
gopher.ibmlink.ibm.com (announcements & press releases)
www.austin.ibm.com (software, hardware, service & support)

General IBM information like product announcements and press releases are available through the World Wide Web at http://www.ibm.com/.

Specific information on the RISC System/6000 product line and AIX (highlights include marketing information, technology White Papers, and the POWER 2 technology book online before it hits the presses, searchable APAR database, and AIX support FAX tips online so you don't have to type in all those scripts) is available at http://www.austin.ibm.com/.

Are There Any Publications Available for AIX and RS/6000?

There are actually quite a few in the form of magazines, periodical, books, and so on. Here is a list:

RS/Magazine

P.O. Box 3272

Lowell, MA 01853-9876

e-mail: aknowles@expert.com (Anne Knowles, editor)

AIXpert

IBM Corporation

Mail Stop 36

472 Wheelers Farms Road

Milford, CT 06460

FAX: (203) 783-7669

RiSc World

P.O. Box 399

Cedar Park, TX 78613

FAX: (512) 331-3900

Usenet: {cs.utexas.edu,execu,texbell}!pcinews!rsworld

The following manuals should be available from your local IBM office:
SC23-2204-02 Problem Solving Guide
SC23-2365-01 Performance Monitoring and Tuning Guide for AIX 3.2
SA23-2629-07 Service Request Number Cross Reference, Ver 2.2
SA23-2631-05 Diagnostic Programs: Operator Guide
SA23-2632-05 Diagnostic Programs: Service Guide
SA23-2643-01 Hardware Technical Reference: General Information
SA23-2646-01 Hardware Technical Reference: Options and Devices

"Power RISC System/6000: Concepts, Facilities, Architecture", Chakravarty

McGraw-Hill ISBN 0070110476

"PowerPC: Concepts, Facilities, Architecture", Chakravarty/Cannon

McGraw-Hill ISBN 0070111928

"The Advanced Programmer's Guide to AIX 3.x", College

McGraw-Hill ISBN 007707663X

"AIX Companion" , Cohn

Prentice-Hall ISBN 0132912201

"AIX for RS/6000: System & Administration Guide", DeRoest

McGraw-Hill ISBN 0070364397

"A Guide to AIX 3.2", Franklin

Metro-Info Systems 05/1993

"IBM RS6000 AIX System Administration", Hollicker

Prentice-Hall ISBN 0134526163

"IBM RISC SYSTEM/6000 - A Business Perspective", Hoskins

John Wiley & Sons ISBN 0471599352

"The Advanced Programmer's Guide to AIX 3.x", Phil Colledge

McGraw-Hill, 1994, ISBN: 0-07-707663-x

TOCBACKFORWARDHOME


©Copyright, Macmillan Computer Publishing. All rights reserved.