Kernel

The kernel configuration file is /stand/system.

To analyze the system and display the tunable parameters

 # sysdef  <enter> (This command will be available after 11i v3 release)

There are three primary commands used to manage kernel configurations: kconfig, kcmodule, and kctune; and two other commands: kcpath and kclog.

  • The kconfig command manages whole kernel configurations. It allows configurations to be saved, loaded, copied, renamed, deleted, exported, imported, etc. It can also list existing saved configurations and give details about them.
  • The kcmodule command manages kernel modules. Kernel modules can be device drivers, kernel subsystems, or other bodies of kernel code. Each module can be unused, statically bound into the main kernel executable, or dynamically loaded. The kcmodule command will display or change the state of any module in the currently running configuration or any saved configuration.
  • The kctune command manages kernel tunable parameters. These are variables that control the behavior of the kernel. They have many uses; common ones include controlling the allocation of system resources and tuning aspects of kernel performance. The kctune command will display or change the value of any tunable parameter in the currently running configuration or any saved configuration.
  • The kcpath command prints information about the location of the currently running kernel. It is intended for use by scripts and applications that need this information.
  • The kclog command searches the kernel configuration log file.
  • kcalarm - add, delete, or list kernel tunable alarms, as well as turn kernel tunable monitoring on and off.
  • the mk_kernel command, present in previous HP-UX releases, should be aware that the command can still be used. It is included as a small shell script that invokes the kconfig command. This older command is obsolescent and will be removed in a future release.

Kernel Log File
The kernel configuration tools automatically maintain a log file at /var/adm/kc.log. This file lists every change made using the kernel configuration commands. Changes made through HP SMH, the web-based interface for kernel configuration, are logged since HP SMH uses the kernel configuration commands to make the changes.

The log file is a plain text file that you can view directly. The kclog command is provided for when you want to do an intelligent search of the log file.

All of the kernel configuration commands accept a -C (comment) option when they are being used to make configuration changes. The -C option allows you to specify a comment that will be included in the log entry for your change. This can help readers of the log understand the reasons for your changes.

Query, set, or reset system parameter

Startin HP-UX 11i v.2, config, kmadmin, kminstall, kmmodreg, kmsystem, and kmupdate commands are obsolete and have been removed. The kmtune, kmpath, and mk_kernel commands have been deprecated and are obsolescent.

Common Kernel Command Line options

 -a    Include all information in the output
 -b    Specify whether or not to update the automatic backup configuration before the requested change
 -c    Specify the saved configuration to manage. if omitted, manage the currently running configuration
 -C    Include a comment in the kernel configuration log file
 -d    Display descriptions of each item
 -D   (difference) Display only the changes being held for next boot
 -h   (hold) Hold the requested changes for next boot
 -P   (parse) Use the special parsable output format.
 -S   Display only elements that have been set to something other than default
 -v   (verbose) Display items using verbose output format

kctune:


kctune commad is used to get information about tunable parameters and their values, and makes changes to tunable values

To set a tunable value on the running system:

      $ kctune tunable=12

To set a tunable value to be used when the system reboots:

      $ kctune -h tunable=12

To increase a tunable's value by 100:

      $ kctune tunable+=100

To see all tunables and their current values:

      $ kctune

To see which tunables have new values being held until next boot:

      $ kctune -D

To see verbose information about a tunable:

      $ kctune -v tunablename

To sort the output (group) by tunables name

      $ kutune -g 

kcmodule


To display the Kernel moudles status of KeyboardMUX PCItoPCI autofs cachefs

 # kcmodule KeyboardMUX PCItoPCI autofs cachefs
 Module State Cause Notes
 KeyboardMUX unused
 PCItoPCI static depend
 autofs static best
 cachefs auto best auto-loadable, unloadable

The -d option adds the description of each module.

 # kcmodule -d PCItoPCI cachefs 
 Module State Cause Notes
 Description
 PCItoPCI static depend
 Generic PCI to PCI Bridge Adapter CDIO
 cachefs auto best auto-loadable, unloadable
 Cache File System

The -v option gives verbose, multiline information about each module:

 # kcmodule -v autofs
 Module autofs (1.0)
 Description Automounter File System
 Timestamp Tue Sep 12 21:53:28 2006 [45078EC8]
 State static (best state)
 State at Next Boot static (best state)
 Capable static unused
 Depends On module nfswrp:0.0.0
 interface HPUX_11_31_PERF:1.0

To change the state of a module

 # kcmodule cdfs=loaded
 # kcmodule cdfs=best (same as previous command)

