Kernel Commands
A new set of kernel-related commands has been developed that have a common behavior. This section covers all the commands and provides examples of using some of them.
kcmodule
kcmodule queries and changes kernel modules in the currently running kernel configuration or a saved kernel configuration that you are staging for future use. Hundreds of modules are present in an HP-UX kernel that consists of device drivers, kernel subsystems, and other kernel code.
kcmodule with no options provides the modules in your system and both their current state and the state on next boot if any changes are pending, as shown in this abbreviated example:
# kcmodule
Module State Cause Notes
DeviceDriver unused
KeyboardMUX unused
LCentIf static best
MouseMUX unused
UsbBootKeyboard unused
UsbBootMouse unused
UsbHub unused
UsbMiniBus unused
UsbOhci unused
acpi_node static best
arp static depend
asio0 static best
audio static best
autofsc static best
azusa_psm static best
beep static depend
BTlan static best
c460gx_psm static depend
c8xx static best
cachefsc static best
ccio unused
cdfs auto best auto-loadable, unloadable
cec_hp static depend
cell static best
cifs static best
clone static best
consp1 unused
diag2 static best
dlpi static best
dm_sample_fsid unused
dmapi unused
dmp static depend
dmsample unused
echo static best
ehci unused
fcd static best
fcms static depend
fcp static depend
fcp_cdio static depend
fcparray static depend
fcpdev static depend
fcpmux static depend
fddi4 static best
ffs static best
framebuf unused
gelan static best
graph3 unused
gvid unused
gvid_core unused
hcd unused
hid unused
hpstreams static best
hsx static eXPlicit loadable, unloadable
hub unused
ia64_psm static best
idds unused
.
.
.
This abbreviated output shows some of the modules in the system without mUCh detail. We modify the last module shown, idds, in a later example. To get detailed information on a specific module, use the -v option, as shown for vxfs:
# kcmodule -v vxfs
Module vxfs [3F559170]
Description Veritas Journal File System (VxFS)
State static (best state)
State at Next Boot static (best state)
Capable static unused
Depends On module libvxfs:0.0.0
interface HPUX_11_23:1.0
#This verbose output shows more information for the specific module that we specified, or would have shown verbose output for every module if I had not specified the name of a specific module.
For every module in the verbose output, there is a name and description such as a name of vxfs, the version number in square brackets after the name, and a short description of the module in the example. It is possible for multiple versions to be listed if, for instance, the currently running kernel uses a different version than will be used on the next boot.
The state of the module is relative to the currently running kernel (which is shown in the example), the next boot (both the currently running and next boot states are shown), or a saved configuration. The module in the example is for the currently running kernel, so static means that the module is statically bound into the kernel and changing this state would require relinking the kernel executable and rebooting. The module could also be in the unused state, which means it is installed but not used, the loaded state, which means it has been dynamically loaded into the kernel, or the auto state, which means it will be dynamically loaded when it is first needed but hasn't been loaded yet.
The following list shows commonly used options to kcmodule:
kcmodule command-line flags:
-a
Includes all modules in the output.
-B
Backs up the currently running configuration prior to changing it.
-c config
Specifies the saved configuration to manage. If none is specified, manage the currently running configuration.
-C comment
Includes a comment pertaining to this invocation of the command in the kernel configuration log file.
-d
Adds the description for each item.
-D
Displays elements for which there is a pending change at the next boot.
-h
Holds the specified change(s) for the next boot.
-K
Keeps the currently running configuration, but does not back it up. Keep the existing backup unmodified.
-P
Parses using the specified output format.
-S
Displays the elements that have been set to something other than the default.
-v
Displays items using verbose output.
Some of these options will be used in the upcoming example of updating the kernel.
kctune
kctune queries and changes the value of kernel tunable parameters in the currently running kernel configuration or a saved kernel configuration that you are staging for future use.
kctune with no options provides the parameters in your system, as shown in the following abbreviated example:
# kctune
Tunable Value Expression Changes
NSTREVENT 50 Default
NSTRPUSH 16 Default
NSTRSCHED 0 Default
STRCTLSZ 1024 Default
STRMSGSZ 0 Default
acctresume 4 Default
acctsuspend 2 Default
aio_listio_max 256 Default Immed
aio_max_ops 2048 Default Immed
aio_monitor_run_sec 30 Default Immed
aio_physmem_pct 10 Default
aio_prio_delta_max 20 Default Immed
aio_proc_thread_pct 70 Default Immed
aio_proc_threads 1024 Default Immed
aio_req_per_thread 1 Default Immed
allocate_fs_swapmap 0 Default
alwaysdump 0 Default Immed
bufcache_hash_locks 128 Default
chanq_hash_locks 256 Default
core_addshmem_read 1 1 Immed
core_addshmem_write 1 1 Immed
create_fastlinks 0 Default
dbc_max_pct 50 Default Immed
dbc_min_pct 5 Default Immed
default_disk_ir 0 Default
disksort_seconds 0 Default
dma32_pool_size 268435456 Default
dmp_rootdev_is_vol 0 Default
dmp_swapdev_is_vol 0 Default
dnlc_hash_locks 512 Default
dontdump 0 Default Immed
dst 1 Default
dump_compress_on 1 Default Immed
enable_idds 0 Default Immed
eqmemsize 15 Default
executable_stack 0 Default Immed
fs_async 0 Default
fs_symlinks 20 Default Immed
ftable_hash_locks 64 Default
hp_hfs_mtra_enabled 1 Default
io_ports_hash_locks 64 Default
ksi_alloc_max 33600 Default Immed
ksi_send_max 32 Default
max_acct_file_size 2560000 Default Immed
max_async_ports 50 Default
max_mem_window 0 Default
max_thread_proc 256 Default Immed
maxdsiz 1073741824 Default Immed
maxdsiz_64bit 4294967296 Default Immed
maxfiles 8192 8192
maxfiles_lim 8192 8192 Immed
maxrsessiz 8388608 Default
maxrsessiz_64bit 8388608 Default
maxssiz 8388608 Default Immed
maxssiz_64bit 268435456 Default Immed
maxtsiz 100663296 Default Immed
maxtsiz_64bit 1073741824 Default Immed
maxuprc 256 Default Immed
maxvgs 10 Default
msgmap 1026 Default
msgmax 8192 Default Immed
msgmnb 16384 Default Immed
msgmni 512 Default
msgseg 8192 Default
msgssz 96 Default
msgtql 1024 Default
ncdnode 150 Default Immed
nclist 8292 Default
ncsize 8976 Default
nfile 65536 Default Auto
nflocks 4096 Default Auto
ninode 4880 Default
.
.
.
This output shows the tunable parameter, its current value, the expressions used to compute the value (which is the default in all cases in the example except for maxfiles), and changes to the value if any are pending. In an upcoming example, I modify the nproc tunable.
Using the -d option, which also works with kcmodule, adds a description for each parameter, as shown in the following truncated example:
# kctune -d
Tunable Value Expression Changes
Description
NSTREVENT 50 Default
Maximum number of concurrent Streams bufcalls
NSTRPUSH 16 Default
Maximum number of Streams modules in a stream
NSTRSCHED 0 Default
Number of Streams scheduler daemons to run (0 = automatic)
STRCTLSZ 1024 Default
Maximum size of the control portion of a Streams message (bytes)
STRMSGSZ 0 Default
Maximum size of the data portion of a Streams message (bytes; 0 = unlimited)
acctresume 4 Default
Relative percentage of free disk space required to resume accounting
acctsuspend 2 Default
Relative percentage of free disk space below which accounting is suspended
aio_listio_max 256 Default Immed
Maximum number of async IO operations that can be specified in lio_list call
aio_max_ops 2048 Default Immed
Maximum number of async IO operations that can be queued at any time
aio_monitor_run_sec 30 Default Immed
Frequency of AIO Thread Pool Monitor Execution (in seconds)
aio_physmem_pct 10 Default
.
.
.
Each module now has a more detailed description associated with it as a result of using the -d option.
To group parameters based on the kernel module that defines the tunable, use the -g option, as shown in the following abbreviated example:
# kctune -g
Module Tunable Value Expression Changes
cdfs ncdnode 150 Default Immed
dump alwaysdump 0 Default Immed
dump dontdump 0 Default Immed
dump dump_compress_on 1 Default Immed
fs bufcache_hash_locks 128 Default
fs dbc_max_pct 50 Default Immed
fs dbc_min_pct 5 Default Immed
fs disksort_seconds 0 Default
fs dnlc_hash_locks 512 Default
fs fs_async 0 Default
fs fs_symlinks 20 Default Immed
fs ftable_hash_locks 64 Default
fs maxfiles 8192 8192
fs maxfiles_lim 8192 8192 Immed
fs ncsize 8976 Default
fs nfile 65536 Default Auto
fs nflocks 4096 Default Auto
fs o_sync_is_o_dsync 0 Default
fs sendfile_max 0 Default
fs vnode_cd_hash_locks 128 Default
fs vnode_hash_locks 128 Default
hpstreams NSTREVENT 50 Default
hpstreams NSTRPUSH 16 Default
hpstreams NSTRSCHED 0 Default
hpstreams STRCTLSZ 1024 Default
hpstreams STRMSGSZ 0 Default
hpstreams streampipes 0 Default
idds enable_idds 0 Default Immed
inet tcphashsz 2048 Default
io aio_listio_max 256 Default Immed
io aio_max_ops 2048 Default Immed
io aio_monitor_run_sec 30 Default Immed
io aio_physmem_pct 10 Default
io aio_prio_delta_max 20 Default Immed
io aio_proc_thread_pct 70 Default Immed
io aio_proc_threads 1024 Default Immed
io aio_req_per_thread 1 Default Immed
io io_ports_hash_locks 64 Default
io max_async_ports 50 Default
ite scroll_lines 100 Default Immed
lvm maxvgs 10 Default
pm acctresume 4 Default
pm acctsuspend 2 Default
pm chanq_hash_locks 256 Default
pm dst 1 Default
.
.
.
This output shows all the tunables grouped with their kernel modules. You can see that, in the case of the fs module, for example, many tunables are associated with some modules.
The -v output, as shown in the following abbreviated example, provides a lot of tunable-related information:
# kctune -v
Tunable NSTREVENT
Description Maximum number of concurrent Streams bufcalls
Module hpstreams
Current Value 50 [Default]
Value at Next Boot 50 [Default]
Value at Last Boot 50
Default Value 50
Can Change At Next Boot Only
Tunable NSTRPUSH
Description Maximum number of Streams modules in a stream
Module hpstreams
Current Value 16 [Default]
Value at Next Boot 16 [Default]
Value at Last Boot 16
Default Value 16
Can Change At Next Boot Only
Tunable NSTRSCHED
Description Number of Streams scheduler daemons to run (0 = automatic)
Module hpstreams
Current Value 0 [Default]
Value at Next Boot 0 [Default]
Value at Last Boot 0
Default Value 0
Can Change At Next Boot Only
Tunable STRCTLSZ
Description Maximum size of the control portion of a Streams message (by
tes)
Module hpstreams
Current Value 1024 [Default]
Value at Next Boot 1024 [Default]
Value at Last Boot 1024
Default Value 1024
Can Change At Next Boot Only
Tunable STRMSGSZ
Description Maximum size of the data portion of a Streams message (bytes
; 0 = unlimited)
Module hpstreams
Current Value 0 [Default]
Value at Next Boot 0 [Default]
Value at Last Boot 0
Default Value 0
Can Change At Next Boot Only
Standard input
.
.
.
This output shows additional information, including the value the parameter will have upon the next boot.
All tunables have manual pages. If, for example, you want to know more about a tunable, just issue the man for the tunable, as shown in the following example for nproc:
# man nproc
nproc(5) nproc(5)
Tunable Kernel Parameters
NAME
nproc - limits the number of processes allowed to exist simultaneously
VALUES
Failsafe
4200
Default
4200
Allowed values
100 - 30000
This may be set higher, but more will not be used. Setting nproc
below 110 will interfere with the systems ability to execute in
multi-user mode. Some configurations may have a higher minimum.
nproc must be greater than nkthread + 100.
Standard input
Only the beginning of the nproc output is shown, but you can see there is a lot of useful information in the man page, such as the default and allowed values. The following list shows commonly used options to kctune.
kctune command-line flags:
-a
Includes all information in the output that is normally suppressed.
-B
Backs up the currently running configuration prior to changing it.
-c config
Specifies the saved configuration to manage. If none is specified, manages the currently running configuration.
-C comment
Includes a comment pertaining to this invocation of the command in the kernel configuration log file.
-d
Displays the descriptions of each item.
-D
Displays elements for which there is a pending change at the next boot.
-g
Groups related tunables in the output.
-h
Holds the specified change(s) for the next boot.
-K
Keeps the currently running configuration, but does not back it up. Keeps the existing backup unmodified.
-P
Parses using the specified output format.
-S
Displays the elements that have been set to something other than the default.
-u
Allows the creation of user-defined tunables.
-v
Displays items using verbose output.
Some of these options are used in the upcoming kernel configuration example.
kconfig
kconfig manages kernel configurations.
Running kconfig with no options shows you all the saved kernel configurations on your system. You can view the output using -a for all, -v for verbose, and -P for parse.
Changes to the kernel can be delayed until the next boot using the -n option to kconfig. (Next boot options are also available with the -h option for kcmodule and kctune.)
To obtain a list of changes being held for the next boot, you would use the -D option to kconfig to show differences between the currently running kernel and what is planned for the next boot. You could also run kcmodule and kctune with the -D option to get this same list. If you don't want these changes to be applied at the next boot, use the -H option to kconfig, which "unholds" the settings.
To obtain a list of non-default kernel values, use the -S option to kconfig. This too is a shortcut for running both kcmodule and kctune with the -S option.
You can specify a saved configuration with no option to kconfig by just naming it on the command line or by using the -c option for kcmodule and kctune.
If you have made changes to the currently running kernel and want to save, use the -s option to kconfig.
You can load a saved configuration using the -l option to kconfig. If the configuration can be loaded without a reboot, the change takes effect immediately. If not, the change is held for the next reboot. You can specify that the change be applied at the next reboot with the -n option for kconfig. You can identify the configuration to be loaded a the next boot using the -w option to kconfig.
Several of these options are used in the upcoming kernel reconfiguration example.
The following is a list of commonly used kconfig options.
kconfig command-line flags:
-a
Includes all information in the output that is normally suppressed. This provides a lot of information so you may want to pipe this to more.
-B
Backs up the currently running configuration prior to changing it.
-C comment
Includes a comment pertaining to this invocation of the command in the kernel configuration log file.
-d config
Deletes the specified kernel configuration.
-D
Displays elements for which there is a pending change at the next boot.
-e
Exports the saved configuration.
-h
Holds the specified change(s) for the next boot.
-H
Discards all changes being held for the next boot.
-i config
Imports the specified configuration.
-K
Keeps the currently running configuration, but does not back it up. Keeps the existing backup unmodified.
-l config
Loads the specified configuration.
-P
Parses using the specified output format.
-S
Displays the elements that have been set to something other than the default.
-v
Displays items using verbose output.
kclog
kclog manages the kernel configuration log file.
All the commands previously covered (kcmodule, kctune, and kconfig) update and maintain the kernel configuration plain text log file called /var/adm/kc.log. You can view this file directly to see the kernel-related commands that have been issued, which is the way that I view kernel-related changes, or issue the kclog command to view /var/adm/kc.log.
kclog has the following commonly used command-line flags:
kclog commonly used command line options:
-a
Prints all entries matching
-c config
Prints log file entries from the specified configuration.
-C comment
Includes the specified comment.
kcusage
kcusage shows the usage level of kernel resources. If you issue the kcusage command with no options, you get output for the currently running system, as shown in the following output:
# kcusage
Tunable Usage / Setting
=============================================
dbc_max_pct 5 / 50
maxdsiz 37666816 / 1073741824
maxdsiz_64bit 7258112 / 4294967296
maxfiles_lim 56 / 8192
maxssiz 1179648 / 8388608
maxssiz_64bit 20480 / 268435456
maxtsiz 421888 / 100663296
maxtsiz_64bit 237568 / 1073741824
maxuprc 0 / 256
max_thread_proc 57 / 256
msgmni 2 / 512
msgseg 0 / 8192
msgtql 0 / 1024
nfile 586 / 65536
nflocks 20 / 4096
ninode 653 / 4880
nkthread 484 / 8416
nproc 150 / 4200
npty 0 / 60
nstrpty 0 / 60
nstrtel 0 / 60
semmni 23 / 2048
semmns 25 / 8192
shmmax 17906400 / 68719476736
shmmni 7 / 400
[rx8620b{root}:/roothome]>
This is an idle system so the resources are used minimally.
You can specify the time period over which data should be printed, including 24 hours, 31 days, and 52 weeks. Two interesting options to kcusage are -l, which prints a long format, and -t, which prints the top 5 users or processes that have consumed each resource. The following is an obviated listing of these two outputs:
# kcusage -l
Parameter: dbc_max_pct
Usage: 5
Setting: 50
Percentage: 10.0
Parameter: maxdsiz
Usage: 37666816
Setting: 1073741824
Percentage: 3.5
Parameter: maxdsiz_64bit