AIX Tips & tricks

SOME HANDY TIPS FROM  http://unixadminguide.blogspot.com/2013/12/aix-tips-tricks.html

AIX Tips & tricks 

Below are few of the AIX commands which will be useful for AIX admins.

1. To list machines configured in a NIM Server,
# lsnim -c machines

2. To list networks configured in a NIM Server,
# lsnim -c networks

3. To reset a machine (return to ready state)
# nim -Fo reset MachineName

4. To list core file settings for a user,
# lscore user1

The output will look like:
compression: on
path specification: default
corefile location: default
naming specification: off

5. To list the default settings for the system,

# lscore -d

The output will look like:
compression: off
path specification: on
corefile location: /corefiles
naming specification: off

6. To make any process run by root dump compressed core files and restore the location of the core files to the system default,

# chcore -c on -p default root
Note: If no default is specified, cores will dump in the current directory.

7. To enable a default core path for the system, type:

# chcore -p on -l /corefiles -d

8. To scan logical volume lv01, report the status of each partition, and have every block of each partition read to determine whether it is capableof performing I/O operations, type:

# mirscan -l lv01

9. To do the above operation in a PV,

# mirscan -p hdisk1

10. To do the above operation in a VG,

# mirscan -v vg01

11. To determine if the 64-bit kernel extension is loaded,

# genkex grep 64

12. To list all JFS file systems,

# lsjfs

13. To list all JFS2 file systems

# lsjfs2

14. To mirror a terminal1 on terminal2
a. Open terminal 1 and find the pts value (ps -ef grep pts)

b. Open terminal 2 and enter ‘portmir -t pts/1’
c. Now you will see commands and outputs from terminal 1 in terminal 2.
This is basically monitor a terminal.
d. Say “portmir -o” to end the mirroring after the use

15. To identify the current run level,

# cat /etc/.init.state

16. To list the available CD ROM drives,

# lsdev -Cc cdrom

17. To find out the speed of your network adapter,

# entstat -d ent0 grep “Media Speed”

18. To find out when your system was last installed/updated

# lslpp -f bos.rte

19. To list the status of your tape drive,

# tctl -f /dev/rmt0 status

20. How to setup anonymous ftp in AIX

Run the below script to setup anon ftp,
# /usr/lpp/tcpip/samples/anon.ftp

21. If telnet takes more time to produce a prompt, do the below checks

a. do nslookup of the client ip from the aix serverb.
b. Check the nameservers in /etc/resolv.confc.
c. Check the ‘hosts’ entry in /etc/netsvc.conf or NSORDER variable

This issue might be due to the DNS configuration issue. Pointing to a good nameserver should solve the problem.

22. How to shutdown the system to maintenance mode ?

# shutdown -Fm

23. How to log ftp accesses to a file

a. Add the below line in /etc/syslog.confdaemon.debug /tmp/daemon.log
b. # touch /tmp/daemon.log
c. # refresh syslogd
d. Modify your inetd.conf so that ftpd is called with the “-l” flag.

24. How to find a file name from inode number ?

# ncheck -i xxxx /mountpoint
where xxxx -> inode number of the file

25. How to redirect the system console to a file or tty temporarily

# swcons /tmp/console.out

or

# swcons /dev/tty5

26. How to recreate a deleted /dev/null file ?

# /bin/mknod /dev/null c 2 2

27. How to add commands that should get executed during every system shutdown ?

Add them to /etc/rc.shutdown

28. How to reduce the size or do cleanup of /var/adm/wtmp ?

# > /var/adm/wtmp

29. How to find out the fileset a file belongs to ?

# which_fileset command_name

30. In which file, the mapping of file Vs fileset stored ?

# /usr/lpp/bos/AIX_file_list

31. How to set maximum logins for a user in a system ?

Change the value of “maxlogins” under “usw” stanza in /etc/security/login.cfg

32. How to change the initial message that prints while logging in ?

Change the value of “herald” in /etc/security/login.cfg

