A Guide to Automated Package Installation on AIX
Chris Gibson explains how to address a common challenge by using the new autofsinstall utility in AIX 7.3 TL4
Have you ever needed to run a specific command on an AIX server and found that it was not installed because the required AIX fileset wasn’t installed? Most administrators are likely to answer yes to this question.
Typically when this happens, we need to install the package from either AIX installation media (an ISO image) or from an AIX Network Installation Manager (NIM) server. Either way, this requires a few manual steps and can be tedious if you’ve misplaced your AIX media, or if you’re not sure what software is served by your NIM server or local AIX software repositories. Fortunately, starting with AIX 7.3 TL4 there’s now a simpler, automatic way to install packages (almost) on-demand.
With TL4, AIX gained a new utility called autofsinstall. It handles the automatic installation of missing filesets when a command is invoked but not yet installed.
Configuring autofsinstall
Before you can use this new feature you must first make sure that the bos.content_list fileset is already installed.
# lslpp -l bos.content_list
Fileset Level State Description
------------------------------------------------------------------
Path: /usr/lib/objrepos
bos.content_list 7.3.4.0 COMMITTED AIX Release Content List
The bos.content_list file is needed because autofsinstall uses the which_fileset command to automatically identify the appropriate fileset that is required for a missing command. This fileset is not installed by default. This fileset is not installed by default. If the bos.content_list fileset is not installed on your system, then which_fileset will display a message asking you to install the fileset; see example below.
# which_fileset dconsole
The /usr/lpp/bos/AIX_file_list file does not exist.
Please install the "bos.content_list" fileset
and try the "which_fileset" command again.
If you’re not familiar with which_fileset I recommend you take a look at this command also. It’s included with the bos.rte.install fileset, which is installed by default, and has been available with AIX for a long time. It’s great at helping you determine which fileset a command “comes from.” For example, in the output below, we use which_fileset to determine which AIX fileset provides the dpasswd command (which is the dsm.core fileset).
# which_fileset dpasswd
/opt/ibm/sysmgt/dsm/bin/dpasswd dsm.core 7.3.0.0
/usr/bin/dpasswd -> /opt/ibm/sysmgt/dsm/bin/dpasswd dsm.core 7.3.0.0
You’ll also need to check that your AIX host is already managed by a NIM server (this essential for automatic installation of filesets). The easiest way to check that your AIX host is managed by a NIM server is to run nimclient -l. If you run this command and a list of resources is displayed (see example output below) then your system is successfully communicating with a NIM server.
# nimclient -l
master machines master
boot resources boot
nim_script resources nim_script
certificate resources certificate
network0 networks ent
AIX73TL1SP1 resources lpp_source
...etc...
By default the new “auto install” capability is disabled, so to use it you must first enable it (as the root user) with autofsinstall -a. Then you can check the service is enabled (or disabled) with autofsinstall -l (refer to example output below).
# autofsinstall -l
Auto-installation of missing commands is not enabled.
# autofsinstall -a Auto-installation of missing commands is enabled. Please open a new terminal for the changes to take effect. # autofsinstall -l Auto-installation of missing commands is currently enabled.
You’ll notice in the output from autofsinstall -a that you’re instructed to open a new terminal session after you enable the service. This is required because the tool adds a new entry to root’s .profile. A new entry is appended to the bottom of the profile that calls the /usr/lib/instl/fileset_resolve script (refer to output below).
# cat .profile
set -o vi
PS1="$(whoami)@$(hostname) \$PWD # "
export PS1
export PATH=$PATH:/usr/local/bin
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/usr/local/bin:/opt/freeware/bin
trap "if [[ -f /usr/lib/instl/fileset_resolve ]]; then /usr/lib/instl/fileset_resolve; fi" DEBUG
The fileset_resolve script does the real work of finding and installing the missing package for the command you just entered. Refer to the script header description shown below.
...
########################################################################
## Function: find_cmd()
##
## Purpose: The function checks the last executed command in the ## shell and determines whether it is installed on the system. If ## not, it tries to identify the fileset the command belongs to ## and prompts the user to install it from available NIM sources.
## Parameters:None
## Returns: 0 = ok, !0 = Error
##
########################################################################
...
Automatically Install Missing Packages on AIX
To test autofsinstall functionality I chose to run a command I knew was not installed on my AIX host, nslookup. When I entered the command I was told that the command was not found. However, it was included with the bind.rte fileset. I was also asked if I wanted to install this fileset now. After I entered y to install bind.rte I was informed that there was no LPP source allocated to the host (the NIM client).
# nslookup
ksh: nslookup: not found.
nslookup belongs to fileset bind.rte. It’s not installed on the system. Do you want to install it? (y/Yes).
y
LPP source not allocated to client.
So, I went ahead and allocated the appropriate LPP source to my system. In this case, of course, I was running AIX 7.3 TL4 (7300-04-00-2546), so I allocated the AIX73TL4SP0 LPP source from the NIM server to my client using nimclient (see example below).
# oslevel -s
7300-04-00-2546
# nimclient -l -t lpp_source
AIX72TL5SP9 resources lpp_source
AIX73TL1SP1 resources lpp_source
AIX73TL2SP1 resources lpp_source
AIX73TL2SP2 resources lpp_source
AIX73TL2SP3 resources lpp_source
AIX73TL3SP0 resources lpp_source
AIX73TL3SP1 resources lpp_source
AIX73TL4SP0 resources lpp_source
# nimclient -o allocate -a lpp_source=AIX73TL4SP0
# nimclient -l -c resources apollo
AIX73TL4SP0 lpp_source
Once again I entered the nslookup command and selected y to install bind.rte. I was pleasantly surprised to find that the fileset installed successfully and the nslookup command was now available on my system (see output below).
# nslookup ksh: nslookup: not found. nslookup belongs to fileset bind.rte. It’s not installed on the system. Do you want to install it? (y/Yes). y ... +---------------------------------------------------------------+ Summaries: +---------------------------------------------------------------+
Installation Summary
--------------------
Name Level Part Event Result
-----------------------------------------------------------------
bind.rte 7.3.918.2802 USR APPLY SUCCESS
bind.rte 7.3.918.2802 ROOT APPLY SUCCESS
bind.rte for command nslookup successful.
# which nslookup
/usr/bin/nslookup
Considerations
I observed that after the fileset was successfully installed, the LPP source was still allocated to the client (see below). This is by design, as the developers have selected to leave the system in the same state that they found it before autofsinstall ran (this is a sound decision).
# nimclient -l -c resources apollo
AIX73TL4SP0 lpp_source
I’ve found this feature to be a real time saver for me, as it eliminates some of the manual effort identifying filesets and their repositories.
I’m hoping that in a future service pack we might see some enhancements to the tool. For example, if no LPP source is allocated to the NIM client, then perhaps the tool can display a list of the available LPP sources on the NIM server and allow the admin to select the correct LPP source for the package. Then based upon the admin selection it will allocate the LPP resource, install the fileset and then deallocate the LPP source, as it was not allocated before the operation started.
References
Smarter AIX: Seamless Auto-Installation of Missing Filesets