To unload it:

 # kcmodule cdfs=unused

kconfig


When you run kconfig with no options, it shows you the saved configurations on your system. There will always be a saved configuration called backup, which is automatically maintained by the system; any other saved configurations on the system will also be listed

With no options, the output looks like this:

 # kconfig
 Configuration Title
 backup Automatic Backup
 day Configuration for daytime multiuser processing
 last_install Created by last OS install

The -v option gives verbose, multiline information about each saved configuration:

 # kconfig -v day
 Configuration day
 Title Configuration for daytime multiuser processing
 Created Thu Oct 12 01:33:36 2006 by allanp
 as a copy of ’last_install’
 Modified Thu Oct 12 01:37:14 2006 by allanp
 Kernel Path /stand/day/vmunix

To save the currently running config to myconfig

 # kconfig -s 
 # kconfig -v myconfig
 Configuration myconfig
 Title
 Created       Wed Mar  3 14:35:31 2010 by jkailasa
               by saving the running configuration
 Kernel Path   /stand/testconfig/vmunix

To load a saved config to a running kernel

 # kconfig -l myconfig

kclog


To see the last three entries in the log:

 $ kclog 3

To see the last entry for the tunable nproc:

 $ kclog -t tunable -n nproc

To see the last five entries for module changes:

 $ kclog -t module 5

Managing Configurations with System Files

Every kernel configuration has a corresponding system file. A system file is a flat text file that describes all of the configuration settings in a compact, machine-readable, portable format. System files provide an alternate mechanism for kernel configuration, because configuration changes can be made by editing a system file and then telling the kernel configuration tools to apply the changes.

  • The system automatically maintains system files for each configuration.
  • The system file for the currently running configuration is located at /stand/system.
  • The system file for any saved configuration is located at /stand/configname/system.

If you want to create a new system file for a configuration, use the kconfig -e (export) command.

To export the running configuration:

 # kconfig –e filename

To Export a already saved configuration:

 # kconfig –e configname filename

Once you have a system file, you can edit it using any text editor, making the changes
you desire. After editing it, you can apply the changes with the kconfig -i (import)
command.

To Import to the running configuration now:

 # kconfig -i filename

To Import and hold for next boot:

 # kconfig -h -i filename

To Import to saved configuration:

 # kconfig -i configname filename

Booting a saved configuration or in Fail-safe Mode