33. How to set the # of seconds the user is given to enter their password ?

Change the value of “logintimeout” under “usw” stanza in /etc/security/login.cfg

Technology Magazine Post: IBM AIX EXTENDING MIRRORING SYNCHRONIZING ROOTVG

From:

Technology Magazine

http://www.techmagazinez.com/2013/10/ibm-aix-extending-mirroring.html?spref=fb

IBM AIX : Extending Mirroring Synchronizing ROOTVG

 Usually we get an old_rootvg or altinst_rootvg volume group  after alt_disk backup, upgrade or migration. On this tutorial we will  detail the steps of removing altinst_rootvg , then extending rootvg  and Mirror rootvg with background synchronization.

Let’s  See

Step 1: List the PV with command lspv as below to see which PV hold the old_rootvg / altinst_rootvg  VG . On this example, you can see the altinst_rootvg on hdisk6
removing altinst_rootvg
Step 2:Now let remove  altinst_rootvg using alt_disk_install command with -X flag as below.
After removing altinst_rootvg
Step 3 : After removing altinst_rootvg  list again the PVs again now the hdisk6 become None.
Cleaning up AIX ALTINST
Step 4: Extending rootvg to include hdisk6 using extendvg( -f for force ) command as below and list PVs to verify  now it is part of rootvg. Now we can see hdisk6 is assigned to rootvg.
Cleaning up AIX ALTINST
Cleaning up AIX ALTINST
Step 5 : Now Mirror and Synchronized the rootvg VG using mirrorvg command with -S flag , which will run synchronization in background.
a) Before Mirroring LPs and PPs number is same means it is not mirrored yet.
Cleaning up AIX ALTINST
b) Mirroring using “mirrorvg –S rootvg .
Cleaning up AIX ALTINST
From the man page of mirrorvg
-S Background Sync Returns the mirrorvg command immediately and starts a background syncvg of the volume group. With this option, it is not obvious when the mirrors have completely finished their synchronization. owever, as portions of the mirrors become synchronized, they are immediately used by the operating system in mirror usage.
c) After Mirroring: It might take several minutes to sync LVs as you can see in the below lots of LVs are still in stale state
Cleaning up AIX ALTINST
d) After Full Sync The Out Put will be like below
Cleaning up AIX ALTINST
Step 6 : Re Create the boot image on both rootvg’s PV hdisk6 and hdisk7 and include in boot list.
bootlist -o -m normal
# output: hdisk7 blv=hd5

bosboot -ad hdisk7
# output: bosboot: Boot image is 22698 512 byte blocks.
bosboot -ad hdisk6
# output: bosboot: Boot image is 22698 512 byte blocks

bootlist -o -m normal   hdisk7 blv=hd5  hdisk6 blv=hd5
# output: hdisk7 blv=hd5
# output: hdisk6 blv=hd5

FLRT Frequently Asked Question

Abstract: Where can one find the Fix Level Recommendation Tool for administrators of IBM Power Systems?

The Fix Level Recommendation Tool (FLRT) provides minimum recommended fix level information on key components of IBM Power Systems running the AIX and IBM i operating systems. FLRT can be useful for those who are planning to upgrade key components or for those wishing to verify the current health of a system. 

Fix Level Recommendation Tool: http://www14.software.ibm.com/webapp/set2/flrt/home

TIP: Update_All in AIX v5.3 v6.1 v7.1

http://www-01.ibm.com/support/docview.wss?uid=isg3T1010755

 

Question

What is the recommended process for upgrading to a new Technology Level or Service Pack in AIX ?

Answer

— Updating to a New Technology Level or Service Pack —
Update_All in 5.3, 6.1, and AIX 7
This document describes the recommended preparation and process when considering updating your system to a new technology level or adding a service pack to an existing technology level. In all we will review some key words and terminology, run through recommended pre-checks, discuss the update_all process using both SMIT and command line, and finally post-checks & FAQ.

