4

UPDATE

It appears the lpr in the lpr package is not the one that works with cups. The questions is, how do I get the cups version of lpr installed?

Old Question

lpr on ubuntu 10.04 includes an option "-o" that lets you pass extra options. lpr on 14.04 does not include this option.

Our application that we are moving relies on lpr and the ability to set certain options so that pages print correctly.

The command is:

lpr -P PrinterName -o orientation-requested=3 -o position=top-left
-o media=Letter -o page-left=0 -o page-right=0 -o page-top=0
-o page-bottom=0 /path/to/file.pdf

Worked fine on the old version but on the new server it fails with:

usage: lpr [-cdfghlmnpqrstv] [-#num] [-1234 font] [-C class] [-i [numcols]]
[-J job] [-Pprinter] [-T title] [-U user] [-wnum] [name ...]

So -o was removed? How do we pass options to lpr if the options option was removed?

9
  • That looks like lprng, not cups... Jun 1, 2014 at 3:39
  • which lpr shows /usr/bin/lpr. It was installed with apt-get install lpr. There is an lprng package too. On the old server the man page says "Apple, Inc" and the new one says "BSD General Commands Manual". Maybe they swapped them for licensing reasons?
    – Nick
    Jun 1, 2014 at 3:42
  • Yes, but your script depends on cups. Jun 1, 2014 at 3:44
  • But lpr is part of cups. I do have cups installed. The online man page (cups.org/documentation.php/man-lpr.html) shows the -o option still exists, so I guess the question is, how do I get the right lpr installed, the one that works with cups options?
    – Nick
    Jun 1, 2014 at 3:53
  • @Nick What does dpkg-query -S /usr/bin/lpr say?
    – kasperd
    Jun 1, 2014 at 10:19

2 Answers 2

4

I just checked a 14.04 system and it looks like you want cups-bsd.


There are a couple of commands that may be able to help you find what packages contain which files, dlocate and apt-file (probably others too).

You can also use the Ubuntu Packages Search facility which is a bit easier to use and has a cleaner output.

Ubuntu Package Search

Then the next page has the answers

The answers


All I really had to do was go ask google how to search Ubuntu packages and the answer was revealed simples.

0

TL;DR:

apt remove lpr
apt install cups-bsd

To add some context for how folks may get here:

What made this curious is that I could print a PDF with evince but Okular just failed to do anything. Launching Okular in a terminal, I kept seeing:

usage: lpr [-cdfghlmnpqrstv] [-#num] [-1234 font] [-C class] [-i [numcols]]
        [-J job] [-Pprinter] [-T title] [-U user] [-wnum] [name ...]

on the terminal with each print job. Using strace I saw:

[pid 22556] execve("/usr/bin/lpr", ["/usr/bin/lpr", "-P", "brother-color", "-#1", "-J",\
 "S500D_ADA_Health_History_2007-12415.pdf", "-o", "media=Letter", "-o", "portrait", "-o"\
, "sides=two-sided-long-edge", "-o", "outputorder=normal", "-o", "Collate=True", "-o", "\
page-left=12", "-o", "page-top=12", "-o", "page-right=12", "-o", "page-bottom=12", "-o",\
 "fit-to-page", "-o", "number-up=1", "-o", "number-up-layout=lrtb", "-o", "job-billing",\
 "-o", "job-priority=50", "-o", "job-sheets=none,none", "-o", "BRMonoColor=FullColor", "\
-r", "/tmp/okular_zNNHus.ps"], 0x7ffe5a2e69e0 /* 57 vars */ <unfinished ...>

And then working to minimize that command, I found that removing the -o options made the command not error out, which is how I wound up here. To push this out to all our desktop machines, I configured puppet like:

package { 'lpr'      : ensure=>absent    }
package { 'cups-bsd' : ensure=>installed }

I'm not quite sure how we wound up with cups installed but the wrong lpr. Sorted now and no difference noted for any other applications.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .