chcons Command

Note: The console log can only be present under / ,/usr ,/var or /tmp directory alone.

Purpose

Redirects the system console to a specified device or file to be effective on the next startup of the system.

Syntax

chcons [ -a login=disable =enable} ] [  -a console_logname=file ] [  -a console_logsize=size ] [  -a console_logverb=number ] [  -a console_tagverb=number ] PathName

Description

The chcons command changes the system console effective on the next system startup. The current operation of the system console is not affected.

The PathName parameter must be a fully qualified path name to a device or file that is to become the system console.

If the PathName parameter specifies a file that does not exist, the chcons command creates the file at the next system startup. If the file does exist, the chcons command sends any console message output to the file. For a regular file, the system does not start the login program.

If the console path name is a character device, the system starts the login program on the device. Login is enabled on the console at all run levels. If no login is desired, use the -a login=disable flag.

CAUTION: If the console is the only login terminal on the system, you cannot log in at the next start of the system using the -a login=disable flag.

Additional Information

The chcons command saves the specified information into the database to be used on the next start-up of the system with the console configuration method. This method checks the specified device path name to determine if it is a character special file. If it is not, or does not exist, the device path name is assumed to be a file, and the console is set accordingly. If the device path name is a character special file, the console configuration method uses the base name as a logical name and attempts to look up the device name in the device database. If the device is found and available, the console is set to the device.

If the device is not found or is found but not available, a console finder routine is run that displays a prompt requesting that a new system console device be selected. By default, the tty on the S1 port and all graphics displays will display the prompt. The /etc/consdef file must be modified to display the prompt on S2 or other ports.

For a device, an entry in the inittab file with the console identifier is set to the respawn action to allow a login on the console if the console login was specified as the enable parameter. This causes a login to be available at all run levels. If the console login was specified with the disable parameter or if a file is designated as the console, the console entry in the inittab file is set to the OFF action, and login is disabled on the console for all run levels.

Flags

Item Description
-a login= [ disable | enable ] Enables or disables the login on the console for all run levels at the next start-up of the system.
-a console_logname=file Specifies the full path name to use for the console output log file.
-a console_logsize=size Specifies the size, in bytes, of the console output log file.
-a console_logverb=number Specifies the verbosity level for console output logging. Zero disables logging; 1 through 9 enable logging.
-a console_tagverb=number Specifies the verbosity level for console output tagging. Zero disables tagging, 1 through 9 enable tagging.

Examples

  1. To change the system console to a file called console.out in the /tmp directory, enter:
    chcons /tmp/console.out
  2. To change the system console to a terminal with the tty3 logical name, enter:
    chcons /dev/tty3
  3. To change the system console to the terminal associated with the /dev/tty3 device and ensure a login at the console, enter:
    chcons -a login=enable /dev/tty3
  4. To change the system console to a terminal with the tty0 logical name and disable login at the console, enter:
    chcons -a login=disable /dev/tty0
  5. To change the console to the default physical LFT display, enter:
    chcons /dev/lft0

Files

Item Description
/dev/console Specifies the special file for system console access.
/etc/consdef Enables non-default terminal to be selected as the console device.
/usr/sbin/chcons Specifies the command file.