Updating AIX v5.3 v6.1 v7.1 to a new Technology Level or Service Pack.pdf

 

TIP: Bug in AIX, Systems Director Common Agent (cas agent) ; root files up with bogus /dev file /dev/null 2>&1

================================================================

If you have root filling up and see a bogus file in /dev:

-rw-r–r–    1 root     system         861 Sep 27 19:14 null 2>&1

 

Then you are having the following issue with the Systems Director Common Agent (cas agent).  reference:

Director Agent 6.2.1 on AIX Might Fill Up / Filesystem

http://www-304.ibm.com/support/docview.wss?uid=nas74d33539b559cc0308625792900533a8f

 

Also, here’s good write up on how to check why root file system is full:

/ (root) overflow

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.baseadmn/doc/baseadmndita/fsrootover.htm

FLASH: AIX NFSv4 vulnerability

 

VULNERABILITY: AIX NFSv4 vulnerability

PLATFORMS: AIX 5.3, 6.1, and 7.1 releases

SOLUTION: Apply the fix as described below.

THREAT: See below

CVE Numbers: CVE-2012-4817

Reboot required? YES
Workarounds? NO
Protected by FPM? NO
Protected by SED? NO

===============================================================================
DETAILED INFORMATION

I. DESCRIPTION ( From cve.mitre.org)

GID in NFSv4 is loosely enforced.

II. CVSS

CVSS Base Score: 5
CVSS Temporal Score: See http://xforce.iss.net/xforce/xfdb/78431 for the
current score
CVSS Environmental Score*: Undefined
CVSS String: (AV:N/AC:L/Au:N/C:N/I:N/A:P)

III. PLATFORM VULNERABILITY ASSESSMENT

Note: To use the following commands on VIOS you must first
execute:

oem_setup_env

To determine if your system is vulnerable, execute the following
command:

lslpp -L bos.net.nfs.client

The following fileset levels are vulnerable:

AIX Fileset Lower Level Upper Level
——————————————————————
bos.net.nfs.client 5.3.12.0 5.3.12.5
bos.net.nfs.client 6.1.6.0 6.1.6.17
bos.net.nfs.client 6.1.7.0 6.1.7.2
bos.net.nfs.client 7.1.0.0 7.1.0.20
bos.net.nfs.client 7.1.1.0 7.1.1.3

IV. SOLUTIONS

A. APARS

IBM has assigned the following APARs to this problem:

AIX Level APAR number Availability
—————————————————
5.3.12 IV17855 Available as of SP6
6.1.6 IV10327 Available as of SP7
6.1.7 IV11629 Available as of SP3
7.1.0 IV26436 12/12/12 sp8
7.1.1 IV12169 Available as of SP4

Subscribe to the APARs here:

http://www.ibm.com/support/docview.wss?uid=isg1IV17855
http://www.ibm.com/support/docview.wss?uid=isg1IV10327
http://www.ibm.com/support/docview.wss?uid=isg1IV11629
http://www.ibm.com/support/docview.wss?uid=isg1IV26436
http://www.ibm.com/support/docview.wss?uid=isg1IV12169

By subscribing, you will receive periodic email alerting you
to the status of the APAR, and a link to download the fix once
it becomes available.

B. FIXES

Fixes are available. The fixes can be downloaded via ftp
from:

ftp://aix.software.ibm.com/aix/efixes/security/nfsv4_fix1.tar

The link above is to a tar file containing this signed
advisory, fix packages, and PGP signatures for each package.
The fixes below include prerequisite checking. This will
enforce the correct mapping between the fixes and AIX
Technology Levels.

AIX Level Interim Fix (*.Z)
——————————————————————-
7.1.0.7 IV26436s07.120907.epkg.Z

VIOS Level Interim Fix (*.Z)
——————————————————————-
2.2.1.4-FP-25 SP-02 Included in current SP

To extract the fixes from the tar file:

tar xvf nfsv4_fix1.tar
cd nfsv4_fix1

