Frequently Asked Questions to AIX 3.x and IBM RS/6000 _____________________________________________________ Table of contents: 1.00 The AIX operating system - what is it? 1.01 I know neither Unix nor AIX - where do I find more information? 1.02 I am used to Unix systems programming, why should I learn SMIT? 1.03 What is the Object Database? 1.04 How do I get rid of the verbose error messages? 1.05 How do I make an informative prompt in the shell? 1.06 How do I import an /etc/passwd or /etc/group file from another box? 1.07 How do I put my own text into InfoExplorer? 1.08 Who has a termcap/terminfo source for aixterm or the HFT console? 1.09 Which release of AIX do I have? 1.10 Cleaning up utmp, who, and accounting problems 1.11 Other hints, fsck of /, X-windows and ctrl-alt-backspace 1.12 How do I shrink /usr? 1.13 How do I shrink the default paging space on hd6? 1.14 How do I make a filesystem larger than 2 Gig? 1.15 How do I see/change system parameters like number of processes per user? 1.16 How can I unmount /usr to run fsck on it? 1.17 The swapper seems to use extreme amount of paging space, why? 1.18 How much should I trust the ps memory reports? 1.19 How do I mount a floppy disk as a filesystem? 1.20 Some info about tape backups 1.21 How do I do remote backup? 1.22 How do I backup a multi-disk volume group? 1.23 How do I put multiple backups on a single 8mm tape? 1.24 How do I remove a committed lpp? 1.25 My named dies frequently, why? 1.26 How do I trace ethernet packets on an AIX system? 1.27 How can I look at PostScript files? Why is "dpsexec" so lousy? 1.28 What is the authorized way of starting automount at boot time? 1.29 InfoExplorer ASCII key bindings 1.30 Listing files with ls causes a core dump 1.31 Where are the AIX log files kept? 1.32 Two srcmstr's are less useful than one? 1.33 Where can I find tools for performance monitoring? 1.34 How do I set a tty port for both dial-in and dial-out? 1.35 SCSI-1 and SCSI-2 "interoperability" got you confused? 1.36 How to move or copy whole directory trees across a network 1.37 How to get your keyboard back after unplugging it from the 6000 1.38 How do I set up ksh for emacs mode command line editing? 1.39 How can I tell what virtual printer a print queue is using? 1.40 How can I add new man pages to the system? 1.41 How much paging space do I need? 1.42 How can I make an exact duplicate of a tape over the network? 1.43 How do I find a file name from the inode number? 1.44 How do I set up postscript accounting? 1.45 How do I set up pcsim, the DOS emulator? 1.46 How do I transfer files between AIX and DOS disks? 1.47 How do I create boot diskettes for 3.2? 1.48 Some info about the memory management system 1.49 unix:0 vs `hostname`:0 1.50 *How can I send mail to hosts that cannot be pinged? 1.51 *How to setup dialup SLIP 2.00 C/C++ 2.01 I cannot make alloca work 2.02 How do I compile my BSD programs? 2.03 Isn't the linker different from what I am used to? 2.04 How do I link my program with a non-shared /lib/libc.a? 2.05 How do I make my own shared library? 2.06 Linking my program fails with strange error, why? 2.07 What's with malloc()? 2.08 Why does xlc complain about 'extern char *strcpy()' 2.09 Why do I get 'Parameter list cannot contain fewer ....' 2.10 Why does xlc complain about '(sometype *)somepointer = something' 2.11 Some more common errors 2.12 Can the compiler generate assembler code? 2.13 Curses 2.14 How do I speed up linking? 2.15 What is deadbeef? 2.16 How do I statically link in 3.2? 3.00 Fortran and other compilers 3.01 I have problems mixing fortran and C code, why? 3.02 How do I statically bind fortran libraries and dynamically bind C libraries? 3.03 How do I check if a number is NaN? 3.04 Some info sources on IEEE floating point 4.00 GNU and Public Domain software 4.01 How do I find PD software? 4.02 Are there any ftp sites? 4.03 General hints 4.04 GNU Emacs 4.05 gcc/gdb 4.06 GNU Ghostscript 4.07 TeX 4.08 Perl 4.09 *X-Windows 4.10 bash 4.11 Elm 4.12 Oberon 2.2 4.13 Kermit 4.14 Gnu dbm 4.15 tcsh 4.16 Kyoto Common Lisp 4.17 Tcl/Tk 4.18 Expect 4.19 Public domain software on CD 5.00 Third party products 5.01 IBM List of third party products 5.02 Disk/Tape/SCSI 5.03 Memory 5.04 Others 5.05 C++ compilers 6.00 Miscellaneous other stuff 6.01 Can I get support by email? 6.02 *List of useful faxes 6.03 List of 3.2 ptfs 6.04 Some RS232 hints 6.05 VT100 key bindings for aixterm 6.06 What publications are available for AIX and RS/6000? 6.07 Some acronyms 7.00 How do I get this by mailserver or ftp? 7.01 Contributors ______________________________________________________________________________ 1.00: The AIX operating system - what is it? This is best answered by reading the text files in /usr/lpp/bos. The README file there contains general information and the bsdadm file contains useful information if you know BSD and/or SystemV. The last release for the RT PC is 2.2.1. The latest release for PS/2s and Intel architecture machines is AIX 1.3; for PS/2s only, 1.2.1. For the RS/6000, there are two major levels, 3.1 and 3.2, and various intermediate levels. 1.01: I know neither Unix nor AIX - where do I find more information? Quite a number of questions posted to comp.unix.aix show that AIX is people's first experience with Unix. If this is the case with you, you are advised to look at the other newsgroups in the comp.unix hierarchy, in particular comp.unix.questions (for basic questions) or comp.unix.wizards (for difficult questions). These two groups have a common FAQ posting as well. If you need information about C programming, try comp.lang.c or comp.std.c, the latter for Standard ANSI C issues. comp.lang.c has a FAQ posting. 1.02: I am used to Unix systems programming, why should I learn SMIT? Using SMIT is probably very different from your normal way of doing system administration, but could prove very useful in the long run. In some areas, in particular TCP/IP, NFS, etc., you also have the possibility of doing things the "normal" way, but it is unfortunately difficult to know exactly when the "normal" way works. Again, always using SMIT, is probably your best way to go, even when you have to learn a new tool. What SMIT actually does is to call a large number of specific tools for each part of the system administration. The commands called and the output they produce are stored in the files smit.script and smit.log in your home directory. Looking in smit.script may teach you more about system administration. 1.03: What is the Object Database? The Object Database Manager, ODM, stored in /etc/objrepos, /usr/lib/objrepos, and /usr/share/lib/objrepos is AIX's way of storing all the system management information. Under most circumstances, only SMIT or the commands SMIT call (see 1.02) should be used to change the ODM. A harmless way to look at the ODM is to use odmget where is one of the files in /etc/objrepos. The very interested user can use the ODM editor, odme, to navigate the ODM in detail. Modifying the ODM should only be attempted if you know exactly what you are doing. 1.04: How do I get rid of the verbose error messages? Many of the messages from the Unix commands are available in different languages. This is controlled by the LANG environment variable, the default being En_US meaning English in the US. All the default messages have a message number associated with them, e.g.: $ cat no-such-file cat: 0652-050 Cannot open no-such-file. If you prefer the terser Unix-looking error message, set your environment LANG to C, and you will get: $ cat no-such-file cat: Cannot open no-such-file. 1.05: How do I make an informative prompt in the shell? In the Korn Shell (ksh), the PS1 variable is expanded each time it is printed, so you can use: $ myhost=`hostname` $ PS1='$LOGNAME@$myhost $PWD \$ ' to get, e.g. bengsig@ieibm1 /u/bengsig $ In the C-shell, use: % set myhost=`hostname` % alias cd 'chdir \!*' > /dev/null; set prompt="$LOGNAME@$myhost $cwd % "' % cd to get, e.g. bengsig@dkunix9 /u/bengsig/aixfaq % There is no easy solution in the Bourne Shell. Use the Korn Shell instead. 1.06: How do I import an /etc/passwd or /etc/group file from another box? Make sure that you run usrck and pwdck (/etc/passwd) and grpck (/etc/group) to let AIX work its password/group magic. 1.07: How do I put my own text into InfoExplorer? With AIX 3.1, you cannot do it. AIX 3.2 has a product called InfoCrafter that allows you to do that. 1.08: Who has a termcap/terminfo source for the HFT console? The console used on the RISC System/6000, PS/2 and RT can be used as a terminal on another system with the termcap below. You can find this and other termcaps in /lib/libtermcap/termcap.src, including IBM specific ones. The terminfo sources are stored in /usr/lib/terminfo/*.ti. This termcap can also be used from an aixterm window. 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: 1.09: Which release of AIX or other products do I have? The command 'lslpp -h bos.obj' will show all lines referring to the BOS, Basic Operating System. E.g.: Option Name State Event Date Release User Name -------------------- ---------- ---------- --------- --------------- ---------- bos.obj INACTIVE COMMIT 02/03/90 03.01.0000.0000 root INACTIVE APPLY 06/25/90 03.01.0000.0001 root INACTIVE COMMIT 06/25/90 03.01.0000.0001 root INACTIVE APPLY 11/16/90 03.01.0002.0015 root INACTIVE COMMIT 11/16/90 03.01.0002.0015 root ACTIVE COMMIT 05/07/91 03.01.0005.0012 root gives the history for the BOS lpp. The last line, column four, indicates that this is release 3.1.5. To see a listing of everything installed use lslpp -l '*', then use lslpp with the -h option as above to get a history of a particular lpp. Currently, 3.1.5 is considered the "base" release. Everyone should be at least at this level. Even though there are several intermediate ones, the official update is 2010. This should be what a customer would get if he/she made a ptf update request. If you are at some level earlier than 3.1.5, you must first apply 3.1.5, then 2010. Customers using SNA should request the SNA Quality Refresh update. For AIX 3.2, it's a completely different scheme. You may come across discussions on releases 3.2.0, 3.2.1, 3.2.2, 3.2.3 and 3.2.3 extended. There is no absolute way to tell which of these you are running since the newer releases are simply 3.2.0 with some sets of PTFs added. And since one can apply selective fixes it is possible that there could be many slightly different variations of 3.2 in use. IBM is currently working on resolving this situation. Please also see section 6. 1.10: Cleaning up utmp, who, and accounting problems From: fritz@scipp.UCSC.EDU (Frederick Staats) This applies if you are running an X11R5 xterm on 3.2. Add this to the top of X11R5 mit/clients/xterm/main.c: #ifdef AIXV3 #define USE_SYSV_UTMP #define HAS_UTMP_UT_HOST #define WTMP_FILENAME "/var/adm/wtmp" #endif And your utmp problems should go away. If you want xterminal sessions to go into the wtmp file you need to define -DWTMP in the Imakefile and be sure the WTMP_FILENAME is set to the right place. The following program by jfh@rpp386.cactus.org (John F. Haugh) if run in the background by root will clean up the utmp file. #include #include #include main () { int fd; struct utmp utmp; while (1) { if ((fd = open ("/etc/utmp", O_RDWR)) < 0) exit (1); while (read (fd, &utmp, sizeof utmp) == sizeof utmp) { if (utmp.ut_type == USER_PROCESS && kill (utmp.ut_pid, 0) != 0) { lseek (fd, - (long) sizeof utmp, 1); utmp.ut_type = DEAD_PROCESS; write (fd, &utmp, sizeof utmp); } } close (fd); sleep (60); } } Another utmp program was posted to comp.sources.unix, volume 25, issue 96 by David W. Sanderson (dws@cs.wisc.edu) that also works on AIX 3.1. 1.11: Other hints, fsck of /, X-windows and ctrl-alt-backspace Normally ctrl-alt-backspace will kill the X session. If you add the -T option when initializing X, this will not happen. You can run fsck either in maintenance mode or on mounted filesystems. To enter maintenance mode to run fsck on the root filesystem: 1. boot from diskette 2. select maintenance mode 3. type /etc/continue hdisk0 exit (replace hdisk0 with boot disk if not hdisk0) 4. fsck /dev/hd4 1.12: How do I shrink /usr? From: mike@bria.UUCP (Michael Stefanik) and Richard Hasting FOR AIX 3.1 ----------- 1) Make a backup of /usr find /usr -print | backup -ivf /dev/rmt0 Use the appropriate tape device if it is not rmt0. 2) shutdown to maintenance mode shutdown -Fm 3) export LANG=C 4) remove the filesystem and the logical volume ignore an error about the "dspmsg" command not found umount /usr rmfs /usr 5) make a new logical volume hd2 and place it on rootvg with desired size mklv -yhd2 -a'e' rootvg NNN where NNN is the number of 4 meg partitions 6) create a filesystem on /dev/hd2 crfs -vjfs -dhd2 -m'/usr' -Ayes -p'rw' 7) mount the new /usr filesystem and check it /etc/mount /usr df -v 8) restore from the tape; system won't reboot otherwise restore -xvf/dev/rmt0 9) Sync and reboot the system; you now have a smaller /usr filesystem FOR AIX 3.2 ----------- 1) Remove any unneeded files from /usr. 2) Make sure all filesystems in the root volume group are mounted. If not, they will not be included in the re-installed system. 3) Type "mkszfile". This will create "/.fs.size" that contains a list of the active filesystems in the root volume group that will be included in the installation procedure. 4) Edit .fs.size. Change the size of /usr to what you want. Example: This .fs.size file shows /usr to be 40MB. rootvg 4 hd2 /usr 10 40 jfs The number 10 is the number of physical partitions for the filesystem and the 40 is 40 MB. Most systems have a physical partition size of 4 MB. Therefore, the second number (40) will always be 4 times the previous number (10). Note, however, that a model 320 with a 120 MB drive will have a physical partition size of only 2 MB, and the total MB is therefore twice the number of physical partitions. The first number (4) in the .fs.size file represents the PP size. If you want to reduce the size of /usr from 40 MB to 32 MB, edit the /usr entry to: rootvg 4 hd2 /usr 8 32 jfs IMPORTANT: Make sure that you DO NOT enter a value which is less than the size of the filesystem required to contain the current data. Doing so will cause the re-installation procedure to fail. 5) chdev -l rmt0 -a block=512 -T 6) Unmount all filesystems that are NOT in the root volume group. 7) Varyoff all user-defined volume groups, if any varyoffvg VGname 8) Export the user-defined volume groups, if any exportvg VGname 9) With a tape in the tape drive, type mksysb /dev/rmt0 This will do a complete system backup, which will include information (in the .fs.size file) for the installation procedure on how large the filesystems are to be created. 10) Follow the instructions in the Installation Kit under "How to Install and perform maintenance from Diskettes" using the diskettes and tape that you created in the previous steps. DO NOT select the option "Reinstall AIX with Current System Settings" during the install procedure. The new system must be installed using the option "Install AIX with Current System Settings" for the logical volume size changes to take affect. 11) When the operating system installation is complete, you may then import the information into your newly installed operating system for any user-defined volume groups. importvg -y VGname PVname where "VGname" is the name of the volume group, and "PVname" is the name of any one of the physical volumes in the volume group. 12) Varyon your user-defined volume groups varyonvg VGname The reduction of the filesystems is now complete. 1.13: How do I shrink the default paging space on hd6? 1) create a paging space to use temporarily mkps -s 20 -a rootvg 2) change default paging space hd6 so it is not used at next reboot chps -a n hd6 3) For AIX 3.1, edit /etc/rc.boot4 and change swapon /dev/hd6; for AIX 3.2, edit /sbin/rc.boot and change swapon /dev/hd6 swapon /dev/paging00 4) Update information in boot logical volume bosboot -a (3.1) bosboot -a -d hdisk0 (3.2) 5) shutdown and reboot 6) remove current hd6 and create a new one of smaller size rmps hd6 mklv -y hd6 -t paging rootvg 7) Re-edit /etc/rc.boot4 (3.1), /sbin/rc.boot (3.2) to swap to /dev/hd6 swapon /dev/hd6 8) Update information in boot logical volume bosboot -a (3.1) bosboot -a -d hdisk0 (3.2) 9) change current paging device (paging00) so it is inactive at next boot chps -a n /dev/paging00 10) shutdown, reboot, remove paging00 using the command: rmps paging00 1.14 How do I make a filesystem larger than 2 Gig? The largest filesystem under AIX is 2 Gigabytes because the largest signed integer is 2**31 - 1. 1.15: How do I see/change system parameters like number of processes per user? You can use SMIT as described below or simply use the lsattr/chdev pair. The former will list the current setting as in: # lsattr -E -l sys0 -a maxuproc maxuproc 40 Maximum # of processes allowed per user True and you can then increase the maxuproc parameter: # chdev -l sys0 -a maxuproc=200 sys0 changed If you just type 'lsattr -E -l sys0' you will get a list of all parameters, some of which can be changed - others not. If you want to use smit, this procedure can be followed: smit System Environments and Processes Change / Show Operating System Parameters - on this screen you can change by overtyping the following fields: - Maximum number of PROCESSES allowed per user - Maximum number of pages in block I/O BUFFER CACHE - Maximum Kbytes of real memory allowed for MBUFS - toggle fields exist for: - Automatically REBOOT system after a crash (false/true) - Continuously maintain DISK I/O history (true/false) 1.16: How can I unmount /usr to run fsck on it? From: accapadi@mathew.austin.ibm.com (Matt Accapadi) [ This is for 3.2. ] In order to fsck /usr, it has to be unmounted. But /usr cannot be unmounted because /bin is symbolically linked to /usr/bin. Also /etc/fsck is symbolically linked to /usr/sbin/fsck. To work around this, when you boot from the boot/maintenance diskettes and enter maintenance mode, enter "getrootfs hdisk0 sh" instead of "getrootfs hdisk0" where hdisk0 is the name of the boot disk. Then run "fsck /dev/hd2". 1.17: The swapper seems to use extreme amount of paging space, why? When you run ps, you may see a line like: USER PID %CPU %MEM SZ RSS TT STAT TIME CMD root 0 0.0% 14% 386528 8688 - S 17:06 swapper This is normal behavior, the swapper looks to ps like it has the entire paging space plus real memory allocated. 1.18: How much should I trust the ps memory reports? From: chukran@austin.VNET.IBM.COM Using "ps vg" gives a per process tally of memory usage for each running process. Several fields give memory usage in different units, but these numbers do not tell the whole story on where all the memory goes. First of all, the man page for ps does not give an accurate description of the memory related fields. Here is a better description: RSS - This tells how much RAM resident memory is currently being used for the text and data segments for a particular process in units of kilobytes. (this value will always be a multiple of 4 since memory is allocated in 4 KB pages). %MEM - This is the fraction of RSS divided by the total size of RAM for a particular process. Since RSS is some subset of the total resident memory usage for a process, the %MEM value will also be lower than actual. TRS - This tells how much RAM resident memory is currently being used for the text segment for a particular process in units of kilobytes. This will always be less than or equal to RSS. SIZE - This tells how much paging space is allocated for this process for the text and data segments in units of kilobytes. If the executable file is on a local filesystem, the page space usage for text is zero. If the executable is on an NFS filesystem, the page space usage will be nonzero. This number may be greater than RSS, or it may not, depending on how much of the process is paged in. The reason RSS can be larger is that RSS counts text whereas SIZE does not. TSIZ - This field is absolutely bogus because it is not a multiple of 4 and does not correlate to any of the other fields. These fields only report on a process text and data segments. Segment size which cannot be interrogated at this time are: Text portion of shared libraries (segment 13) Files that are in use. Open files are cached in memory as individual segments. The traditional kernel cache buffer scheme is not used in AIX 3. Shared data segments created with shmat. Kernel segments such as kernel segment 0, kernel extension segments, and virtual memory management segments. Speaking of kernel segments, the %MEM and RSS report for process zero are totally bogus for AIX 3.1. The reason why RSS is so big is that the kernel segment zero is counted twice. For AIX 3.2, this has been changed, but the whole story is still not known. The RSS value for process 0 will report a very small number of the swapper private data segment. It does not report the size of the kernel segment 0, where the swapper code lives. In summary, ps is not a very good tool to measure system memory usage. It can give you some idea where some of the memory goes, but it leaves too many questions unanswered about the total usage. 1.19 How do I mount a floppy disk as a filesystem? From: op@holmes.acc.Virginia.EDU (Olaf Pors) You can build a filesystem on a floppy and mount it, however the filesystem will be read only. The reason that the filesystem will be read only is because AIX Version 3.1.5 cannot create a journal log on a diskette. The intended use is for temporary access to the read only data. The diskette file system must be unmounted after use and during system backup procedures or errors could occur. To make the read only filesystem on a floppy: 1. Make a subdirectory on an existing filesystem on the hardfile, and place all of the files that the diskette will contain into this subdirectory. 2. Enter the following command to create a prototype file containing information about the new filesystem, in the example /dir_struct is the pathname of the subdirectory created in step 1, and proto_filename is the name of the prototype file to be created. proto /dir_struct > proto_filename 3. Place your floppy disk into the drive and format it. 4. Edit the prototype file and replace the first line with the following: 0 0 5. Enter the following command to make the filesystem on your floppy: mkfs -p proto_filename -V jfs /dev/fd0 6. Create the directory upon which you will mount the floppy based filesystem, or you can use the /mnt directory. Enter the following command to mount the filesystem: mount -r -V jfs /dev/fd0 /your_mount_point 7. To unmount the filesystem, use the command: umount /dev/fd0 Since the filesystem is read-only it may be of limited use but if you are going to use it for utility programs and other data that does not change much, it still may be useful. If you need to change the data, you can copy the directory from the floppy into another directory, make your modifications, and remake the filesystem using this procedure. 1.20 Some info about tape backups From: Craig Anderson The following supplements the information on rmt devices in InfoExplorer. It is based on my own personal experience with IBM tape drives running on AIX 3.1. No warranty is expressed or implied. CONFIGURING THROUGH SMIT: BLOCK size (0=variable length) (ALL) Sets the tape block size. When reading, the block size must be set to the block size set when the tape was written. When using some commands, tapes written with ANY block size can be read if the block size is set to 0 (variable length) (see "BLOCK SIZES" below). Use DEVICE BUFFERS during writes (ALL) Set to yes, the device will buffer data internally on writes. This greatly improves performance, but under certain cases may be undesirable since the data is not written to tape before returning a good indication. Use EXTENDED file marks (8mm only) Extended file marks take up much more space than short (or non-extended) file marks. But extended file marks can be overwritten, allowing data not at the beginning of tape to be overwritten (see "FILE MARKS" below). RETENSION on tape change or reset (1/4" only) If set to "no" then the tape will not be retentioned automatically when the tape is inserted. Note that this will take effect only after the device is used. FILE MARKS: Tape devices support multiple tape files. Tape files are the result of a backup/cpio/tar/dd type command, where the device is opened, written to, and closed. Because tapes allow large quantities of data to be written on a single tape, several backups (that is, tape files), may be combined on one physical tape. Between each tape file is a "tape file mark" or simply "file mark". These file marks are used by the device driver to indicate where one tape file ends and another begins. B E <------- O O -------> T T __ ____________________________ _______________ physical | \ | | \ |physical beginning| \ | tape | \ | end of | \ | file | \ | of tape | \ | mark | \ | tape |_____\________|_______|__________\_________| Note that there is a distinction between the beginning of tape (BOT) side of a file mark and the end of tape (EOT) side of a file mark. If the head is on the BOT side of a file- mark, "tctl fsf 1" command will move only to the EOT side of the same file mark. With the 1/4" tape drive, writing can only take place sequentially, or after blank tape has been detected. You cannot write over data on the tape (except at BOT). If you wish to add data to a tape which has been written and then rewound you should space forward file mark until an error occurs. Only then can you start writing again. With an 8mm tape drive, writing can only take place before blank tape, an EXTENDED file mark, or at BOT. Thus if several backups have been made on one tape and you wish to overwrite one of the backups, position the tape to the place you wish to start writing and issue the following commands: tctl bsf 1 tctl eof 1 The first command skips back to the BOT side of the same file mark. The second command rewrites the file mark (writing is allowed before extended file marks). The erase head will erase data ahead of the write head, so that after writing the file mark the head will be positioned before blank tape. Only after this may you start writing over data in the middle of the tape. (All data beyond where you are currently writing will be lost). Note that you cannot write over short file marks. In order for this to work, the tape must have been written with extended file marks (use smit to change this). With the 9-track drive writing can take place anywhere on the tape although overwriting single blocks of data is not supported. On the 8mm drive extended filemarks use 2.2 megabytes of tape and can take up to 8.5 seconds to write. Short filemarks use 184K and take up to 1.5 seconds to write. BLOCK SIZES: When data is written to tape it is written in blocks. The blocks on a tape are separated by inter-record gaps. It is important to understand the structure of the written tape in order to understand the problems which can occur with changing block sizes. In fixed block size mode all blocks on the tape are the same size. They are the size of the block size set in the device configuration. All read()s and write()s to the tape drive must be a multiple of the fixed block size. In fixed block mode a read() will return as many blocks as needed to satisfy the read() request. If a file mark is encountered while reading the tape only the data up until the file mark will be returned. It is not possible for the tape drive to read a tape whose block size is not the same as the block size in the device configuration. (Unless the device configuration is in variable size blocks.) In variable block size (0) mode, the blocks written on the tape are the size of the read() and write() requests to the device driver. In this case, the actual block sizes on the tape can be changed using the options to the backup commands (tar -C, cpio -C, backup -C). In variable mode, read() requests greater than size of the block on the tape will return only the data from the next block on the tape. It is this feature that allows tapes written in any block size (fixed or variable) to read with the dd command (the output from the dd command may be piped to restore, tar, or cpio for example.) Note that backup, tar, and cpio cannot read all tapes by using a large block size because they assume there is an error if they get a short read(). dd ibs=128k obs=16k if=/dev/rmt0 | ... The tape head is always positioned at an inter-record gap, file mark, or blank tape after reading or writing. With the 8mm tape drive, using a fixed block size which is not a multiple of 1K is inefficient. The 8mm tape drive always writes internally in 1K blocks. It simulates the effect of variable block sizes, but, for example, using a fixed block size of 512 bytes (or using variable block size and write()ing 512 bytes at a time) wastes one half of the tape capacity and gives only one half the maximum transfer rate. EXCHANGING DATA WITH NON-UNIX AND OTHER VENDORS MACHINES: Many tape drives support both variable and fixed block sizes. Variable block mode writes block sizes the size of the write command issued (tar and backup specify this with the -b option). In fixed mode, block sizes are fixed and all writes must be a multiple of the fixed block size. Unix often internally chops larger reads and writes up into manageable pieces (often 65535, 65534, or 65532 bytes) before doing the actual reads and writes. This means reads and writes of 64K bytes are often broken up into a 65535 byte record and a 1 byte record (In fixed mode the write will fail). Block sizes >= 64K (-C128 and greater) should be avoided for this reason. AIX does not break up read and write requests, but be aware of the situation on other machines. If the tape is written in an unknown block size then set the device configuration in smit to use variable size blocks, use the "dd" command with a large input block size, and pipe it to the restore command. For example: chdev -l rmt0 -a block_size=0 dd if=/dev/rmt0 ibs=128k obs=16k | tar -tvf- 1.21: How do I do remote backup? There seems to be several ways of doing this. I found the following works: tar -b1 -cf - . | rsh REMOTEHOST "dd ibs=512 obs=1024 of=/dev/TAPEDEVICE" From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer) mksysb will not back up to remote tape devices. Frank provided the following script to do remote backups. [Editor's note: I've verified this script works fine. However, it may be slow for large filesystems since it creates a temp file of filenames in /tmp.] #!/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 #-----------------------------------------------------------------# # EOF # #-----------------------------------------------------------------# 1.22: How do I backup a multi-disk volume group? From: pack@acd.ucar.edu (Daniel Packman) [ Editor's note: I have not verified this procedure. I would actually recommend NOT to have one volume group span multiple disks unless you really need such big logical volumes. ] 1. If you have a set of three or more disks in a volume group. (typically 3 for 5xx machines with three internal drives; with only two, the procedures outlined here have to be modified to ignore the fact that you don't have a quorum in the volume group) 2. If one drive has failed (usually only one fails at a time :-) ) It is possible to go through a service boot and (if we say the volume group is called rootvg and one of the 2 good disks on it is called hdisk0): importvg -y rootvg hdisk0 varyonvg -f -n -m1 rootvg These commands will work, but give error messages. If you wish to mount a user filesystem, say /u on logical volume /dev/lv00, then mount -f /dev/lv00 /v will work only if the jfslog, the journaled file system log device, is not on the damaged disk. If it is, you must (and can in any case) mount the filesystem read-only: mount -f -r /dev/lv00 /v This crucial and rather obvious point baffled several level 3 support personnel at Austin as well as myself for almost a week. Once the file system(s) of interest are available, then they can be saved to tape for restoration later. Of course, one can expect only about two thirds of a filesystem to be recoverable if it spans all 3 physical disks. One other point to remember is that the standard boot procedure from floppy includes the restore command but does not include the backup command. ***************************************************************************** * If you do not have other RS6000 machines at your site is is imperative * * that you either build a bootable tape which includes either restore or * * tar or cpio (a bootable floppy set will not have enough space) or at the * * very least copy onto a spare floppy backup, cpio, or tar. The floppy * * should be created with backup -ivq so that its contents can be read into * * the memory resident system after booting. * ***************************************************************************** All is not lost if tar, cpio or backup are available on an undamaged disk that can be mounted. Since tar and cpio are in /bin, they may both very well be unavailable. It is a very good idea for those who have tape devices to build a bootable tape with their desired extra commands in it. Follow the instructions from IBM but add your desired commands to the following three files: /usr/lpp/bosinst/tape2 /usr/lpp/bosinst/diskette/boot2 /usr/lpp/bosinst/diskette/inslist If you have anything other than a minimum memory configuration, you should be able to add many commands. 1.23: How do I put multiple backups on a single 8mm tape? From: kerm@mcnc.org (Cary E. Burnette) There are two possible solutions to this, which both use the /dev/rmt0.1 device which is non-rewinding. SOLUTION #1 ----------- To put multiple backups on a single tape, use /dev/rmt0.1, which is a no-rewind device, using either rdump or backup (both by name & inode work). Using rdump or backup "byinode" both generate the message that the tape is rewinding but actually do not. This is an example that would work on my system: # 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 # rewinds the tape where I am implementing the command from host. To restore a table of contents of the first I would use # restore -f /dev/rmt0.1 -s1 -tv where the -s1 flag tells restore to go to the first record it comes across on the tape. To get the second type in exactly the same once again. Basically -s(Number) stands for - go to Number record from this spot. It works pretty well. SOLUTION #2 ----------- Steve Knodle Educational Resources Center Clarkson University I use: ------------------- Dump.sh -------------------- 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 I process the table-of-contents first by a little program that does common prefix encoding, and then compress. This gives a table of contents file I can keep on-line until the tape is reused. 1.24: How do I remove a committed lpp? From: drb@chmeds.ac.nz (Ross Boswell) This seems to be a common problem. I got the following script from IBM NZ AIX software support. As far as I know, it works -- I used it to remove unwanted fonts. I have no official permission to post it -- use it at your own risk! This script only works on AIX 3.2. #!/bin/ksh # # Permanently remove a product from disk and AIX databases # if [ `whoami` != "root" ] ; then echo You must be root to run this script. exit 1 fi if [ `uname -a | awk '{print $1$4$3}'` != "AIX32" ] ; then echo This script only works on AIX 3.2. exit 1 fi TMP_FREE=`df /tmp | awk '$3 ~ /[0-9]/{print $3}'` if [ "$TMP_FREE" -lt 1000 ] ; then echo There is not enough room in your /tmp directory. echo You need 1000 KB free, and you have only $TMP_FREE KB free. echo Either remove some stuff from /tmp, or use chfs to make it bigger. exit 1 fi ODMDIRS="/etc/objrepos /usr/lib/objrepos /usr/share/lib/objrepos" ODMDIR=/usr/lib/objrepos export ODMDIR if [ $# -lt 1 ] then echo usage: $0 lppname [lppname ...] echo lppname is a string compatible with grep, ie "X11" or "PHIGS" echo typing $0 PHIGS will remove all LPPs with PHIGS in their name. exit 1 fi NAMES=$1 shift while [ $# -gt 0 ] ; do NAMES="$NAMES|$1" shift done echo "Searching for lpps with egrep \"$NAMES\"...\c" for ODMDIR in $ODMDIRS ; do if [ ! -d $ODMDIR -o ! -w $ODMDIR ] ; then echo $ODMDIR is not writeable or is not a directory. echo I hope this is because you are a /usr client or diskless. echo If you are not a diskless or a /usr client, you should stop. echo "Enter y to continue ->\c" read answer if [ "$answer" != "y" ] ; then exit 0 fi fi TMP=`odmget lpp | awk -F\" '/name/ {print $2}' | egrep "$NAMES"` LPPS=`echo $LPPS $TMP` done if [ "$LPPS" = "" ] then echo "failed.\nNo LPP with the name $NAMES detected." exit 1 fi echo ok. for ODMDIR in $ODMDIRS ; do mkdir -p /tmp/rmlpp/$ODMDIR > /dev/null 2>&1 done > /tmp/listOfFilesToRM$$ # truncate temporary file, just in case. echo echo This script is about to attempt to remove an LPP from your system. echo I say attempt, because it could fail. If it fails, you may have echo to at least reload the LPP. Use the \"lppchk\" command to make sure echo all is well with your system. echo # Loop through all the LPP names found. for LPP in $LPPS do DESCR=none answer="" # find the LPP ids. They will be different in the three SWVPD databases. for ODMDIR in $ODMDIRS ; do # get the lpp id for this ODMDIR (yes, they are different) LPPID=`odmget -q name=$LPP lpp | grep lpp_id | sed 's/.* = //'` # did we find the LPP? if [ "$DESCR" = "none" -a "$LPPID" != "" ] ; then # all the descriptions should be the same DESCR=`odmget -q name=$LPP lpp | grep description | sed 's/.* = //'` echo "Delete $LPP, $DESCR?" echo "y or (n) ->\c" read answer if [ "$answer" != "y" ] ; then # jump back up to the next LPP name continue 2 fi fi # if there is no DESCR, then we didn't find the LPP. Weird. if [ "$DESCR" = "none" -o "$LPPID" = "" ] ; then continue fi SOMETHING_DONE_FLAG=true # Optionally, save the ODM stuff we are about to remove, # in case something goes wrong. The problem is it is difficult # to determine if something really did fail, since these commands # don't return any decent error return codes. odmget -q lpp_id=$LPPID history > /tmp/rmlpp/$ODMDIR/$LPP.history odmget -q name=$LPP lpp > /tmp/rmlpp/$ODMDIR/$LPP.lpp odmget -q lpp_name=$LPP product > /tmp/rmlpp/$ODMDIR/$LPP.product # Get the list of files and links to remove later.... odmget -q lpp_id=$LPPID inventory > /tmp/rmlpp/$ODMDIR/$LPP.inventory awk -F\" '/loc/ {print $2}' /tmp/rmlpp/$ODMDIR/$LPP.inventory | \ sed 's/,/ /g' >> /tmp/listOfFilesToRM$$ odmdelete -o history -q lpp_id=$LPPID > /dev/null 2>&1 odmdelete -o lpp -q name=$LPP > /dev/null 2>&1 odmdelete -o product -q lpp_name=$LPP > /dev/null 2>&1 odmdelete -o inventory -q lpp_id=$LPPID > /dev/null 2>&1 done done if [ "$SOMETHING_DONE_FLAG" = "true" ] ; then echo ODM work is done. Now, time to delete files.... # This could be catastrophic if there is a problem. For example, # if the ODM database for an application had / as one of its files. # You be the judge. Here's your rope.... cat /tmp/listOfFilesToRM$$ | sort -r | uniq | xargs rm -rf rm -rf /tmp/listOfFilesToRM$$ echo done. fi # take this line out if you want to save your ODM saved files. rm -rf /tmp/rmlpp exit 0 1.25: My named dies frequently, why? Running on 3.2, named dies frequently on network's primary name server. From: jpe@ee.egr.duke.edu (John P. Eisenmenger) Try the following: stopsrc -s named # stop running named setenv MALLOCTYPE 3.1 # use 3.1 memory allocation algorithm /etc/named ... # don't use smit to start named You might be able to use startsrc/smit after setting MALLOCTYPE and get the same effect, but I'm not sure. [According to John, the problem is malloc() in the named code. He also suggests using Berkeley's bind, which he has ported and can be ftp'ed from ftp.egr.duke.edu, /archives/network/bind-4.8.3.tar.Z. -ed] Two ptfs should fix this problem. Get U412332 and U414752. 1.26: How do I trace ethernet packets on an AIX system? From: afx@muc.ibm.de (Andreas Siegert) Do the following: iptrace -i en0 /tmp/ipt The iptrace backgrounds. Find its process id and kill it when you are ready. Then run ipreport -rns /tmp/ipt >/tmp/ipr and look at the output. The current version of Info does not document the r, n and s options but they are quite useful for layering the output. 1.27: How can I look at PostScript files? Why is "dpsexec" so lousy? From: VRBASS@ATLVMIC1 (Vance R. Bass) You can look at PostScript files using either "xpreview" (which comes with the operating system in the optionally installable text formatting services) or you can get GhostScript and GhostView from a comp.sources.x server and build it yourself. >From the "xpreview" man page: The xpreview command is an AIXwindows 1.2- and Motif 1.1-based application that displays output from the troff command on an AIXwindows display. The The troff command output file must be prepared for any one of the devX100, devX100K or devpsc devices. The xpreview command also displays PostScript language files that begin with %! (percent sign and exclamation mark). "dpsexec" is NOT intended to be a full-service document browser, but rather a simple DPS code debugger. If you insist on using it, you can edit your PS code to remove the "showpage" (which will reset dpsexec and clear the window) to view single-page files. It does not handle multi-page files gracefully. 1.28 What is the authorized way of starting automount at boot time? From: curt@ekhadafi.austin.ibm.com (Curt Finch) I put this in my /etc/inittab: automount:2:once:/usr/etc/automount -T -T -T -v >/tmp/au.se 2>&1 I hereby dub it authorized. 1.29 InfoExplorer ASCII key bindings From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum) If you just press `Return' when it starts up, with `Basic Screen Operations' highlighted, you'll get some help. If you look long enough, you'll find a page named `Using Keys and Key Sequences in the InfoExplorer ASCII Interface'. It should describe of the key sequences and actions. Here are a few to get you started. Keys Action Ctrl-W Moves between the Navigation screen and the Reading screen. If the Navigation screen is displayed, you can press the Ctrl-W key sequence to display the Reading screen. If the Reading screen is displayed, you can press the Ctrl-W key sequence to display the Navigation screen. Ctrl-O Makes the menu bar active or inactive. If your text cursor is located in the text area of the screen, you can press the Ctrl-O key sequence to make the menu bar active. If the menu bar is already active, you can press the Ctrl-O key sequence to make it inactive, which moves the text cursor to the text area. Tab Moves to the next menu bar option in the menu bar. If a pull-down menu is not displayed and you press the Right Arrow key, the next menu bar option is displayed in reverse video. 1.30: Listing files with ls causes a core dump From: jfh@greenber.austin.ibm.com (John F Haugh II) Scenario: a directory that is shared by N users (N >= 200). Run 'ls -l' in that directory. It goes for a while, then Seg fault(coredump)! It only occurs when the usernames are displayed (almost every file is owned by a different person). The -g and -n options work fine; only -l and -o (which shows owner and not group) cause it. I believe that this problem was corrected by U407548. If you have that many users that you are having core dump problems (it took over 200 ...), you might also want to look into getting the PTF that fixes IX31403. That APAR deals with large numbers of accounts and performance problems associated with looking them up. 1.31: Where are the AIX log files kept? From: dirk@kimosabi.ucsc.edu (Dirk Coldewey) Such as the equivalent of the SunOS file '/var/log/syslog' and '/var/adm/messages'. If you want regular unix syslog files, you can configure syslogd in /etc/syslog.conf. Here's the one that I use: # # See the supplied /etc/syslog.conf file for copious comments. # *.err;kern.debug;auth.notice;user.none /dev/console *.err;kern.debug;daemon,auth.notice;mail.crit;user.none /var/adm/messages lpr.debug /var/adm/lpd-errs *.alert;kern.err;daemon.err;user.none operator *.alert;user.none root *.emerg;user.none * # for loghost machines, to have authentication messages (su, login, etc.) # logged to a file, un-comment out the following line and adjust the # file name as appropriate. # # if a non-loghost machine chooses to have such messages # sent to the loghost machine, un-comment out the following line. # auth.notice /var/log/authlog mail.debug /var/log/syslog # following line for compatibility with old sendmails. they will send # messages with no facility code, which will be turned into "user" messages # by the local syslog daemon. only the "loghost" machine needs the following # line, to cause these old sendmail log messages to be logged in the # mail syslog file. # user.alert /var/log/syslog # # non-loghost machines will use the following lines to cause "user" # log messages to be logged locally. # user.err /dev/console user.err /var/adm/messages user.alert `root, operator' user.emerg * 1.32: Two srcmstr's are less useful than one? From: hubert@rs530.ncs.mainz.ibm.com (Bernhard Zeller) This can happen on systems that have no console, or systems with an async terminal as the console but not attached or turned off. One of the symptoms is a second srcmstr got run. But the second srcmstr is worthless as we can't use the stop/startsrc commands, refresh inetd, qdaemon won't start, etc. To resolve this, type: smit chgtty and add the keyword 'clocal' in following lines: STTY attributes for RUN TIME STTY attributes for LOGIN 1.33: Where can I find tools for performance monitoring? For 3.2 a few tools are available in /usr/lpp/bosperf. There are tools to monitor traces, I/O events, CPU, virtual memory, disk block usage, kernel extensions, etc. It even has a simulator, rmss, that allows one to try out different memory size configurations to see how it impacts performance. See 6.06 about the AIX Performance and Tuning Guide. 1.34: How do I set a tty port for both dial-in and dial-out? Set the mode of the tty to be either 'shared' or 'delayed'. 1.35: SCSI-1 and SCSI-2 "interoperability" got you confused? From: drr A. SCSI-1 devices are supported on a SCSI-2 adapter. This config will provide SCSI-1 performance. B. SCSI-2 devices are supported on a SCSI-1 adapter. This config will provide SCSI-1 performance. C. A mix of SCSI-2 and SCSI-1 devices are supported on a SCSI-1 adapter. All devices will have SCSI-1 performance. D. A mix of SCSI-2 and SCSI-1 devices are supported on a SCSI-2 adapter. SCSI-2 devices will have SCSI-2 performance (10 MB/sec) and SCSI-1 devices will have SCSI-1 performance (4-5 MB/sec). 1.36: How to move or copy whole directory trees across a network The following command will move an entire directory tree across a network while preserving permissions, uids and gids. $rsh RemoteHost "cd TargetDir; tar -cBf - ." | tar -xvBf - Explanation: The tar-create is rsh'd to the remote system and is written to stdout (the pipe). The local system is extracting the tar that is being read from stdin (the pipe). 1.37: How to get your keyboard back after unplugging it from the 6000 From: Mickey Coggins and Anne Serre When you unplug your keyboard from a running system, and plug it back in, the key mapping is wrong. For example, keys like Caps Lock and Ctrl don't work as designed. Solution: Type at the command line /usr/lpp/diagnostics/da/dkbd Your screen goes black, you hear a few beeps, and your keyboard is reset. It works with any environment, Xwindows, hft, NLS... 1.38: How do I set up ksh for emacs mode command line editing? From: scotte@cdsac.uucp (L. Scott Emmons) The ksh has an undocumented way of binding the arrowkeys to the emacs line editing commands. In your .kshrc, add: alias __A=^P alias __B=^N alias __C=^F alias __D=^B alias __H=^A Note that "^P" (et al) must be the actual control sequence. Type "set -o emacs" or put this line in your .profile. Also, you MUST have PTF U406855 for this to work in AIX 3.2. The APAR # for the problem is IX25982, which may have been superceeded. 1.39: How can I tell what virtual printer a print queue is using? From: yoder@austin.ibm.com (Stuart R. Yoder) Use the command 'lsvirprt'. Don't use any parameters and it will run in an interactive mode that will give you a menu of all virtual printers on the system with the queue and device for each one. 1.40: How can I add new man pages to the system? From: horst@faui63.informatik.uni-erlangen.de (Horst Luehrsen) Put the man pages in /usr/man, eg. /usr/man/man1/tcsh.1 for the tcsh man page. Unter AIX 3.1.10, there is a shell script /usr/lib/makewhatis which can be used to update the makewhatis-database /usr/man/whatis so apropos and whatis know about the added manpages. /usr/lib/makewhatis should be available on all 3.2 versions. 1.41: How much paging space do I need? The rule of thumb is paging space = 2 times physical memory. For example, if your system has 48 MB of RAM, you want to allocate 96 MB for paging. However, this is application dependent. If you do software development, especially large projects, then you should consider this rule. But if your system has 512 MB memory, you may not need 1 Gig of paging. Use 'lsps -a' during typical system loading to determine if your system is thrashing. Never allocate less paging space than physical memory or performance will suffer seriously. 1.42: How can I make an exact duplicate of a tape over the network? The challenge here is not to have to create a temporary file (disk space limitation) and work across heterogenous networks. This script might work: 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 From: pack@acd.ucar.edu (Daniel Packman) Daniel provides the following perl script to convert from the known world's function codes to AIX for compatibility. #!/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 () { s/(^I)(\d$)/I$iocs[$2]/; exit 0 if $_ =~ /^[Qq]/; print RMT $_ ; } exit 0; 1.43: How do I find a file name from the inode number? From: svpillay@berlioz.crs4.it (Kanthan Pillay) find /mntpoint -xdev -inum nnnn -print 1.44: How do I set up postscript accounting? From: taluskie@utpapa.ph.utexas.edu (Vince Taluskie) The following program to configure postscript page accounting was originally written by Ephraim Vider. It acts as a backend wrapper which logs accounting information in /etc/qconfig. It can be ftp'd from utpapa.ph.utexas.edu in /pub/aix/psacct.tar.Z. To get this program running compile it with cc pswrap.c -o pswrap -lqb and then make this program suid root with chown root pswrap chmod u+s pswrap If this step is not done, the printer will hang. Then start up SMIT and go to : Spooler Manage Local Printer Subsystem Local Printer Queue Devices Change / Show Characteristics of a Queue Device and change "BACKEND PROGRAM pathname" to the full pathname of pswrap since pswrap will now handle the backend interface with the queue. A stream of info will be written to a logfile in /tmp (prob lp0.log) but this file is mainly used for status info and raw pagecounts. If the accounting data is going to the qconfig-specified acctfile, then use the 'pac' command to read it. I prefer to have readable ascii data files instead, so just I comment out the '#define WANT_PAC' line and it will only go to the ACCTFILE specfied in pswrap.c. /********* pswrap.c ***********/ /* compile with: cc pswrap.c -o pswrap -lqb (for doc on the qb library see "understanding backend routines in libqb") BTW: The log_charge() function doesn't seem to do anything, but log_pages() updates the accounting info. Ephraim Vider, original author -- Feb 10, 1993 You can set pswrap up to use either the accounting file specified in /etc/qconfig (which means that you need to get your data from 'pac') or you can comment out the #define WANT_PAC line and then the accounting data will only go into the ACCTFILE. Also modified the logging to the ASCII acctfile so that it looks more readable. Vince Talsukie, taluskie@utpapa.ph.utexas.edu */ #include #include #include #include #include #include #include #include #include #include "qprocs.h" char *nextword (char *p); char *skipvalue (char *p); #define LOGDIR "/tmp" #define ACCTFILE "/usr/adm/acct/lpr/ps-acct" /* #define WANT_PAC 1 */ /* this define will also send accounting info to the acctfile specified in /etc/qconfig file. If this define is commented out then accounting info will only go to ACCTFILE */ char pcprog[] = "statusdict begin pagecount = end\n\x04"; char *keyw[] = { "idle", "busy", "waiting", "printing", "initializing", NULL }; enum { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN }; void giveup(); jmp_buf jumper; char logfname[30]; FILE *logfile, *acctfile; main (argc, argv) int argc; char *argv[]; { char *devname; int pagcnt, c; int pid; int w, status; if (argc < 2) { fprintf(stderr, "Usage: psbe file\n"); exit(-1); } if (log_init(argv[1]) < 0) { fprintf(stderr, "log_init failed!\n"); exit(EXITBAD); } sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name()); if ((logfile = fopen(logfname, "a")) == NULL) { fprintf(stderr, "Can't open logfile.\n"); exit(EXITBAD); } if ((acctfile = fopen(ACCTFILE, "a")) == NULL) { fprintf(stderr, "Can't open logfile.\n"); exit(EXITBAD); } setvbuf(logfile, NULL, _IOLBF, BUFSIZ); setvbuf(acctfile, NULL, _IOLBF, BUFSIZ); setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(), get_qdate()); log_status(WAITING); pagcnt = getpagecnt(); log_status(RUNNING); if ((pid = fork()) < 0) { perror("fork"); exit(EXITBAD); } if (pid == 0) { argv[0] = "piobe"; execv("/usr/lpd/piobe", argv); perror("exec"); exit(EXITBAD); } while ((w = wait(&status)) != pid) if (w == -1) { perror("wait"); exit(EXITBAD); } if (WEXITSTATUS(status) != 0) exit(WEXITSTATUS(status)); log_status(WAITING); if (pagcnt > 0 && (c = getpagecnt()) > 0) { #ifdef WANT_PAC log_pages(c - pagcnt); #endif } fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(), get_qdate()); /* the accounting file format is pages_printed user queue_printed_on time_queued */ fprintf(acctfile, "%d %35s %7s %s \n", (c - pagcnt), get_from(), get_queue_name(), get_qdate()); fclose(logfile); fclose(acctfile); exit(EXITOK); } void giveup () { longjmp(jumper, 1); } getpagecnt () { int pc = 0, pstat; char buf[81]; if (setjmp(jumper) != 0) { fprintf(logfile, "giving up on status\n"); return (0); } alarm(60 * 2); signal(SIGALRM, giveup); do { if (!gets(buf)) { sleep(5); putchar('\x14'); /* ^T returns status */ sleep(1); /* wait for answer from printer */ if (!gets(buf)) return (0); } fprintf(logfile, "%s\n", buf); if ((pstat = getstatus(buf)) == PS_WAIT) { putchar('\x04'); sleep(1); } } while (pstat != PS_IDLE); alarm(0); while (gets(buf)) fprintf(logfile, "%s\n", buf); printf("%s", pcprog); sleep(1); /* wait for answer from printer */ if (!gets(buf)) return (0); if (sscanf(buf, "%d", &pc) != 1) return (0); fprintf(logfile, "%d\n", pc); return (pc); } /** ** Parser for printer status messages **/ getstatus (p) char *p; { char *t; int i; if ((p = strchr(p, '%')) == NULL) return (PS_UNKNOWN); if (strncmp(p, "%%[", 3) != 0) return (PS_UNKNOWN); for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) { t = p; p = strchr(p, ':'); *p++ = '\0'; p = nextword(p); if (strcmp(t, "status") == 0) break; } if (p == NULL) return (PS_UNKNOWN); t = p; p = strchr(p, ' '); if (p[-1] == ';') p--; *p = '\0'; for (i = 0 ; keyw[i] != NULL ; i++) if (strcmp(t, keyw[i]) == 0) break; return (i); } char *nextword (p) char *p; { while (isspace(*p)) p++; if (strncmp(p, "]%%", 3) == 0) return (NULL); return (p); } char *skipvalue (p) char *p; { char *t; while (p != NULL) { p = strchr(p, ' '); t = p; p = nextword(p); if (t[-1] == ';') break; } return (p); } /********* qprocs.h ***********/ /* functions for communication between qdaemon and the backend */ char *get_from(); char *get_to(); char *get_qdate(); char *get_queue_name(); char *get_device_name(); char *get_title(); 1.45: How do I set up pcsim, the DOS emulator? You must have a bootable DOS diskette to install pcsim. Either DOS 3.3, 4.x, or 5.0 will work. IBM do not officially support DOS 5.0 for pcsim but I have no problems with it. Just don't try to be fancy with the UMB and memory manager stuff. With a bootable DOS disk in the drive, do: $touch /u/dosdrive (this is the AIX file for DOS emulation) $pcsim -Adiskette 3 -Cdrive /u/dosdrive You would now get an A prompt. Type: A> fdisk Create the virtual C drive of whatever size you choose. Make it large enough for your needs since you cannot enlarge it later. A> format c: /s (to format the virtual C drive) Now exit from pcsim with ESCpcsim (Esc key followed by pcsim). Now create a simprof file. Following is a starter: Adiskette : 3 Cdrive :/u/dosdrive lpt1 : name of printer queue refresh : 50 dmode : V mouse : com1 You can now start pcsim anytime by typing pcsim. Make sure no floppies are in the drive. For further information, refer to publication SC23-2452, Personal Computer Simulator/6000 Guide and Reference. 1.46: How do I transfer files between AIX and DOS disks? In one of the bos extensions are commands for transferring files between DOS diskettes and AIX. The commands are dosread, doswrite, dosdir, dosdel, and dosformat. Many users have mentioned that the mtools package from prep.ai.mit.edu is better than the native AIX programs. 1.47: How do I create boot diskettes for 3.2? You need to have four formatted diskettes. boot disk: bosboot -d /dev/fd0 -a display disk: mkdispdskt display extension disk: mkextdskt Install/Maintenance disk: mkinstdskt 1.48: Some info about the memory management system From: Michael Coggins (MCOG@CHVM1.VNET.IBM.COM). The following questions are answered in this document: 1. Does AIX use more paging space than other unix systems? 2. How much paging space do I need? 3. Why does vmstat show no free RAM pages? 4. Since vmstat shows no free RAM pages, am I out of RAM? 5. Shouldn't the "avm" and the "fre" fields from vmstat add up to something? 6. Why does the "fre" field from vmstat sometimes show lots of free RAM pages? 7. Is the vmstat "fre" field useful? 1. Does AIX use more paging space than other unix systems? Under many scenarios, AIX requires more paging space than other unix systems. The AIX VMM implements a technique called "early allocation of paging space". When a page is allocated in RAM, and it is not a "client" (NFS) or a "persistant" (disk file) storage page, then it is considered a "working" storage page. Working storage pages are commonly an application's stack, data, and any shared memory segments. So, when a program's stack or data area is increased, and RAM is accessed, the VMM will allocate space in RAM and space on the paging device. This means that even before RAM is exhausted, paging space is used. This does not happen on many other unix systems, although they do keep track of total VM used. Example 1: Workstation with 64mb RAM is running only one small application that accesses only a few small files. Everything fits into RAM, including all accessed data. On AIX, some paging space will already be used. On other unix systems, paging space will be 100 percent free. Clearly, this is an example that shows where we use more paging space than the other machines. Example 2: Same machine as above, except we are running in an environment where many applications are running, and RAM is "overcommitted" (there is not enough RAM). Also, in this environment, the system is running applications that are started, run, left idle, and not in constant use. A session of FRAME running in a window, for example. What happens is that eventually (theoretically) all applications will be paged out at least once. On the AIX system and the other systems the total paging requirements will be the same (assuming similar malloc algorithm). The major difference is that the AIX system allocated the paging space pages before they were actually needed, and the other systems did not allocate them until they were needed. However, most other systems have an internal variable that gets incremented as virtual memory pages are used. AIX does not do this. This can cause the AIX system to run out of paging space (virtual memory), even though malloc() continues to return memory. This "feature" allows sparse memory segments to work, but requires that all normal users of malloc() (sbrk()) know how much virtual memory will be available (actually impossible), and to handle a paging space low condition. A big problem. There are some pretty obvious pros and cons to both methods of doing Virtual Memory. 2. How much paging space do I need? Concerning the rule of thumb of having 2 times RAM for paging space: this is rather simplistic, as are most "rules of thumb". If the machine is in a "persistant storage environment", meaning that they have a few small programs, and lots of data, they may not need even as much as 1 times RAM for paging space. For example, a 1GB database server running on a RISC System/6000 with 256MB of RAM, and only running about 50MB of "working" storage does not need 512MB of paging space, or even 256MB of paging space. They only need the amount of paging space that will allow all their working storage to be paged out to disk. This is because the 1GB database is mostly "persistant storage", and will require little or no paging space. Excessive paging space may simply mean wasted disk space. However, avoid insufficient paging space. Tip: Don't have more than one paging space per disk. Tip: Put lots of RAM in your System - it will use it. 3. Why does vmstat show no free RAM pages? AIX uses RAM as a possibly huge disk buffer. If you read a file in the morning, that file is read into RAM, and left there. If no other programs need that RAM, that file will be left in RAM until the machine is halted. This means that if you need the file again, access will be quick. If you need that RAM, the system will simply use the pages the file was using. The pages were flushed back to disk earlier. This means that you can get a huge speedup in disk access if you have enough RAM. For example, a 200MB database will just ease into RAM if you have a 256MB system. 4. Since vmstat shows no free RAM pages, am I out of RAM? Probably not. Since disk files will be "mapped" into RAM, if vmstat shows lots of RAM pages FREE, then you probably have too much RAM (not usual on a RISC System/6000)! 5. Shouldn't the "avm" and the "fre" fields from vmstat add up to something? No. The "avm" field tells you how much "Active Virtual Memory" AIX thinks you are using. This will closely match the amount of paging space you are using. This number has *ABSOLUTELY* nothing to do with the amount of RAM you are using, and does *NOT* include your mapped files (disk files). 6. Why does the "fre" field from vmstat sometimes show lots of free RAM pages? This will happen after an application that used a lot of RAM via "working" storage (not NFS storage, and not disk file or "persistent" storage) exits. When RAM pages that were used by working storage (a program's stack and data area) are no longer needed, there is no need to leave them around. AIX completely frees these RAM pages. The time to access these pages versus a RAM page holding a "sync'd" mapped file is almost identical. Therefore, there is no need to periodically "flush" RAM. 7. Is the vmstat "fre" field useful? The vmstat "fre" field represents the number of free page frames. If the number is consistently small (less than 500 pages), this is normal. If the number is consistently large (greater than 4000 pages), then you have more memory than you need in this machine. 1.49: unix:0 vs `hostname`:0 1.) Is there any way to get the machine to check its local host table first without renaming resolv.conf? From: mcguire@selway.umt.edu (Charles J McGuire) Not that I know of. Under SunOS and Ultrix you can specify, check /etc/hosts, then NIS, then DNS. On our AIX machines, I have a cron job that checks the integrity of both the primary and secondary nameservers every 5 minutes. If they're gone, the cron pgm renames resolv.conf. The pgm continues to check the servers. When they're back, it moves resolv.conf back. Even with this arrangement, I need to configure two resolv.conf files that switch the order of the primary and secondary servers if the primary goes away. If the primary is unavailable, queries can still take a while to time out on the primary, before querying the secondary. This method is not very elegant, but it does the job. Things are a little unstable during the transitions depending on when the servers go away relative to when the cron pgm runs - not to mention slight differences in clock times. 2.) How do you tell X applications where you are if the console display is unix:0? From: crow@waterloo.austin.ibm.com (David L. Crow) I would suggest that if you have R5, use ":.". I do not believe that R4 clients will understand :0, so I would suggest unix:0 for them. Without specifying unix or the hostname, you will get the fastest trasport mechanism. While currently there are only two transport methods in the AIXwindows X server (Unix sockets and TCP sockets), many vendors are looking at using shared memory as a transport method. If you use :0 (or :0.0 or :1, etc.), then you should get the best performance regardless of the available transport methods. 3.) Is there a significant performance penalty incurred by using `hostname`:0 as DISPLAY? Yes! Using unix:0, you are using Unix sockets. These are much faster than their TCP socket counterparts. 1.50: How can I send mail to hosts that cannot be pinged? From: jupiter.sun.csd.unb.ca!dedourek (John DeDourek) AIX 3.2 as shipped is configured to only send mail to mail addresses which include a host name. Many organizations use a mail address whose "host name" part is not a host name (technically an MX name). To change the configuration of the AIX mailer, login as root. Then edit the file /etc/sendmail.cf to remove the comment marker ("# ") at the beginning of the line which reads: # OK MX Now rebuild the machine readable form of the configuration with sendmail -bz and finally restart signal sendmail to load the new configuration by one of the following: reboot or stopsrc -s sendmail startsrc -s sendmail or kill -1 `cat /etc/sendmail.pid` 1.51: How to setup dialup SLIP From: marvin@tornado.oche.de (Christian Bode) If you don't have problems with slattach you should have PTF bos.obj 3.2.0.0.U411505 installed. I assume that you did the right ifconfig commands to setup your slip-device (for example sl0). 1. Create a group called slip. 2. Create a user slip with smit like this: [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 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 ____________________________________________________________________________ 2.00: C/C++ Contrary to many people's belief, the C environment on the RS/6000 is not very special. The C compiler has quite a number of options that can be used to control how it works, which "dialect" of C it compiles, how it interprets certain language constructs, etc. InfoExplorer includes a Users' Guide and a Reference Manual. The compiler can be invoked with either xlc to invoke it in ANSI mode and cc to invoke it in RT (i.e. IBM 6150 with AIX 2) compatible mode. The default options for each mode are set in the /etc/xlc.cfg file, and you can actually add another stanza and create a link to the /bin/xlc executable. The file /usr/lpp/xlc/bin/README.xlc has information about the C compiler, and the file /usr/lpp/bos/bsdport contains useful information, in particular for users used to BSD. The file /etc/xlc.cfg also shows the symbol _IBMR2 that is predefined, and therefore can be used for #ifdef'ing RS/6000 specific code. 2.01: I cannot make alloca work A famous routine, in particular in GNU context, is the allocation routine alloca(). Alloca allocates memory in such a way that it is automatically free'd when the block is exited. Most implementations does this by adjusting the stack pointer. Since not all C environments can support it, its use is discouraged, but it is included in the xlc compiler. In order to make the compiler aware that you intend to use alloca, you must put the line #pragma alloca before any other statements in the C source module(s) where alloca is called. If you don't do this, xlc will not recognize alloca as anything special, and you will get errors during linking. For AIX 3.2, it may be easier to use the -ma flag. 2.02: How do I compile my BSD programs? The file /usr/lpp/bos/bsdport contains information on how to port programs written for BSD to AIX 3.1. The contents of this file can actually be very useful for others as well. A quick cc command for most "standard" BSD programs is: $ cc -D_BSD -D_BSD_INCLUDES -o [loadfile] [sourcefile.c] -lbsd If your software has system calls predefined with no prototype parameters, also use the -D_NO_PROTO flag. 2.03: Isn't the linker different from what I am used to? Yes. It is not at all like what you are used to: - 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 - The standard C library /lib/libc.a is linked shared, which means that the actual code is not linked into your program, but is loaded only once and linked dynamically during loading of your program. - The ld program actually calls the binder in /usr/lib/bind, and you can give ld special options to get details about the invocation of the binder. These are found on the ld man page or in InfoExplorer. - If your program normally links using a number of libraries (.a files), you can 'prelink' each of these into an object, which will make your final linking faster. E.g. do: $ 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 above. 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, e.g. 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. 2.04: How do I link my program with a non-shared /lib/libc.a? cc -o prog -bnoso -bI:/lib/syscalls.exp obj1.o obj2.o obj3.o will do that for a program consisting of the three objects obj1.o, etc. 2.05: How do I make my own shared library? To make your own shared object or library of shared objects, you should know that a shared object cannot have undefined symbols. Thus, if your code uses any externals from /lib/libc.a, the latter MUST be linked with your code to make a shared object. Mike Heath (mike@pencom.com) said it is possible to split code into more than one shared object when externals in one object refer to another one. You must be very good at import/export files. Perhaps he or someone can provide an example. Assume you have one file, sub1.c, containing a routine with no external references, and another one, sub2.c, calling stuff in /lib/libc.a. You will also need two export files, sub1.exp, sub2.exp. Read the example below together with the examples on the ld man page. ---- sub1.c ---------------------------------------------------------- int addint(int a, int b) { return a + b; } ---- sub2.c ---------------------------------------------------------- #include void printint(int a) { printf("The integer is: %d\n", a); } ---- sub1.exp ---------------------------------------------------------- #! addint ---- sub2.exp ---------------------------------------------------------- #! printint ---- usesub.c ---------------------------------------------------------- main() { printint( addint(5,8) ); } --------------------------------------------------------------- The following commands will build your libshr.a, and compile/link the program usesub to use it. Note that you need the ld option -lc for sub2shr.o since it calls printf from /lib/libc.a. $ cc -c sub1.c $ ld -o sub1shr.o sub1.o -bE:sub1.exp -bM:SRE -T512 -H512 $ cc -c sub2.c $ ld -o sub2shr.o sub2.o -bE:sub2.exp -bM:SRE -T512 -H512 -lc $ ar r libshr.a sub1shr.o sub2shr.o $ cc -o usesub usesub.c -L: libshr.a $ usesub The integer is: 13 $ 2.06: Linking my program fails with strange errors. Why? Very simple, the linker (actually called the binder), cannot get the memory it needs, either because your ulimits are too low or because you don't have sufficient paging space. Since the linker is quite different from normal Unix linkers and actually does much more than these, it also uses a lot of virtual memory. It is not unusual to need 10000 pages (of 4k) or more to execute a fairly complex linking. If you get 'BUMP error', either ulimits or paging is too low, if you get 'Binder killed by signal 9' your paging is too low. First, check your memory and data ulimits; in korn shell 'ulimit -a' will show all limits and 'ulimit -m 99999' and 'ulimit -d 99999' will increase the maximum memory and data respectively to some high values. If this was not your problem, you don't have enough paging space. If you will or can not increase your paging space, you could try this: - Do you duplicate libraries on the ld command line? That is never necessary. - Do more users link simultaneously? Try having only one linking going on at any time. - Do a partwise linking, i.e. you link some objects/libraries with the -r option to allow the temporary output to have unresolved references, then link with the rest of your objects/libraries. This can be split up as much as you want, and will make each step use less virtual memory. If you follow this scheme, only adding one object or archive at a time, you will actually emulate the behavior of other Unix linkers. If you decide to add more paging space, you should consider adding a new paging space on a second hard disk, as opposed to just increasing the existing one. Doing the latter could make you run out of free space on your first harddisk. It is more involved to shrink a paging space but easier to delete one. 2.07: What's with malloc()? malloc() uses a late allocation algorithm based on 4.3 BSD's malloc() for speed. This lets you allocate very large sparse memory spaces, since the pages are not actually allocated until they are touched for the first time. Unfortunately, it doesn't die gracefully in the face of loss of available memory. See the "Paging Space Overview" under InfoExplorer, and see the notes on the linker in this document for an example of an ungraceful death. If you want your program to get notified when running out of memory, you should handle the SIGDANGER signal. The default is to ignore it. SIGDANGER is sent to all processes when paging space gets low, and if paging space gets even lower, processes with the highest paging space usage are sent the SIGKILL signal. malloc() is substantially different in 3.2, allocating memory more tightly. If you have problems running re-compiled programs on 3.2, try running them with MALLOCTYPE=3.1. 2.08: Why does xlc complain about 'extern char *strcpy()' The header has a strcpy macro that expands strcpy(x,y) to __strcpy(x,y), and the latter is then used by the compiler to generate inline code for strcpy. Because of the macro, your extern declaration contains an invalid macro expansion. The real cure is to remove your extern declaration but adding -U__STR__ to your xlc will also do the trick. 2.09: Why do I get 'Parameter list cannot contain fewer ....' This is the same as above. 2.10: Why does xlc complain about '(sometype *)somepointer = something' Software that is developed using GNUC may have this construct. However, standard C does not permit casts to be lvalues, so you will need to change the cast and move it to the right side of the assignment. If you compile with 'cc', removing the cast completely will give you a warning, 'xlc' will give you an error (provided somepointer and something are of different types - but else, why would the cast be there in the first place?) 2.11: Some more common errors 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 above 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 above to an integer 0. 2.12: Can the compiler generate assembler code? The traditional -S option is not supported by the XLC compiler, and there is in fact no way to make the compiler generate machine readable assembler code. The option -qlist will generate a human readable one in the .lst file. 2.13: Curses Curses based applications should be linked with -lcurses and _not_ with -ltermlib. It has also been reported that some problems with curses are avoided if your application is compiled with -DNLS. Peter Jeffe also notes: >the escape sequences for cursor and function keys are *sometimes* >treated as several characters: eg. the getch() - call does not return >KEY_UP but 'ESC [ C.' You're correct in your analysis: this has to do with the timing of the escape sequence as it arrives from the net. There is an environment variable called ESCDELAY that can change the fudge factor used to decide when an escape is just an escape. The default value is 500; boosting this a bit should solve your problems. Further on the matter of curses, I've received the comments below concerning extended curses: From: Christopher Carlyle O'Callaghan 1) The sample program in User Interface Programming Concepts, page 7-13 is WRONG. Here is the correct use of panes and panels. (This is one of the IBM manuals that comes with the RS/6000) #include #include main() { PANE *A, *B, *C, *D, *E, *F, *G, *H; PANEL *P; initscr(); A = ecbpns (24, 79, NULL, NULL, 0, 2500, Pdivszp, Pbordry, NULL, NULL); D = ecbpns (24, 79, NULL, NULL, 0, 0, Pdivszf, Pbordry, NULL, NULL); E = ecbpns (24, 79, D, NULL, 0, 0, Pdivszf, Pbordry, NULL, NULL); B = ecbpns (24, 79, A, D, Pdivtyh, 3000, Pdivszp, Pbordry, NULL, NULL); F = ecbpns (24, 79, NULL, NULL, 0, 0, Pdivszf, Pbordry, NULL, NULL); G = ecbpns (24, 79, F, NULL, 0, 5000, Pdivszp, Pbordry, NULL, NULL); H = ecbpns (24, 79, G, NULL, 0, 3000, Pdivszp, Pbordry, NULL, NULL); C: = ecbpns (24, 79, B, F, Pdivtyh, 0, Pdivszf, Pbordry, NULL, NULL); P = ecbpls (24, 79, 0, 0, "MAIN PANEL", Pdivtyv, Pbordry, A); ecdvpl (P); ecdfpl (P, FALSE); ecshpl (P); ecrfpl (P); endwin(); } 2) DO NOT include and any other file together. You will get a bunch of redefined statements. 3) There is a CURSES and EXTENDED CURSES stuff. Use only one or the other. If the manual says that they're backwards compatible or some other indication that you can use CURSES routines with EXTENDED, don't believe it. To use CURSES you need to include and you can't (see above). 4) If you use -lcur and -lcurses in the same link command, you will get Memory fault (core dump) error... YOU CANNOT use both of them at the same time. -lcur is for extended curses, -lcurses is for regular curses. 5) When creating PANEs, when you supply a value (other than 0) for the 'ds' parameter and use Pdivszf value for the 'du' parameter, the 'ds' will be ignored (the sample program on page 7-13 in User Interface Programming Concepts is wrong.) For reasons as yet undetermined, Pdivszc doesn't seem to work (or at least I can't figure out how to use it.) 6) If you're running into bugs and can't figure out what is happening, try the following: include -qextchk -g in your compile line -qextchk will check to make sure you're passing the right number of parameters to the procedures -g will allow you to use the inline debugger on Unix/AIX. to use the debugger after you compiled it, type: dbx the command 'help' will give you all of the possible commands to use in the debugger... have fun... :) 7) Do not use 80 as the number of columns if you're gonna use the whole screen. The lower right corner will get erased. Use 79 instead. 8) If you create a panel, you must create at least 1 pane, otherwise you will get a Memory fault (core dump). 9) When creating a panel, if you don't have a border around it, any title you want will not show up. 10) to make the screen scroll down: wmove (win, 0, 0); winsertln (win) 11) delwin(win) DOESN'T WORK IN EXTENDED WINDOWS. Anyway, to make it appear as if a window is deleted, you need to do the following: for every window that you want to appear on the screen touchwin(win) wrefresh(win) you must make sure that you do it in the exact same order as you put them on the screen (i.e., if you called newwin with A, then C, then B, then you must do the loop with A, then C, then B, otherwise you won't get the same screen back). The best thing to do is to put them into an array and keep track of the last window index. 12) mvwin(win, line, col) implies that it is only used for viewports and subwindows... It can also be used for the actual windows themselves. 13) If you specify the attribute of a window using wcolorout(win), any subsequent calls to chgat(numchars, mode) or any of its relatives will not work. (or at least they get very picky...) 2.14: How do I speed up linking Please refer to sections 2.03 and 2.06 above. 2.15: What is deadbeef? When running the debugger (dbx), you may have wondered what the 'deadbeef' is you occasionally see in registers. Do note, that 0xdeadbeef is a hexadecimal number that also happens to be some kind of word (the RS/6000 was built in Texas!), and this hexadecimal number is simply put into unused registers at some time, probably during program startup. 2.16: How do I statically link in 3.2? xlc -bnso -bI:/lib/syscalls.exp -liconv -bnodelcsect _____________________________________________________________________________ 3.00: Fortran and other compilers This section covers Fortran, Pascal, Ada, etc. On Fortran, there seem to have been some problems with floating point handling, in particular floating exceptions. 3.01: I have problems mixing Fortran and C code, why? A few routines (the most famous one is getenv) exist in both the Fortran and the C library but with different parameters. You can therefore not have a mixed program that call getenv from both C and Fortran code. When linking a mixed program calling getenv from either, be sure to specify the correct library first on your command line. If your main program is Fortran and you call getenv from a C routine, you must therefore add -lc to the xlf command line for linking. If you want to call getenv from both C and Fortran code in a mixed program, you need to compile all the Fortran code with the -qextname option. This appends an underscore to all Fortran external names and ensures that no confusion occurs with default C libraries. Of course an underscore should be added by hand in the C code to the name of all routines which are called form Fortran and to all calls to Fortran routines. If you do that, Fortran will call something which appears to C as getenv_ and there will be no confusion. 3.02: How do I statically bind Fortran libraries and dynamically bind C libraries? From: amaranth@vela.acs.oakland.edu (Paul Amaranth) [ Editor's note: Part of this is also discussed above under the C compiler section, but I felt it was so valuable that I have left it all in. I've done some minor editing, mostly typographical. ] The linker and binder are rather versatile programs, but it is not always clear how to make them do what you want them to. In particular, there are times when you do not want to use shared libraries, but rather, staticly bind the required routines into your object. Or, you may need to use two version of the same routine (eg, Fortran & C). Here are the results of my recent experiments. I would like to thank Daniel Premer and Brad Hollowbush, my SE, for hints. Any mistakes or omissions are my own and I have tended to interchange the terms "linker" and "binder". These experiments were performed on AIX 3.1.2. Most of this should be applicable to later upgrades of 3.1. 1) I have some C programs, I want to bind in the runtime routines. How do I do this? [Mentioned in section 2.04 of this article as well, ed.] You can put the -bnso binder command on the link line. You should also include the -bI:/lib/syscalls.exp control argument: $ cc *.o -bnso -bI:/lib/syscalls.exp -o foo This will magically do everything you need. Note that this will bind _all_ required routines in. The -bI argument tells the linker that these entry points will be resolved dynamically at runtime (these are system calls). If you omit this you will get lots of unresolved reference messages. 2) I want to staticly bind in the Fortran runtime so a) my customers do not need to buy it and b) I don't have to worry about the runtime changing on a new release. Can I use the two binder arguments in 1) to do this? You should be able to do so, but, at least under 3002, if you do you will get a linker error referencing getenv. In addition, there are a number of potential conflicts between Fortran and C routines. The easy way just does not work. See the section on 2 stage linking for C and Fortran on how to do this. The getenv problem is a mess, see the section on Comments & Caveats for more. 3) I have a mixture of C and Fortran routines, how can I make sure that the C routines reference the C getenv, while the Fortran routines reference the Fortran getenv (which has different parameters and, if called mistakenly by a C routine results in a segmentation fault)? From Mike Heath (mike@pencom.com): Use -brename:symbol1,symbol2 when pre-linking the modules from one of the languages. It does not matter which one you choose. 4) I have C and Fortran routines. I want to bind in the xlf library, while letting the rest of the libraries be shared. How do I do this? You need to do a 2 stage link. In the first stage, you bind in the xlf library routines, creating an intermediate object file. The second stage resolves the remaining references to the shared libraries. This is a general technique that allows you to bind in specific system routines, while still referencing the standard shared libraries. Specifically, use this command to bind the xlf libraries to the Fortran objects: $ ld -bh:4 -T512 -H512 -o intermediat.o \ -bnso -bI:/lib/syscalls.exp -berok -lxlf -bexport:/usr/lib/libg.exp \ -lg -bexport: The argument -bexport: specifies a file with the name of all entry points that are to be visible outside the intermediate module. Put one entrypoint name on a line. The -bI:/lib/libg.exp line is required for proper functioning of the program. The -berok argument tells the binder that it is ok to have unresolved references, at least at this time (you would think -r would work here, but it doesn't seem to). The -bnso argument causes the required modules to be imported into the object. The -lxlf, of course, is the xlf library. Then, bind the intermediate object with the other shared libraries in the normal fashion: $ ld -bh:4 -T512 -H512 intermediate.o \ /lib/crt0.o -lm -lc Note the absence of -berok. After this link, all references should be resolved (unless you're doing a multistage link and making another intermediate). NOTE THE ORDER OF MODULES. This is extremely important if, for example, you had a subroutine named "load" in your Fortran stuff. Putting the C libraries before the intermediate module would make the C "load" the operable definition, rather than the Fortran version EVEN THOUGH THE FORTRAN MODULE HAS ALREADY BEEN THROUGH A LINK AND ALL REFERENCES TO THE SYMBOL ARE CONTAINED IN THE FORTRAN MODULE. This can be extremely difficult to find (trust me on this one :-) Is this a bug, a feature, or what? [As mentioned in section 2.03 of this article, it is a feature that you can replace individual objects in linked files, ed.] The result will be a slightly larger object than normal. (I say slightly because mine went up 5%, but then its a 2 MB object :-) Comments & Caveats: From the documentation the -r argument to the linker should do what -berok does. It does not. Very strange results come from using the -r argument. I have not been able to make -r work in a sensible manner (even for intermediate links which is what it is supposed to be for). Note from Mike Heath (mike@pencom.com): 'ld -r' is essentially shorthand for 'ld -berok -bnogc -bnoglink'. Certainly, using -berok with an export file (so garbage collection can be done) is preferable to ld -r, but the latter is easier. When binding an intermediate module, use an export file to define the entry points you want visible in the later link. If you don't do this, you'll get the dreaded "unresolved reference" error. Import files name entry points that will be dynamically resolved (and possibly where). If you are in doubt about what parameters or libraries to link, use the -v arg when linking and modify the exec call that shows up into an ld command. Some thought about the libraries will usually yield an idea of when to use what. If you don't know what an argument is for, leave it in. It's there for a purpose (even if you don't understand it). Watch the order of external definitions (ie, libraries) when more than one version of a routine may show up, eg "load". The first one defined on the ld command line is the winner. The getenv (and system and signal) problem is a problem that started out minor, got somewhat worse in 3003 and, eventually will be correctly fixed. Basically, you should extract the 3002 version of these three routines from xlf.a before doing the update and save them away, then link these routines in if you use these Fortran system services. 3.03: How do I check if a number is NaN? [ From: sdl@glasnost.austin.ibm.com (Stephen Linam) ] NaN is "Not a Number". It arises because the RISC System/6000 uses IEEE floating point arithmetic. To determine if a variable is a NaN you can make use of the property that a NaN does not compare equal to anything, including itself. Thus, for real variable X, use IF (X .NE. X) THEN ! this will be true if X is NaN Floating point operations which cause exceptions (such as an overflow) cause status bits to be set in the Floating Point Status and Control Register (FPSCR). There is a Fortran interface to query the FPSCR, and it is described in the XLF Fortran manuals -- I don't have the manuals right here, but look for FPGETS and FPSETS. The IBM manual "Risc System/6000 Hardware Technical Reference - General Information" (SA23-2643) describes what floating point exceptions can occur and which bits are set in the FPSCR as a result of those exceptions. 3.04: Some info sources on IEEE floating point 1. ANSI/IEEE STD 754-1985 (IEEE Standard for Binary Floating-Point Arithmetic) and ANSI/IEEE STD 854-1987 (IEEE Standard for Radix-Independent Floating-Point Arithmetic), both available from IEEE. 2. David Goldberg, "What Every Computer Scientist Should Know About Floating-Point Arithmetic", ACM Computing Surveys, Vol. 23, No. 1, March 1991, pp. 5-48. 4.00: GNU and Public Domain software GNU software comes from the Free Software Foundation and various other sources. A number of ftp sites archive them. Read the GNU license for rules on distributing their software. Lots of useful public domain software have been and continue to be ported to the RS/6000. See below for ftp or download information. 4.01: How do I find sources? [ From jik@GZA.COM (Jonathan Kamens). Ed. ] There is a newsgroup devoted to posting about how to get a certain source. One is strongly urged to follow the guidelines in the article How_to_find_sources(READ_THIS_BEFORE_POSTING), available via anonymous ftp from rtfm.mit.edu (18.70.0.224): /pub/usenet/comp.sources.wanted/H_t_f_s_(R_T_B_P) Note: You should try to use hostnames rather than ip addresses since they are much less likely to change. Also available from mail-server@rtfm.mit.edu by sending a mail message containing: send usenet/comp.sources.wanted/H_t_f_s_(R_T_B_P) Send a message containing "help" to get general information about the mail server. If you don't find what you were looking for by following these guidelines, you can post a message to comp.sources.wanted. 4.02: Are there any ftp sites? Below are some ftp sites that are supposed to have RS/6000 specific software. I haven't verified all the entries. I dropped cs.utk.edu (128.169.201.1) and merit.edu (35.1.1.42) because I cannot find any AIX material. US 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 The first one above is dedicated to software running on AIX. It might not always be the latest versions of the software, but it has always 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 US sites originally. If you know of other sites with AIX archives please let me know so I can include them here. 4.03: General hints In general, curses based applications should be linked with -lcurses and _not_ with -ltermlib. It has also been reported that compiling with -DNLS helps curses based programs. Note that the RS/6000 has two install programs, one with System V flavor in the default PATH (/etc/install with links from /usr/bin and /usr/usg), and one with BSD behavior in /usr/ucb/install. 4.04: GNU Emacs Version 18.57 of GNU Emacs started to have RS/6000 support. Use s-aix3-2.h for AIX 3.2. Emacs is going through rapid changes recently. Current release is 19.x. Emacs will core-dump if it is stripped, so don't strip when you install it. You can edit a copy of the Makefile in src replacing all 'install -s' with /usr/ucb/install. 4.05: gcc/gdb GNU C version 2.0 and later supports the RS/6000, and compiles straight out of the box. You may, however, experience that compiling it requires large amounts of paging space. Compiling gcc and gdb requires a patch to the 'as' assembler. Call IBM software support and request patch for apar IX26107 (U409205). gcc has undergone many changes lately and the current version is 2.4.x. gdb is at 4.8. If your machine crashed when trying to run gdb 4.7, call software support and request ptf U412815. 4.06: GNU Ghostscript The PostScript interpreter GNU Ghostscript Version 2.3 and later supports the RS/6000 and can be found on various ftp sites. Current version is 2.5.2. 4.07: TeX TeX can be retrieved via ftp from ftp.uni-stuttgart.de. Be sure to use a recent C compiler (01.02.0000.0013) and you can compile with optimization. 4.08: perl Current version is 4.035 and compiling with cc should give no problems. If you use bsdcc, do not use perl's builtin malloc(), edit config.H to '#define HAS_SYMLINK', and you should be on your way. Bill Wohler tells me that perl will run without editing config.H and with cc as well. So just say no to use perl's malloc(). Doug Sewell adds: In addition to not using the perl-provided malloc, when asked if you want to edit config.sh, change 'cppstdin' from the wrapper-program to '/lib/cpp'. The perl wrapper name is compiled into perl, and requires that you keep that file in the source directory, even if you blow away the rest of the source. /lib/cpp will do the job by itself. I suspect this will be fixed in perl 4.0pl11 Configure script. Also, beware if you have gdbm installed per the instructions in the FAQ. Gdbm is compiled with bsdcc; perl (as I installed it, anyway) was built with cc, so I used the IBM-provided ndbm routines. 4.09: X-Windows IBM has two releases of 3.2.3. The base version has X11R4 and Motif 1.1 and the extended version has X11R5 as AIXwindows 1.2.3. Those of you on 3.1 might want to read the following. Some people from IBM have released patches for the X11R4 distribution tape available via anonymous FTP from export.lcs.mit.edu. Note that as with the RT, there is no X11R4 server to build, just the libraries. From: Frederick Staats In mit/config/ibm.cf Updated OSName (AIX 3.1.6) In mit/config/site.def Changed ProjectRoot /usr/local/X11R5 Added ManSuffix (to change suffix from n to 1) Added InstallXdmConfig YES and InstallXinitConfig YES Added HasXdmAuth YES (Copied mit/lib/Xdmcp/Wraphelp.c to source tree) Added InstallFSConfig YES In mit nohup make BOOTSTRAPCFLAGS="-Daix" World & nohup make install & nohup make install.man & Please note that there are known bugs in Xibm server of the X11R5 release that prevent "xdm" from being usable. A simple patch (that I'm not free to redistribute) should be out very soon through the regular contrib channels. Also note, that some files in mit/extensions/lib/PEX/c_binding are very large and are told to require at least 150 Mb paging space to compile. From: pierce@claven.cambridge.ibm.com (Andrew Pierce) The following bugs have been reported with the R5 server and are fixed (hopefully!), and the fixes have been sent to MIT for inclusion in the first patch set: - BackingStore does not seem to work (twm menus blank and xman pulldown menus only display once). - Problem in keyclick restoration/bell - Problem with option parsing (-bs does not turn off backing store). - Problem with setting non-blocking I/O on X Connections (resizing xcalc wedges the server). - xdm core dumps. There is also a problem in initializing the display adapter when the R5 server is brought up from a poweroff condition on the RISC/6000. We are still investigating this problem. A temporary workaround is to run the AIX product server first, which seems to do the right thing in initializing the adapter, then run the R5 server. As for whether the OSF/Motif window manager will work with the R5 server, I don't know of any reasons why it shouldn't, and I've run it now and again, although tvtwm is my preferred wm. From: cary@jove.Colorado.EDU (John R. Cary) There are (at least) three problems. 1) The fonts as built with the IBM (Greening) patches of X11R4 do not work with the AIX3.1.5 server because (according to mleisher@NMSU.Edu) they likely have the wrong byte order. 2) The ibm fonts that come with AIX3.1.5 must be converted to .pcf fonts to work with the X11R5 server. 3) Info always looks for its fonts (in /usr/lpp/info/X11fonts) regardless of which server you are using. So if you use the X11R5 server, info loads the AIX3.1x .snf fonts, which do not work with the X11R5 server. Using the X11R5 server means that you must fix problems 2 and 3. My fix of 2: I first got snftobdf from the X11 contrib directory on export.lcs.mit.edu and built it. I then made a directory: mkdir /usr/local/X11R5/lib/X11/fonts/ibm which I added to my font path with xset in my .xinitrc file. Then I constructed the chosen .pcf fonts one at a time: cd /usr/lib/X11/fonts snftobdf Rom10.snf | bdftopcf >/usr/local/X11R5/lib/X11/fonts/ibm/Rom10.pcf I actually did this with this script: #!/bin/ksh # A script to convert desired AIX fonts to .pcf fonts for X11R5 for arg in 6x10 Bld14 Rom14 Rom6 6x12 Bld17 Rom16 Rom7 vtbold 6x13 Erg 14 Rom17 Rom8 vtdhbot 8x13 Itl14 Rom22 cursor vtdhtop 8x13B Rom10 Rom28 fixed vtdwidth 9x15 Rom11 Rom29 Vtsingle do echo "snftobdf $arg.snf | bdftopcf >/usr/local/X11R5/lib/X11/fonts/ibm/$arg.pcf" snftobdf $arg.snf | bdftopcf >/usr/local/X11R5/lib/X11/fonts/ibm/$arg.pcf done My fix of 3: was simply to rename the info fonts directory so that info could not find it and load it. Another fix (I am told) is to set one's font path with /usr/lpp/info/X11fonts last so that another fonts is loaded first. This did not work for me, perhaps because of differences in my fonts.alias file. If you want to continue using the AIX3.1x server and you want to use the X11R4 fonts, you must convert these fonts to the correct bit order. I did not do this, and so DO NOT KNOW the correct procedure. I imagine that once the correct bit order is determined, one can use snftobdf to convert fonts back to bdf format then bdftosnf with correct AIX3.1 bit order to get things correct with the aix3.1x server. 4.10: bash Bash is ported and has some patches on prep.ai.mit.edu. The current version is 1.12 and seems to work fine. 4.11: Elm A very nice replacement for mail. Elm should be pretty straightforward, the only thing to remember is to link with -lcurses as the only curses/termlib library. You may also run into the problem listed under point 2.13 above. 4.12: Oberon 2.2 From: afx@muc.ibm.de (Andreas Siegert) Oberon is Wirth's follow on to Modula-2, but is not compatible. A free version of Modula-3 is available from DEC/Olivetti at gatekeeper.dec.com. This is not a Modula-2 replacement but a new language. There are currently two M2 compilers for the 6000 that I know of. One from Edinburgh Portable Compilers, +44 31 225 6262 (UK) and the other from Gardens Point compiler +41 65 520311 (Switzerland). Oberon can be obtained via anonymous ftp from neptune.inf.ethz.ch (129.132.101.33) under the directory Oberon/RS6000 or gatekeeper.dec.com (16.1.0.2). 4.13: Kermit Get it from watsun.cc.columbia.edu (128.59.39.2) in kermit/bin/cku188.tar.Z. Uncompress, untar, and "make rs6000", and it works. 4.14: Gnu dbm From: doug@cc.ysu.edu (Doug Sewell) Here's the fixes for RS/6000's: apply this to testgdbm.c: 158c158 < char opt; --- > int opt; 166c166 < while ((opt = getopt (argc, argv, "rn")) != -1) --- > while ((opt = getopt (argc, argv, "rn")) != EOF) Apply this to systems.h: 111a112,114 > #ifdef RS6000 > #pragma alloca > #else 112a116 > #endif To compile, edit the Makefile. Set CC to bsdcc (see /usr/lpp/bos/bsdport if you don't have 'bsdcc' on your system) and set CFLAGS to -DRS6000 and whatever options (-g, -O) you prefer. Don't define SYSV. 4.15: tcsh From: cordes@athos.cs.ua.edu (David Cordes) tcsh is available from tesla.ee.cornell.edu (pub/tcsh-6.00 directory) Compiles with no problems. You must edit /etc/security/login.cfg to permit users to change to this shell (chsh), adding the path where the shell is installed (in my case, /usr/local/bin/tcsh). 4.16: Kyoto Common Lisp The sources are available from cli.com. The kcl package is the needed base; also retrieve the latest akcl distribution. akcl provides a front-end that "ports" the original kcl to a number of different platforms. The port to the 6000s worked with no problems. However, you must be "root" for the make to work properly with some memory protection routines. 4.17: Tcl/Tk Current versions: Tcl, 6.7; Tk, 3.2. Available from sprite.berkeley.edu. I seem to be unable to connect to this site recently. 4.18: Expect From: Doug Sewell To build the command-interpreter version, you must have the tcl library built successfully. The expect library doesn't require tcl. Note: Expect and its library are are built with bsdcc, so applications using the library probably also need to be developed with bsdcc. I ftp'd expect from ftp.cme.nist.gov. You need to change several lines in the makefile. First you need to customize source and target directories and files: # TCLHDIR = /usr/include TCLLIB = -ltcl MANDIR = /usr/man/manl (local man-pages) MANEXT = l BINDIR = /u/local/bin LIBDIR = /usr/lib HDIR = /usr/include ... Next set the compiler, switches, and configuration options: # CC = bsdcc CFLAGS = -O ... PTY_TYPE = bsd ... INTERACT_TYPE = select ... Then you need to make these changes about line 90 or so: comment out CFLAGS = $(CLFLAGS) un-comment these lines: CFLAGS = $(CLFLAGS) $(CPPFLAGS) LFLAGS = ($CLFLAGS) Then run 'make'. You can't run some of the examples without modification (host name, etc). I don't remember if I ran all of them or not, but I ran enough that I was satisfied it worked. 4.19: Public domain software on CD From: mbeckman@mbeckman.mbeckman.com (Mel Beckman) The Prime Time Freeware CD collection is a package of two CD's and docs containing over THREE GIGABYTES of compressed Unix shareware. It costs $69 from Prime Time Freeware, 415-112 N. Mary Ave., Suite 50, Sunnyvalek, CA 94086. Phone 408-738-4832 voice, 408-738-2050 fax. No internet orders as far as I can tell. I've extracted and compiled a number of the packages, and all have worked flawlessly so far on my 220. Everything from programming languages to 3D solid modeling is in this bonanza! Ed: The O'Reilly book, Power Unix Tools, also contains a CD-ROM with lots of useful programs compiled for the RS/6000, among other platforms. ______________________________________________________________________________ 5.00: Third party products [ Editor's note: Entries in this section are edited to prevent from looking like advertising. Prices given may be obsolete. Companies mentioned are for reference only and are not endorsed in any fashion. ] 5.01: IBM list of third party products From: marc@ibmpa.awdpa.ibm.com (Marc Pawliger) Marc Pawliger post an extensive list periodically to this newsgroup about various third party hardware products for the RS/6000. This list can also be ftp'd from ibminet.awdpa.ibm.com. 5.02: Disk/Tape/SCSI From: anonymous - Most SCSI disk drives work (IBM resells Maxtor, tested Wren 6&7 myself); use osdisk when configuring (other SCSI disk). - Exabyte: Unfortunately only the ones IBM sells are working. A few other tape drives will work; use ostape when configuring (other SCSI tape). - STK 3480 "Summit": Works with Microcode Version 5.2b From: bell@hops.larc.nasa.gov (John Bell) In summary, third party tape drives work fine with the RS/6000 unless you want to boot from them. This is because IBM drives have 'extended tape marks', which IBM claims are needed because the standard marks between files stored on the 8mm tape are unreliable. These extended marks are used when building boot tapes, so when the RS/6000 boots, it searches for an IBM tape drive and refuses to boot without it. From: amelcuk@gibbs.clarku.edu (Andrew Mel'cuk) The IBM DAT is cheap and works. If you get all the patches beforehand (U407435, U410140) and remember to buy special "Media Recognition System" tapes (Maxell, available from APS 800.443.4461 or IBM #21F8758) the drive can even be a pleasure to use. You can also flip a DIP switch on the drive to be able to use any computer grade DAT tapes (read the hardware service manual). Other DAT drives also work. I have tried the Archive Python (works) and experimented extensively with the Archive TurboDAT. The TurboDAT is a very fast compression unit, is not finicky with tapes and doesn't require the many patches that the IBM 7206 does. Works fine with the base AIX 3.2 'ost' driver. 5.03: Memory I got a flyer from Nordisk Computer Services (Portland 503-598-0111, Seattle 206-242-7777). Here's some sample prices: 16 MB Upgrade Kit $ 990 32 MB Upgrade Kit $1,700 64 MB Upgrade Kit $3,300 Note that with the exception of the Model 320s, you need to add memory in pairs. 5.04: Others From: anonymous IBM RISC System/6000 Interface Products National Instruments Corporation markets a family of instrumentation interface products for the IBM RISC System/6000 workstation family. The interface family consists of three products that give the RISC System/6000 connectivity to the standards of VMEbus, VXIbus and GPIB. For more information, contact National Instruments Corporation, 512-794-0100 or 1-800-433-3488. 5.05: C++ compilers Several C++ compilers are available. Glockenspiel and Greenhills were amongst the first vendors. I received e-mail that Glockenspiel may now be part of Computer Associates. xlC++ is available from IBM. For gcc enthusiats, there is g++. Comeau Computing (718-945-0009) offers Comeau C++ 3.0 with Templates. ______________________________________________________________________________ 6.00: Miscellaneous other stuff 6.01: Can I get support by email? AIXServ is a service tool that allows users connected to the internet and usenet to report problems using unix mail. AIXServ is available at no charge, to request a copy of this package send a note with the subject of "package" to one of the following E-Mail addresses: Internet: aixbugs%aixserv@uunet.UU.NET Usenet: uunet.UU.NET!aixserv!aixbugs aixbugs@austin.ibm.com (transactions request) services@austin.ibm.com (administrivia) aasc@austin.ibm.com (test cases under 100KB) The package will be mailed electronically and will contain instructions for using AIXServ. Using AIXServ, customers have the ability to 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. Thomas Braunbeck reported that German customers with ESS (extended software service) contracts can get support by email too. They can obtain information by sending mail with Subject: help to aixcall@aixserv.mainz.ibm.de. Various flavors of service offerings are available. Contact your IBM rep for details. 6.02: List of useful faxes You can get some useful info from these 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 6.03: List of 3.2 ptfs A list of the latest ptfs for 3.2 is available for ftp at ibminet.awdpa.ibm.com. 6.04: Some RS232 hints From: graeme@ccu1.aukuni.ac.nz, sactoh0.SAC.CA.US!jak Q: How do you connect a terminal to the RS232 tty ports when not using the standard IBM cable & terminal transposer? A: 1- Connect pins 2->3, 3->2, 7->7 on the DB25's 2- On the computer side, most of the time cross 6->20 (DSR, DTR). Some equipment may require connecting 6, 8, and 20 (DSR, DCD, DTR). Also, pin 1 (FG) should be a bare metal wire and the cable should be shielded with a connection all the way through. Most people don't run pin 1 because pins 1 & 7 (SG) are jumpered on many equipment. When booting from diskettes, the port speed is always 9600 baud. If you use SMIT to set a higher speed (38400 is nice) for normal use, remember to reset your terminal before booting. Q: How do you connect a printer to the RS232 tty ports A: 1- Connect pins 2->3, 3->2, 7->7 on the DB25's 2- On the computer side, loop pins 4->5 (CTS & RTS) 6.05: VT100 key bindings for aixterm From: haedener@iac.unibe.ch (Konrad Haedener) Add this to your .Xdefaults file and start your VAX session with 'aixterm -v -name vt100 -e telnet MYVAXHOST' ----- 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: F1: string(0x1b) string("OP") \n\ F2: string(0x1b) string("OQ") \n\ F3: string(0x1b) string("OR") \n\ F4: string(0x1b) string("OS") \n\ KP_0: string(0x1b) string("Op") \n\ KP_1: string(0x1b) string("Oq") \n\ KP_2: string(0x1b) string("Or") \n\ KP_3: string(0x1b) string("Os") \n\ KP_4: string(0x1b) string("Ot") \n\ KP_5: string(0x1b) string("Ou") \n\ KP_6: string(0x1b) string("Ov") \n\ KP_7: string(0x1b) string("Ow") \n\ KP_8: string(0x1b) string("Ox") \n\ KP_9: string(0x1b) string("Oy") \n\ KP_Divide: string(0x1b) string("OQ") \n\ KP_Multiply: string(0x1b) string("OR") \n\ KP_Subtract: string(0x1b) string("OS") \n\ KP_Add: string(0x1b) string("Om") \n\ KP_Enter: string(0x1b) string("OM") \n\ KP_Decimal: string(0x1b) string("On") \n\ Next: string(0x1b) string("Ol") \n\ Left: string(0x1b) string("OD") \n\ Up: string(0x1b) string("OA") \n\ Right: string(0x1b) string("OC") \n\ BackSpace : string(0x7f) \n\ Down: string(0x1b) string("OB") You should also add XENVIRONMENT=$HOME/.Xdefaults export XENVIRONMENT to your .profile. 6.06 What publications are available for AIX and RS/6000? The following are free just for the asking: 1. RS/Magazine P.O. Box 3272 Lowell, MA 01853-9876 email: aknowles@expert.com (Anne Knowles, editor) 2. AIXpert IBM Corporation Mail Stop 36 472 Wheelers Farms Road Milford, CT 06460 FAX: (203) 783-7669 3. RiSc World P.O. Box 399 Cedar Park, TX 78613 FAX: (512) 331-3900 Usenet: {cs.utexas.edu,execu,texbell}!pcinews!rsworld These manuals should be available from your friendly neighborhood 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 6.07: Some acronyms BOS - Basic Operating System ODM - Object Database Manager LPP - Licensed Program Product SMIT - System Management Interface Tool PTF - Program Temporary Fix APAR - authorized program analysis report PRPQ - programming request for price quotation DCR - design change request _____________________________________________________________________________ 7.00: How do I get this by mailserver or ftp? Since the articles are crossposted to news.answers, any archive carrying that newsgroup will also have these articles. In particular, try rtfm.mit.edu in the directory pub/usenet/news.answers. This FAQ is archived as "aix-faq/faq/part[1-3]". 7.01: Contributors The following persons have contributed to this list. If you want to contribute anonymously, just let me know - but do tell me who you are. I apologise if I missed out anyone. Thank you all, this would definitely not be the same without _your_ input. Rudy Chukran Christopher Carlyle O'Callaghan Poul-Henning Kamp Richard Wendland Ge van Geldorp Chris Jacobsen Peter Jeffe Jean-Francois Panisset John Cary Vijay Debbad Dick Karpinski Konrad Haedener Doug Sewell David Cordes Graeme Moffat Andrew Pierce Stephen Linam Jerome Park Konrad Haedener Steve Roseman John Burton Thierry Forveille Joubert Berger Minh Tran-Le Paul Amaranth Mark Whetzel Daniel Packman Ken Bowman Cary E. Burnette Christophe Wolfhugel Leonard B. Tropiano Bill Wohler James Salter Witold Jan Owoc Marc Kwiatkowski Ronald S. Woan Mijan Huq Herbert van den Bergh Michael Stefanik John F. Haugh Ed Kubaitis Jaime Vazquez Bjorn Engsig Frank Kraemer Andreas Siegert Thomas Braunbeck _____________________________________________________________________________ Epilogue If you have any comments about this list, please mail them to me, as I cannot guarantee to pick up posted changes. All input should be emailed to me at basto@cactus.org on the Internet. You can also try using cs.utexas.edu!mavrick!luis. I work for Computer Sciences Corp. and I am doing this on my own time. Please do not ask me questions that should be asked to IBM. If you have any problems, please ask IBM or post your questions to this newsgroup. I might respond to the latter. Opinions expressed here have nothing to do with either IBM or CSC. All trademarks are the property of their respective owners. -- Luis Basto Computer Sciences Corporation Internet: basto@cactus.org Usenet: cs.utexas.edu!mavrick!luis