Replacing Getty with Ngetty on Debian

This is useful especially for tiny VPS servers with less than 1GB of RAM. In which case every MB counts! Ngetty is a single-process getty replacement, so instead of running 6 getty processes consuming up to 3MB of RAM each, you can use a single ngetty process using less than 1MB of RAM total. Saving valuable RAM.

First login to your Debian box and run the following command:

apt-get install ngetty

Once installed, edit /etc/inittab. The end of it should be edited to look like this:

# /sbin/getty invocations for the runlevels.
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
# Format:
#  <id>:<runlevels>:<action>:<process>
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
ng:2345:respawn:/sbin/ngetty 1 2 3 4 5 6

# Example how to put a getty on a serial line (for a terminal)
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

So basically this line (ng:2345:respawn:/sbin/ngetty 1 2 3 4 5 6) replaces six getty lines.

I was stripping down a Debian 7 server for a client and part of the process follows these steps here. I noticed no instructions for replacing getty with ngetty on that Debian page, so hopefully this helps someone as its quite a simple task.

Related:  Linux server performance: Is disk I/O slowing your application?