Verify you have retrieved the fixes intact:

The checksums below were generated using the
“csum -h SHA1” (sha1sum) command is the followng:

csum -h SHA1 (sha1sum) filename
——————————————————————
8f42e3c1a5eb3a0d73d7be8d38265544f9abd866 IV26436s07.120907.epkg.Z

To verify the sum, use the text of this advisory as input to sha1sum.
For example:

csum -h SHA1 -i Advisory.asc
sha1sum -c Advisory.asc

These sums should match exactly. The PGP signatures in the tar
file and on this advisory can also be used to verify the
integrity of the fixes. If the sums or signatures cannot be
confirmed, contact IBM AIX Security at
security-alert@austin.ibm.com and describe the discrepancy.

C. FIX AND INTERIM FIX INSTALLATION

IMPORTANT: If possible, it is recommended that a mksysb backup
of the system be created. Verify it is both bootable and
readable before proceeding.

To preview a fix installation:

installp -a -d fix_name -p all # where fix_name is the name of the
# fix package being previewed.
To install a fix package:

installp -a -d fix_name -X all # where fix_name is the name of the
# fix package being installed.

Interim fixes have had limited functional and regression
testing but not the full regression testing that takes place
for Service Packs; however, IBM does fully support them.

Interim fix management documentation can be found at:

http://www14.software.ibm.com/webapp/set2/sas/f/aix.efixmgmt/home.html

To preview an interim fix installation:

emgr -e ipkg_name -p # where ipkg_name is the name of the
# interim fix package being previewed.

To install an interim fix package:

emgr -e ipkg_name -X # where ipkg_name is the name of the
# interim fix package being installed.

V. WORKAROUNDS

There are no workarounds.

VI. CONTACT INFORMATION

If you would like to receive AIX Security Advisories via email,
please visit:

http://www.ibm.com/systems/support

and click on the “My notifications” link.

To view previously issued advisories, please visit:

http://www14.software.ibm.com/webapp/set2/subscriptions/pqvcmjd

Comments regarding the content of this announcement can be
directed to:

security-alert@austin.ibm.com

To obtain the PGP public key that can be used to communicate
securely with the AIX Security Team you can either:

A. Send an email with “get key” in the subject line to:

security-alert@austin.ibm.com

B. Download the key from our web page:

http://www.ibm.com/systems/resources/systems_p_os_aix_security_pgpkey.txt

C. Download the key from a PGP Public Key Server. The key ID is:

0x28BFAA12

Please contact your local IBM AIX support center for any
assistance.

eServer is a trademark of International Business Machines
Corporation. IBM, AIX and pSeries are registered trademarks of
International Business Machines Corporation. All other trademarks
are property of their respective holders.

VII. ACKNOWLEDGMENTS

IBM discovered and fixed this vulnerability as part of its
commitment to secure the AIX operating system.

VIII. REFERENCES:

Complete CVSS Guide: http://www.first.org/cvss/cvss-guide.html
On-line Calculator V2:
http://nvd.nist.gov/cvss.cfm?calculator&adv&version=2
X-Force Vulnerability Database: http://xforce.iss.net/xforce/xfdb/78431
CVE-2012-4817: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-4817

*The CVSS Environment Score is customer environment specific and will
ultimately impact the Overall CVSS Score. Customers can evaluate the
impact of this vulnerability in their environments by accessing the links
in the Reference section of this Flash.

Note: According to the Forum of Incident Response and Security Teams
(FIRST), the Common Vulnerability Scoring System (CVSS) is an “industry
open standard designed to convey vulnerability severity and help to
determine urgency and priority of response.” IBM PROVIDES THE CVSS SCORES
“AS IS” WITHOUT WARRANTY OF ANY KIND, INCLUDING THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. CUSTOMERS ARE
RESPONSIBLE FOR ASSESSING THE IMPACT OF ANY ACTUAL OR POTENTIAL SECURITY
VULNERABILITY.