6.4. mgetty

mgetty is a modem-aware getty. It supports modems with the Hayes AT command set and is especially designed for supporting modems that are used to send faxes and to dial out as well as dial in. These features are not required for a serial console.

mgetty does not require the traditional /etc/gettydefs file. As a result mgetty is invoked from /etc/inittab without supplying an entry in /etc/gettydefs.

Figure 6-7. /etc/inittab entry for mgetty

co:2345:respawn:/sbin/mgetty ttyS0

mgetty is configured using the file /etc/mgetty+sendfax/mgetty.config. It should contain an entry for the port used by the serial console.

Figure 6-8. mgetty configuration file mgetty.config

port ttyS0
 speed 9600
 direct yes
 data-only yes
 toggle-dtr yes
 need-dsr yes
 port-owner root
 port-group root
 port-mode 600
 login-prompt @ \P login:\040
 login-time 60
 term vt102

All the options are documented in the PostScript file /usr/share/doc/mgetty…/mgetty.ps.

We set direct, data-only, need-dsr and toggle-dtr so that the RS-232 control lines are used correctly for a dumb modem.

port-owner, port-group and port-mode set the serial device to be accessible only by the root user. Modem applications, which normally use the uucp group, cannot now accidentally use the serial console.

login-prompt shows the machine (@) and serial port (\P) being used. The text \040 is simply the octal code for a space after login:.

term vt102 gives the make and model of the terminal most likely to dial in. This sets the TERM environment variable, which you can change if you are dialling in from another terminal type.

The remaining configuration files, /etc/mgetty+sendfax/dialin.config and /etc/mgetty+sendfax/login.config, do not need to be altered.

If you wish to alter the suggested configuration then note that mgetty's blocking and toggle-dtr parameters do not co-exist well.

If you have difficulties, activate debugging by adding debug 8 to mgetty.config. mgetty's actions are then visible in the file /var/log/mgetty.log.ttyS0.