In extreme circumstances, a mistaken configuration change can result in a kernel configuration that won’t boot. In these cases, you have two options: boot a different configuration, such as the automatic backup configuration, and/or boot in fail-safe mode (

Integrity
To boot a saved configuration on an Integrity system,

  • interrupt the automatic boot process when it reaches the point that it has started the HP-UX boot loader. (On most

systems, this is during the second 10-second countdown.)

  • At the HPUX> prompt, type
   HPUX>boot myconfig

HP 9000
To boot a saved configuration on an HP 9000 system,

  • Interrupt the automatic boot process when you arrive at the boot console handler.
  • Tell it to boot from the desired device (typically with a boot pri command).
  • When it asks if you want to interact with the ISL or IPL, say Yes.
  • At the ISL> prompt, type
    ISL>hpux myconfig/vmunix

To Boot in Fail-Safe mode on Integrity servers

 hpux> boot -tm

To boot in Fail-Safe mode in HP 9000

 ISL> hpux -tm

Modifying Tunable Values at boot time
To boot the myconfig configuration and set nproc to 6000, the minimum commands would be:

 HPUX> boot myconfig nproc=6000   # For Integrity
 ISL> hpux myconfig/vmunix nproc=6000  # For HP 9000

HP-UX kernel configuration tool

kcweb is used to manage kernel tunables, modules and alarms. It provides both Web-based and terminal user interface. The Web-based interface is launched through the HP System Management Homepage. Please find bellow the screen shot of kcweb in terminal mode

  
 # kcweb
                                     Kernel Configuration
-----------------------------------------------------------------------------------------------
    t - Tunables                        View or modify kernel tunables

    m - Modules                         View or modify kernel modules and drivers

    a - Alarms                          View or modify alarms for kernel tunables

    l - Log Viewer                      View the changes made to kernel tunables or modules

    u - Usage                           View usage of kernel tunables


    c - Manage Configuration            View the  options available to manage configurations

    b - Restore Previous Boot Values    Restores Previous Boot Values for Tunables And Modules



-----------------------------------------------------------------------------------------------
x-Exit smh   ENTER-Select   ESC-Back   1-Help

                                                Kernel Configuration->Tunables (All)
------------------------------------------------------------------------------------------------------------------------------------
Tunable                      Tuning      Current      Next Boot    Default      Usage     Module
                             Capability  Value        Value        Value
====================================================================================================================================
NSTREVENT                    Static      50           50           50           -         hpstreams
NSTRPUSH                     Static      16           16           16           -         hpstreams
NSTRSCHED                    Static      0            0            0            -         hpstreams
STRCTLSZ                     Static      1024         1024         1024         -         hpstreams
STRMSGSZ                     Static      0            0            0            -         hpstreams
acctresume                   Static      4            4            4            -         pm_acct
acctsuspend                  Static      2            2            2            -         pm_acct
aio_iosize_max               Dynamic     0            0            0            -         aio
aio_listio_max               Dynamic     256          256          256          -         aio
aio_max_ops                  Dynamic     2048         2048         2048         -         aio
aio_monitor_run_sec          Dynamic     30           30           30           -         aio
aio_physmem_pct              Dynamic     10           10           10           -         aio
aio_prio_delta_max           Dynamic     20           20           20           -         aio
aio_proc_max                 Dynamic     0            0            0            -         aio
aio_proc_thread_pct          Dynamic     70           70           70           -         aio
aio_proc_threads             Dynamic     1024         1024         1024         -         aio
---------------------------------------------------------------------------------------------------------------------------SCROLL \/
x-Exit smh      ESC-Back   p-Pending   b-Restore Previous Boot Values   2-kctune Manpage    /-Search
ENTER-Details   m-Modify   d-Dynamic   1-Help                           3-Tunable Manpage


Managing kernel in older HP-UX (11i v.1 and older)

kmtune
kmtune command query, set, or reset system parameters. kmtune displays the value of all system parameters when used without any options or with the -S or -l option.

By default, kmtune's changes affect the currently running kernel configuration, marked to take effect at next boot. If the -u option is specified, kmtune's changes affect the current configuration, and take effect immediately.

 -l         Print a detailed report
 -q name    Query the value of the specified system parameter
 -s name{=|+}value  Set the value of the specified system parameter
 -S system_file Specify the HP-UX system description file name.  
    If not specified, /stand/system is used as the default
 -r Reset the value of the specified system parameter to default
 -u Update the current kernel configuration. This modifies the -s and -r 
    options so that their effects take effect immediately rather than at next boot.

Note: kmtune is an obsolete command that is replaced by kctune in the newer version of HP-UX

 # kmtune -q shmseg 
 Parameter            Value 
  
 shmseg               120

 # kmtune -s shmseg=128

 # kmtune -l -q shmseg

 Parameter:      shmseg
 Value:          128
 Default:        120
 Minimum:        -
 Module:  

 # kmtune -r shmseg
 # kmtune -q shmseg
 Parameter        Value
 
 shmseg           120

kmsystem - set, query configuration and loadable flags for a module

 -c  value  Set the configuration status of module_nameto value.  
     Value must be Y or y to configure the module, or N or n to 
     not configure it.
 -q Print the loadable and configuration flag information for 
    module_name. If the loadable information does not apply, 
    then a - is printed.

To add the tape drive support:

 # kmsystem -q stape
 Module              Configured          Loadable
 
 stape  

 # kmsystem -S /stand/build/system | grep stape
 stape               N                   -

 # kmsystem -S /stand/build/system -c Y stape

 # kmsystem -S /stand/build/system | grep stape
 stape               Y                   -

 #/usr/sbin/mk_kernel -s /stand/build/system
 # mv /stand/system /stand/system.prev
 # mv /stand/build/system /stand/system
 # /usr/sbin/kmupdate

 Kernel update request is scheduled.

Default kernel /stand/vmunix will be updated by newly built kernel /stand/build/vmunix_test at next system shutdown or startup time.

/usr/conf - supported device drivers and sub systems

kmupdate - this command is used to update the kernel file.

To rebuild the kernal:

  1. Go to /stand/build directory
  2. /usr/lbin/sysadm/system_prep -s system # creates the system file
  3. edit the system file as required using vi
  4. mk_kernel -s ./system # creates the new kernel file using system fiel. It creates a kernel file ./vmunix_test
  5. backup the old kernel and the system files
    1. cp /stand/system /stand/system.old
    2. cp /standvmunix /stand/vmunix.old
  6. Install the new kernel
    1. mv /stand/build/system /stand
    2. mv /stand/build/vmunix_test /stand/vmunix
  7. Reboot the system