1.100: 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 can also do 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 build up commands with all required options to perform the functions requested and execute them. 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.101: How do I turn off the "running man" in smit?
Use smitty, the standard curses version or add this line to your .kshrc file: alias smit="smit -C"
1.102: How do I import an /etc/passwd or /etc/group file from another box?
Make sure that you run usrck, pwdck (/etc/passwd), and grpck (/etc/group) to let AIX work its password/group magic.
1.103: 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" #endifAnd 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 <sys/types.h> #include <utmp.h> #include <fcntl.h> 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.104: How to fsck the root filesystem
You can run fsck either in maintenance mode or on mounted filesystems. Try this: 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.105: 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.106: How do I shrink /usr?
From: mike@bria.UUCP (Michael Stefanik) and Richard HastingFOR AIX 3.1 ----------- 1) Make a backup of /usr find /usr -print | backup -ivf /dev/rmt0 (or appropriate device) 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 ----------- 0) Experiances posted to comp.unix.aix lead me to suggest that many administrators find the following piece of information useful after completing this procedure. I thought some of you might like to read it BEFORE getting yourself into this predicament. Call 1-800-IBM-4FAX and request document 2503 dated 1/26/94. Title is "How to recover if all files are owned by root after restoration from a mksysb tape". 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 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 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" (reportedly now called "BOS Installation from a System Backup") using the diskettes and tape that you created in the previous steps. DO NOT select the option "Reinstall AIX with Current System Settings". Instead use "Install AIX with Current System Settings" for the logical volume size changes to take affect. 11) When the installation is complete, you may then import 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.107: 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. This means that AIX 3.2.5 an versions preceeding it are limited to 2Gb filesystems. This obviously does not include "non-filesystems"It was previously noted here that AIX would support >2Gb filesystems after realease 3.2.5. I have since heard otherwise. I will update this section again after I hear for certain (like maybe when I get AIX 4.0.0 :)
1.108: How do I see/change system parameters like number of processes per user?
You can use SMIT as described below or simply use lsattr/chdev. 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 but not others. If you want to use smit, do as follows: 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.109: 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 rootvg7) 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 v chps -a n /dev/paging00 10) shutdown, reboot, remove paging00 using the command: rmps paging00 You can check your paging space with `lsps -a`
1.110: The swapper seems to use enormous amounts 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.111: How much paging space do I need?
See answer 2 in question 1.300.
1.112: 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 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 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 a formatted floppy into the drive. 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 /mnt. Mount the filesystem: mount -r -V jfs /dev/fd0 /your_mount_point 7. To unmount the filesystem: 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 may still 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.113: How do I remove a committed lpp?
From: drb@chmeds.ac.nz (Ross Boswell) This seems to be a common problem. The following script for 3.2 only is >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!#!/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.114: How can I recover space after installing updates?
From: Milt CloudNote: If you are a /usr server, do not use this because the files mentioned below are needed by /usr clients and cannot be deleted. Installp creates numerous files in /usr to clean up after failed/rejected installs and also for de-installing uncommitted lpps. Once you have COMMITted packages you can remove these files safely. Depending on your installation activity the numbers can be significant: hundreds-to-thousands of files, megabytes of data. Files eligible for removal are associated with each "product" you have installed; the largest collection being due to bos. After COMMITting bos lpps, you may safely remove all files of the form: /usr/lpp/bos/deinstl* /usr/lpp/bos/inst_U4* /usr/lpp/bosadt/deinstl* and /usr/lpp/bosadt/inst_U4* You may repeat this for all additional COMMITted products (e.g., bostext1, bosnet, xlc) you have on your system. This problem of lingering install files is a known defect in installp. If you have installed PTF U411711 (or any superseder of it: U412397, U413366, U413425) the deadwood in /usr will not be quite as prevalent. No single PTF currently available completely corrects this problem. On my own 320, the following freed up 12.4M in /usr: # rm -R /usr/lpp/bos/deinstl* # rm -R /usr/lpp/bos/inst_U4*
1.115: 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.116: How can I log information about ftp accesses to a file?
From: elr@trintex.uucp (Ed Ravin) and map@hal.maths.monash.edu.au (Michael Page) 1) In /etc/syslog.conf, add the line: daemon.debug /tmp/daemon.log 2) # touch /tmp/daemon.log # refresh -s syslogd 3) Modify your inetd.conf so that ftpd is called with the "-l" flag. You may also want the "-d" flag. This can be done with 'smit inetdconf'. All the syslog messages from various system daemons should now appear in the file "/tmp/daemon.log".