# CUPS will only print from Open Office



## wmichaelb (Oct 31, 2010)

I've been digging into this over the last few days. I'm running FB FreeBSD 7.3, and have CUPS installed. I can print a test page from the CUPS web page, or from Open Office Writer. But I cannot print from anything else -- Firefox, Abiword, Evince, etc. etc. etc. All have a printer reference to LPR, but not to LJ2420DN. I'm assuming that this infers a problem with LPR. I've gone through the printer settings below:

rc.conf:


```
# -- sysinstall generated deltas -- # Sat May 22 10:46:20 2010
# Created: Sat May 22 10:46:20 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname=".zoomtown.com"
ifconfig_re0="DHCP"
linux_enable="YES"
moused_enable="NO"
sshd_enable="YES"
# -- sysinstall generated deltas -- # Sat May 22 21:15:34 2010
moused_type="auto"
moused_enable="YES"
gnome_enable="YES"
sound-support snddetect_enable="YES"
cupsd_enable="YES"
devfs_system_ruleset="system"
```

printcap:


```
#	@(#)printcap	5.3 (Berkeley) 6/30/90
# $FreeBSD: src/etc/printcap,v 1.14.32.1 2010/02/10 00:26:20 kensmith Exp $

#
# This enables a simple local "raw" printer, hooked up to the first
# parallel port.  No kind of filtering is done, so everything you pass
# to the "lpr" command will be printed unmodified.
#
# Remember, for further print queues you're going to add, you have
# to choose different spool directories (the "sd" capability below),
# otherwise you will greatly confuse lpd.
#
# For some advanced printing, have a look at the "apsfilter" package.
# It plugs into the lpd system, allowing you to print a variety of
# different file types by converting everything to PostScript(tm)
# format.  For more information about apsfilter visit
#
#	     [url]http://www.apsfilter.org/[/url]
#
# If you don't have a PostScript(tm) printer, don't panic, but do
# also install the latest "ghostscript" package for best printer support.
#
# Do also refer to the "printing" section of the handbook.
#
#	[url]http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing.html[/url]
#
# A local copy can be found under
#
#	/usr/share/doc/handbook/handbook.{html,latin1}.
#
# Banner pages are now suppressed by default.  Remove the :sh: capability
# to turn them back on.
#
#lp|local line printer:\
#	:sh:\
#	:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
#
# Sample remote printer.  The physical printer is on machine "lphost".
# You can perform any kind of local filtering directly.  If you need
# local filters (e.g. LF -> CR-LF conversion for HP printers), create
# a filter script that sends the proper escape sequence to the printer
# and then concatenates stdin to stdout.
#
#remote|sample remote printer:\
#	:sh:\
#	:rm=lphost:sd=/var/spool/output/lphost:lf=/var/log/lpd-errs:\
#	:if=/usr/local/libexec/if-script:
#
# Simple Russian printer with hardware CP866 character set, output filter
# used for KOI8-R -> CP866 conversion
#
#lp|Russian local line printer:\
#	:sh:of=/usr/libexec/lpr/ru/koi2alt:\
#	:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
```

Do I need to add an lpr stack to printcap? What puzzles me is that the system works with Open Office.

Any and all suggestions are welcome, and thank you.


----------



## wblock@ (Oct 31, 2010)

That's the standard /etc/printcap.  AFAIK CUPS needs a different setup: CUPS on FreeBSD.


----------



## wmichaelb (Nov 2, 2010)

wblock: thanks again for your interest. The article states that one must add the following to /etc/devfs.rules:


```
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
```

And then to add the following two lines to /etc/rc.conf:


```
cupsd_enable="YES"
devfs_system_ruleset="system"
```

Based on another article, I also added


```
lpd_enable="NO"
```

The article then sends one on to install a printer. I have done these things very carefully, but to no avail. What else needs to be done?

As an aside, when I restart devfs.rules, I get an error message:


```
/etc/rc.d/devfs restart
sound-support: not found
```

although the sound chip on my mother board is happily playing music as I do so. Is this a clue? Somewhere, something isn't initialized or linked, and I don't know where to look next.

Thanks in advance!


----------



## wblock@ (Nov 3, 2010)

wmichaelb said:
			
		

> Based on another article, I also added
> 
> 
> ```
> ...



Show your entire /etc/devfs.rules.


----------



## wmichaelb (Nov 3, 2010)

wblock: My entire /etc/devfs.rules file is as follows:

```
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
```

Please advise, and thanks again!


----------



## wblock@ (Nov 3, 2010)

I was guessing there was an extra line with "sound-support" in that file, but no.  You can search for it (as root):
`# grep -ir sound-support /etc/*`


----------



## wmichaelb (Nov 3, 2010)

wblock: You may be on to something. The results of that search are:

```
/etc/rc.conf:sound-support snddetect_enable="YES"
/etc/rc.conf~:sound-support snddetect_enable="YES"
```

Do I need to eliminate one and/or put such a line into devfs.rules?


----------



## wblock@ (Nov 3, 2010)

wmichaelb said:
			
		

> wblock: You may be on to something. The results of that search are:
> 
> ```
> /etc/rc.conf:sound-support snddetect_enable="YES"
> ...



That line in rc.conf is wrong... probably should be

```
# sound-support
snddetect_enable="YES"
```

That may be obsolete, and shouldn't affect devfs.rules anyway.


----------



## wmichaelb (Nov 3, 2010)

wblock: well, that fixed my sound system error messages, and Rythmbox now plays last.fm, which it did not before. Weird.

But there's no change in printer availability. I'm wondering if the problem lies in the interface between CUPS and GTK; is there a file or flag that needs to be set there somewhere?

Thanks for all your time and help!


----------



## wmichaelb (Nov 5, 2010)

*CUPS will now finally print from the rest*

wblock: after considerable searching under different word sorts, I found this:

http://forums.freebsd.org/showthread.php?t=4355

which was another user with a similar problem. He said:



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



I tried that, and now Firefox, Evince, and Abiword all print via the lpr choice. 
How do we go about documenting this in the handbook?


----------



## wblock@ (Nov 5, 2010)

Sorry, thought the alternate CUPS binaries had been mentioned already.  Another thread...

The problem with moving the real lpr so the CUPS lpr is found is that the next time you update FreeBSD, it will put the real lpr right back.  The CUPS article shows a workaround in section 7.

You could contact the author of the CUPS article if the base lpr/CUPS lpr issue isn't in there.  (I didn't look very much.)


----------



## wmichaelb (Nov 6, 2010)

wblock: I appreciate your patience and persistence with me in this situation.

I've used Windows, Linux, and Mac OSX over the last few years, and I'm not uncomfortable working with the command line, but I'm a relative newbie to BSD. As I read the link above, I think I see that I need to recompile the system to get the LPR/CUPS changes (symfile links, etc.) to take effect. Is that true? If I do a MAKEWORLD, will that update the system to 8.1, or only if I tell it to do so? I'm not afraid to try this; the system I'm working on is one that I use only for learning about BSD, and there is no data at risk. Is there something I should have done at install to prevent these issues?

Thanks again!


----------



## MarcoB (Nov 6, 2010)

After installation of CUPS I think you should go to http://localhost:631/ and configure your printer there. CUPS has a web interface.


----------



## wblock@ (Nov 6, 2010)

No, you don't need to rebuild.  The article just shows settings that will a) make sure CUPS is used with ports, b) install the CUPS binaries (or links to them) over the base system lpr/lpd, and c) build the base system without lpr/lpd.

If you don't add those settings, a future rebuild could cause printing to mysteriously stop.


----------



## jb_fvwm2 (Nov 6, 2010)

The install-cups issue is different from rebuilding the kernel and/or upgrading.  The former can unless one is prepared be complicated/undone by the latter.  One can grep the cups-base or cups ports pkg-plist for files in a "bin" subdirectory and rename the native bsd ones to .bak before install, for example.
...

TWO posts were quicker than I posted.


----------



## wmichaelb (Nov 8, 2010)

But in order for the system to pay attention to the new entries in /etc/make.conf as noted in section 7 of the CUPS manual, won't I have to deinstall CUPS and recompile/reinstall it from the port? Or is there somewhere else I need to add those entries?

Thanks, I know it's a newbie question.


----------



## wblock@ (Nov 8, 2010)

wmichaelb said:
			
		

> But in order for the system to pay attention to the new entries in /etc/make.conf as noted in section 7 of the CUPS manual, won't I have to deinstall CUPS and recompile/reinstall it from the port?



Not really, because you've already done manually what those options automate.  Reinstalling CUPS won't hurt anything, and will actually show that those options are working.


----------



## wmichaelb (Nov 12, 2010)

wblock: where I am now is as follows:

1.) I reinstalled CUPS, and as you suggested, and that made no difference.

2.) I can print from LPR in Firefox and Evince, but with very limited functionality: no full duplex, and none of the other controls that the Postscript PPD offers in Open Office and my other distros. It prints one side only. 

So somehow, LPR isn't accessing the full CUPS driver. I've installed every foomatic and other CUPS file I can find that seems appropriate, and I can easily print a test page from CUPS and from Open Office. The latter gives me access to the full functionality of the printer. All the foomatic files are in fact in /usr/local/bin/, although CUPS itself is not. Is there any other file reference to CUPS that I need? 

Thanks again.


----------



## wblock@ (Nov 12, 2010)

It could just be that those applications don't implement a way to set the additional options.  But I don't use CUPS, so that's just a guess.


----------

