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.

Replacing Getty with Ngetty on Debian

3 Responses

  1. thanks!

    Patrick October 20, 2014 at 4:29 pm #
  2. Good for small mother boards like beagleboard, pi etc. as well. Just you need to add to your tutorial, “init q” for inittab restart without system reboot.

    ZEROF December 12, 2014 at 3:20 am #
  3. Note: this no longer works for debian 8 as jessie does not have /etc/inittab (due to systemd). I would love to have updated instructions for jessie if ngetty can still be used as its been a great resource saver in the past!

    drad September 27, 2015 at 11:28 am #

Leave a Reply