# Printing with cups just works partly



## fred6633 (May 27, 2009)

Hello,
I have installed a printer with cups.
The test page prints fine.
Also some applications like Firefox and Galeon prints fine.

However, in some apps, like gedit, the cups printer doesn't even show up in the print dialog.

In these apps there are two options: print to a file or print to lpr. If I select lpr I get a broken pipe error.

I found that these apps use the lpr command in /usr/bin. This command uses lpd

The lpr command that uses cups is in /usr/local/bin.

So If I change the command to /usr/local/bin/lpr -P HP in gedit, even this app prints fine.

Is there a way to save this command, so I don't every time I print from gedit have to change the commande from "lpr" to "/usr/local/bin/lpr -P HP"

Thanks

Fred


----------



## graudeejs (May 27, 2009)

`$ ln -s  /usr/local/bin/lpr /usr/bin/lpr`
I think this should do the trick (if i understand you correctly)

another way is to create simple sh script, that would call /usr/local/bin/lpr with all the arguments needed


----------



## Oko (May 27, 2009)

killasmurf86 said:
			
		

> `$ ln -s  /usr/local/bin/lpr /usr/bin/lpr`
> I think this should do the trick (if i understand you correctly)
> 
> another way is to create simple sh script, that would call /usr/local/bin/lpr with all the arguments needed



That is a very, very bad suggestion! /usr/bin/lpr is lpr command of LPD spooling system. /usr/local/bin/lpr is CUPS command. He needs to move /usr/bin/lpr to /usr/bin/lpr.bak and then only then make the suggested soft link. There are 3 others commands lpq, lprm, lpc, that also needs to be backed up and replaced with cups commands.

After CUPS installation on OpenBSD the message is posted to the 
screen asking you to execute a small script which will do replacing LPD commands with CUPS commands. You should contact FreeBSD ported of CUPS and ask to fix the damn port. That is completely undocumented thing in FreeBSD.


I suspect though that original post complains also about inability to print from applications. That is not the CUPS problem that is the problem of the people who ported those applications and didn't compile them with correct paths to LPD or CUPS.


----------



## roddierod (May 27, 2009)

Oko said:
			
		

> After CUPS installation on OpenBSD the message is posted to the
> screen asking you to execute a small script which will do replacing LPD commands with CUPS commands. You should contact FreeBSD ported of CUPS and ask to fix the damn port. That is completely undocumented thing in FreeBSD.



There was a port called cups-lpr that did this, but it looks as if it was removed. Not sure if it was merged into the cups base.


----------



## fred6633 (May 27, 2009)

Thanks all,

My Unix skills are limited though.

The print dialog must have a configuration file somewhere. If I could edit that file and change the print command from "lpr" to "/usr/local/bin/lpr -P HP" so would that do the trick.

It seems to be the Gnome apps that use this print dialog. Firefox and Galeon use another dialog.

Thanks

Fred


----------



## fred6633 (May 27, 2009)

Hello again,
The solution was extremely simple:
mv /usr/bin/lpr /usr/bin/lpr.bak

That's all.

When the app doesn't find lpr in /usr/bin/, it looks in /usr/local/bin/.

Thanks

Fred


----------



## kenorb (Oct 22, 2010)

#6 helped, thanks!
Now even printer does work.
Is there any way to make it working by default, not by each time hacking some services by hand?
I'm installing Desktop and assuming that it work with all services like printers, etc.
Raised related post with different approach.


----------



## fronclynne (Oct 22, 2010)

Have you tried changing the search order of your $PATH?  (I don't know if gedit, _et al_ inherit $PATH, or from where, but it might be worth looking into)


----------

