I have a printer that is being used for two purposes:

  • Printing of regular documents (Word, Internet pages, etc)
  • Direct printing from the command line (done by echo "text" > /dev/usb/lp0)

This all worked fine in a previous version of Ubuntu. However, recently we upgraded to 11.10 and encountered a problem. First of all, the printers are not added to /dev/usb anymore. So I can not echo to this path, and am unable to achieve printing from the command line.

After some hassle, I was able to find a workaround. This workaround was editing /etc/modprobe.d/blacklist-cup-usblp.conf. This file reads:

# cups talks to the raw USB devices, so we need to blacklist usblp to avoid
# grabbing them
blacklist usblp

After commenting this blacklisting, the device appears properly in /dev/usb, as lp0. I had a problem with the permissions of lp0, but this was solved by the answer from Luis Felipe Barrera Mora.

However, I now have one major issue to resolve. After I commenting the blacklisting, the printer stopped working when printing from Word documents. This is logical, because I disable something that CUPS needs. So basically I now only have the option to either enable regular CUPS printing and no command line printing, or I have command line printing and no CUPS printing.


For completeness: I in fact have two printers connected at the same time. One is used to print both using CUPS and the command line. The other one - an Epson receipt printer - is only used for command line printing. I've spent many days trying to get it running using CUPS but this was not possible. However, this means that the lpr command will not solve the problem, because I can not get this second printer to function under CUPS. I really need to be both able to access /etc/dev/lp0 (or a similar path) AND print using CUPS at the same time.

  • You can print from the console using the lp command. – Anonymous Nov 1 '11 at 23:31

I have the same problem, if you always add permissions to the file lp0, you must edit the printer rules:

$ gksudo gedit /lib/udev/rules.d/70-printers.rules

add [, MODE="0666"]

The file contains:

ACTION=="add", ... KERNELL="lp*" ... , MODE="0666"
  • Great, that is excellent to solve the permission problem! However, I still can not print both using CUPS and the terminal, because I need to edit modprobe.d blacklist to have the devices appear in /dev/usb. Any idea? – user6019 Nov 10 '11 at 16:51
  • Rather that flipflopping the permissions back and forth, I strongly suggest that you work to getting the receipt printer working with CUPS, and abandon the >/dev/lp0. CUPS gives you spooling, queueing, the ability to reprint jobs, and is the modern way to manage printers. – waltinator Nov 17 '11 at 1:00
  • Upvoted this answer because usually printing to the device itself is preferred in retail environments with receipt printers. The extra processing/queuing time is a real problem and cutting out CUPS can save a lot of people some hassle in waiting for the cashier. There are times you want to go through CUPS (when sharing the printer between apps or users) but not in the typical retail setting. – Chris Travers Oct 28 '13 at 5:56

Why don't you use lpr to print form the command line? Like:

echo "text" > /tmp/someFileName
lpr -P YourPrinter /tmp/someFileName

It's a workaround, but should be an easy way to do what you want without changing some permissions...

  • The problem is that one of the printers is not recognized by CUPS (this is a receipt printer), so I think it will not appear when using lpr. I will try this afternoon though. – user6019 Nov 12 '11 at 12:39
  • Ah, ok. Did not get that point. But maybe it's possible to make it work with CUPS. – user5950 Nov 12 '11 at 14:33
  • You said that it is only one printer and it used to work with CUPS, yes? If that is the case, I would, as user155533, put everything back the way it originally was and use lpr. Otherwise, I'd edit your question so it is clearer what you need. – zpletan Nov 14 '11 at 13:09
  • @zpletan: there are indeed two printers involved. One does and one does not work with CUPS. It did not matter for the original question but with these answers it does, so I'll update the question. – user6019 Nov 15 '11 at 13:16

Open a web browser to http://localhost:631/ to configure CUPS. You should be able to print from the command line via echo "text" | lpr. Use lpstat -t to see all of CUPS' status information, lpstat -d to see the system's default printing destination, man lpstat for more, man lpr for specifying which printer.

All printing should go via CUPS - it manages queues, printers, ...

  • You can add ANY printer (even serial port printers) via CUPS at http://localhost:631. You'll have to enter your username and password, but it's easy, and you can easily Modify the printer later. – waltinator Nov 14 '11 at 21:28
  • I don't actually agree with running receipt printers through CUPS as a general matter of course. Usually you don't need to share the printer (one printer per terminal), and the extra time in spooling is more time folks spend in line waiting for the cashier. Even if it is only 5 seconds, that is significant if you have 10 people in line (it adds a minute to the wait). There are times (for example kitchen printers in restaurants) where you want to do this but it is the exception, not the rule. – Chris Travers Oct 28 '13 at 5:54
  • I understand your problem now, @Chris. I did find a couple of sites with explanations that may lead you to a solution. One is for SUSE Linux, link but Linux == Linux. The other talks about using Samba for POS printers, link But, I don't see how you can use/manage the same printer with AND without CUPS at the same time. 2 printers, one with CUPS and one without seems doable (YMMV). – waltinator Nov 4 '13 at 16:02

You could try adding it as a "Raw" printer in CUPS. I'm not sure if it works, but it's worth a try.

You'll have to re-blacklist usblp for this. Add the Epson to CUPS, select "Generic" as manufacturer and "Raw Queue" as device. Additionally you might have to use lpr -o raw filename to print something.


I am facing something similar. What I have opted to do is to ensure that the only the receipt printer is connecting over USB (the general purpose printer will connect over a network interface). This allows me to remove the blacklisting, print directly to the device, and use CUPS for the network printer.

This isn't really optimal. It would be really nice to be able to connect all devices through USB and then select which ones we didn't want usblp to grab. However, in the mean time, this seems to be the best option. It may not be what you want to hear, but it is the only way I have found out.

Now for general readers the reason why receipt printers are not usually connected to through CUPS is that in retail environments is that here speed is of the essence, and concurrency not a factor. You don't need printer management, queue management, and the like. What you really need is that when it prints, it prints right away. Not in a few seconds, but right away. Every few seconds you can shave off the workflow is seconds that each person in line is not waiting. Multiply by line length, and you see the problem. Hence performance every step of the way is critically important and since you typically have one receipt printer, and it is usually printing only for the point of sale application, CUPS costs far more than it offers.

This is not to say there aren't environments where you'd set it up through CUPS. Restaurants tend to have similar printers in their kitchens and the concurrency issues there are significant, so you'd use CUPS there. However it is not always the best tool for the job and retail receipt printers do not follow the same assumptions that CUPS follows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy