If you are using FreeBSD and have installed and configured CUPS to send print jobs to your printer, then there is a fair chance that you have at some point attempted starting a print job from your console window. For example, by executing a command like “lp myfancynovel.pdf”. And then you would be quite puzzled to discover that although the ‘lp’ command itself seems to be working fine, and that even though printing test pages—via the localhost:631 CUPS configuration webpage in your browser, for example—also works fine, you still get the following puzzling output: “lpr: lp: unknown printer”. Oh dear, that’s not good.
Well, the thing is that you probably have two printing systems on your FreeBSD installation: LPD and CUPS. I believe LPD is installed as standard on a fresh FreeBSD install. But anyone whose printer is so damned modern, that it does not even require a separate building to be housed in, will want to install and use CUPS instead. And in a rational, sane universe, this would not be a source of evil. However, the developers of CUPS appear to have implemented the same names for their command line tools as LPD…
“WHAT!?”—I hear you say? But yes, I fear you indeed read that correctly. It would seem there is some evil bearded pseudo-autistic caveman working on CUPS—some say he had a bad acid trip in the seventies, or perhaps he’d had one too many sugarcubes in his 50 daily CUPS of coffee—who apparently decided at some point that it would be a good idea to use the same names that the LPD system uses. At least, this is my theory. For what kind of lunatic would think to use EXACTLY the same names for the command line programs used by a competing system, and in doing so risk sabotaging his own? It makes no sense to me.
But how did this psychotic loony achieve this? Well, he obviously knew that the LPD commands are located in /usr/bin. Thus a cunning plan sublimated in his warped mind. “Well then, I’ll just put mine in /usr/local/bin!“—he must have thought, with the air of resolute authority one usually sees exclusively in megalomaniac dictators of profoundly marginal banana republics. But since the /usr/bin path usually comes before the /usr/local/bin path in the $PATH variable, the shell will naturally always find and execute the LPD version first if LPD is installed on the system. But LPD is of course not running, so all the commands invariably fail.
Thankfully, there are many ways to remedy this issue. Just uninstall LPD, for example. Or alternatively, you could add an alias in your .shrc file (if you use /bin/sh), like so: alias lp = “/usr/local/bin/lp”. Yet another way would be to edit your $PATH variable so that /usr/local/bin is read before /usr/bin. I guess the moral of this story is that when there’s a will, there’s a way. And also that CUPS is stupid when it comes to naming their CLI programs.