Virtual printer in CUPS

To create a printer in CUPS that sends the data nowhere (like /dev/null), there are many ways. This page uses the socket:// method.

Set up xinetd first

What we need is the TCP Discard service on port 9. Xinetd has it built-in, so we can just use that. Make sure that the following definition is available in xinetd's configuration file(s), usually /etc/xinetd.d/discard. It should contain a service like the following:

service discard
    type            = INTERNAL
    id              = discard-stream
    socket_type     = stream
    protocol        = tcp
    user            = root
    wait            = no
    disable         = no
    FLAGS           = IPv6 IPv4

Run rcxinetd reload to reread the configuration files and activate the new discard service. Or use rcxinetd start if xinetd was not already active.

CUPS printer

Now go to the CUPS web frontend and add a new printer. As destination, use socket://localhost:9/, as printer choose something that looks featureful, for example the "HP 2500C Foomatic/pcl3". That's all there is to it.