# CUPS Configuration for Networked Printer



## rtwingfield (Feb 18, 2011)

I have a networked printer (HPLaserJet6P) that is accessed via a NetGear FVX538VPN router and a D-Link DP-301P+ parallel port mini print server, addressed on the LAN as 192.168.1.10.  All MS/Windows work stations attached to the LAN can print via this printer.

I've recently installed (on FreeBSD v7.2) and attempted to configured *CUPS* to route to this printer, but with no success.  I HAVE followed CUPS on FreeBSD, _et al_, but nothing is delivered to the printer.  All attempts to print a test page result in the job spooling _something_, but the printer immediately goes to Paused state and the CUPS print job is displayed as follows:

```
HPLaserJet6P-22  Test Page  rtwingfield  1k  Unknown([I]# of pages[/I])  pending since Thu Feb 17 18:07:21 2011 
"/usr/local/libexec/cups/filter/bannertops failed"
```

If I hold or cancel the printer job, then I can click "Resume Printer" and the CUPS printer manager will display "HPLaserJet6P (Idle, Accepting Jobs, Shared, Server Default)".

I also have LPD loaded and the following command line status inquiry indicates:

```
# lpstat -p -d
printer HPLaserJet6P is [B]idle[/B].  enabled since Thu Feb 17 18:48:18 2011
system default destination: HPLaserJet6P
```
If I Pause the printer via the CUPS printer manager, then the status is:

```
# lpstat -p -d
printer HPLaserJet6P [B]disabled[/B] since Thu Feb 17 18:57:28 2011 -
        Paused
system default destination: HPLaserJet6P
```
. . .so apparently the lpd is aware of the printer's status.


The content of *[font="Courier New"]/usr/local/etc/cups/printers.conf[/font]* is: 
	
	



```
# Printer configuration file for CUPS v1.4.6
# Written by cupsd on 2011-02-17 18:57
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<DefaultPrinter HPLaserJet6P>
Info HP LaserJet 6P
Location 9 Woodberry
MakeModel HP LaserJet 6P/6MP - PostScript
DeviceURI http://192.168.1.10:631
State Stopped
StateMessage Paused
StateTime 1297990648
Reason paused
Type 8425540
Filter application/vnd.cups-raw 0 -
Filter application/vnd.cups-command 0 commandtops
Filter application/vnd.cups-postscript 0 -
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
AllowUser root
AllowUser rtwingfield
OpPolicy default
ErrorPolicy stop-printer
</Printer>
```

It appears that the *cupsd.conf* scenario has generated a reasonable printer configuration...?  I can ping the printer(server) from the command line (i.e., ping 192.168.1.10) but apparently CUPS is not happy with the configuration.

*EDIT UPDATE:*  I have changed the debug level from *debug2* to *warn* . . .reduced the clutter and have found the following in the error log:

```
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[21]="CONTENT_TYPE=application/vnd.cups-banner"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[22]="DEVICE_URI=http://192.168.1.10:631"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[23]="PRINTER_INFO=HP LaserJet 6P"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[24]="PRINTER_LOCATION=9 Woodberry"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[25]="PRINTER=HPLaserJet6P"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[26]="CUPS_FILETYPE=document"
D [17/Feb/2011:21:53:15 -0600] [Job 27] envp[27]="FINAL_CONTENT_TYPE=application/vnd.cups-postscript"
[color="Red"]D [17/Feb/2011:21:53:15 -0600] [Job 27] Started filter /usr/local/libexec/cups/filter/bannertops (PID 1849)
D [17/Feb/2011:21:53:15 -0600] [Job 27] Started filter /usr/local/libexec/cups/filter/pstops (PID 1850)
D [17/Feb/2011:21:53:15 -0600] [Job 27] Started backend /usr/local/libexec/cups/backend/http (PID 1851)
D [17/Feb/2011:21:53:15 -0600] [Job 27] /libexec/ld-elf.so.1: [B]Shared object "libjpeg.so.9" not found[/B], required by "libtiff.so.4"[/color]
D [17/Feb/2011:21:53:15 -0600] [Job 27] STATE: +connecting-to-device
D [17/Feb/2011:21:53:15 -0600] [Job 27] Looking up "192.168.1.10"...
D [17/Feb/2011:21:53:15 -0600] [Job 27] Copying print data...
D [17/Feb/2011:21:53:15 -0600] [Job 27] backendRunLoop(print_fd=-1, device_fd=6, snmp_fd=5, addr=0x20201154, use_bc=0, side_cb=0x5520)
[color="Red"]D [17/Feb/2011:21:53:15 -0600] [Job 27] Backend returned status 1 (failed)
D [17/Feb/2011:21:53:15 -0600] [Job 27] Printer stopped due to backend errors; please consult the error_log file for details.[/color]
D [17/Feb/2011:21:53:15 -0600] [Job 27] End of messages
D [17/Feb/2011:21:53:15 -0600] [Job 27] printer-state=5(stopped)
D [17/Feb/2011:21:53:15 -0600] [Job 27] printer-state-message="Empty print file!"
D [17/Feb/2011:21:53:15 -0600] [Job 27] printer-state-reasons=paused
E [17/Feb/2011:21:58:16 -0600] [Job 27] Stopping unresponsive job!
W [17/Feb/2011:22:16:37 -0600] Max clients reached, holding new connections...
```
I installed CUPS using the CUPS meta port.  During the install, I deselected most of the support for printers that I don't have or never plan to purchase (brand names/models, etc.); otherwise, the defaults were left _as-is_.  The log entry, "Shared object "libjpeg.so.9" *not found*", is obviously a red flag.

I've just _Googled_ and found this thread:  http://forums.freebsd.org/showthread.php?t=5906

Seem like the Makefile should check for such things? !!!  . . .regardless, I have effectively symlinked as follows (. . .for better or worse, as suggested in the previous referenced thread):

```
# ln -s /usr/local/lib/libjpeg.so.11 /usr/local/lib/libjpeg.so.9
```
 . . .and the jpeg and filter issues have been resolved.

Never-the-less, CUPS still does not actually recognize the printer via the LAN.  I can turn-off the printer and the CUPS system will still let me toggle the printer status, i.e., paused or idle.  The logs state that the printer is connected, and "*lpstat -p -d*" indicate the same, yet nothing is printed.  I've created a custom service in the NetGear FVX535 VPN router for CUPS assoc/w port 631, and set "allow always" for both inbound and outbound traffic.  (As I've mentioned before, I can print to this device from a MS/Windows workstation.)  I'm going to call D-Link Support and ask if they have any knowledge of this scenario.

UPDATE 20-FEB-2011:  D-Link wasn't much help.  Their attitude, position . . .whatever, is that FreeBSD and CUPS are third party products that they don't support.  This is contradictory to what is printed on the D-link product box that advertises under minimum system requirements, a computer with Unix/Linux, or MS/Windows Vista, XP SP2, 2000 SP4, NT, and Mac OS with Apple Talk.

Also, I have connected an old Epson ActionLaser Plus printer to the FreeBSD's parallel port and can print to it via CUPS, but the formatting is not correct (driver problem?).  I installed gutenprint but the closest available drivers are Epson ActionLaser II, and HP LaserJet2.  As I learn more about gutenprint, I'll probably be able to resolve the driver/formatting problem; never-the-less, I'm encouraged that I can print _something_ via the CUPS client.



Suggestions will be greatly appreciated


----------



## rtwingfield (Feb 21, 2011)

*Cups Network Printer Configuration for D-Link Mini Print Server*

I have resolved the CUSP network-printer-server configuration associated with a D-Link DP-301P+ mini print server.  I was focused on configuring the printer (HPLaserJet6P) by using IPP (Internet Printing Protocol) with a URL address described as http://192.168.1.10 . . .without success.  I finally happened on this in the CUPS documentation:  Network Protocols Supported by CUPS

```
[B]Table 1: Common Device URIs[/B]
 
[U]Model/Manufacturer  	Device URI(s)[/U]

DLink DP-301P+  	socket://address
```

I was surprised to see the D-Link mini-server listed as a socket device.  I was so "target fixed" on trying to address the HP printer with the TCP/IP ip address of the D-Link mini-server . . after all, I could ping it, that I just didn't see the device URI listed as a socket-address scenario.  I added a printer definition for the device as:

```
socket://192.168.1.10
```
. . .selected the HP LaserJet 6P driver, and the cupsd is happy 

This is typical displayed printer information:

```
[U]
dlink (Idle, Accepting Jobs, Shared)[/U]
Description:	D-Link DP-301P+ mini print server
Location:	9 Woodberry LAN
Driver:	HP LaserJet 6P - CUPS+Gutenprint v5.2.4 (grayscale, 2-sided printing)
Connection:	socket://192.168.1.10
Defaults:	job-sheets=none, none media=na_letter_8.5x11in sides=one-sided
```
I named the printer *dlink*, rather than something like *hplaserjet6p*.  My thought is to be able to change the physical printer attached to the D-Link print server (perhaps at some point in the future), reconfigure the D-Link server with the appropriate printer info. and then update the CUSPS printer definition.  The printer test page produced by CUPS identifies the driver as *STP01368.PPD* . . .not the HP driver that I expected; regardless, it works (it's magic).

All said, I'm encouraged that the CUPS _Print Test Page_ request accessed from the printer maintenance drop-down menu is successful . . .something that the D-Link 2nd. Level Tech Support said was not supported.  Now the remaining issue is to configure for printing to the CUPS spooler from (for example) the command line.  If I request something like 
	
	



```
# lpr -P dlink example.txt
lpr: dlink: unknown printer
```
. . .well, you see the results.

OTTF


----------



## wblock@ (Feb 21, 2011)

rtwingfield said:
			
		

> ```
> D [17/Feb/2011:21:53:15 -0600] [Job 27] /libexec/ld-elf.so.1: [B]Shared object "libjpeg.so.9" not found[/B], required by "libtiff.so.4"[/color]
> ```
> The log entry, "Shared object "libjpeg.so.9" *not found*", is obviously a red flag.
> ...



It's an emergency measure to get things running temporarily.  The problem is still lurking there, just waiting to spring out like a streaker at a sporting event.

What caused it?  When a library changes in a way that's incompatible with the old version, the version number is bumped.  That forces everything that depends on it to be rebuilt to use the new version.  Possibly the rebuild could be automated, but usually there's just a notice in /usr/ports/UPDATING along with instructions on how to get the update done.

jpeg is certainly one of the libraries that has been bumped several times in recent history; see UPDATING.

How do you fix it?  Following the UPDATING instructions long after the fact can be a mixed bag.  The "rebuild everything" procedure from the end of the ports-mgmt/portmaster man page (portmaster(8)) is another approach.

Final note: CUPS cleverly gives some of its programs the same names as traditional ones, like "lpr".  So you have two lpr programs, the BSD one in /usr/bin/lpr, and the CUPS version in /usr/local/bin/lpr.  Get the wrong one, and it'll be confused.  There are ways around this, like deleting the BSD versions, or linking the CUPS versions over them.  I prefer to take the novel approach of not installing CUPS and just using the BSD printing system.  Here's my article on that: lpd Printing With FreeBSD


----------



## rtwingfield (Feb 21, 2011)

*BSD's /usr/bin vs. CUPS's /usr/local/bin Versions of lpr*

Thank you . . .*THANK YOU!*  This is precisely the nuance that I've been struggling for:





> Final note: CUPS cleverly gives some of its programs the same names as traditional ones, like "lpr". So you have two lpr programs, the BSD one in /usr/bin/lpr, and the CUPS version in /usr/local/bin/lpr. Get the wrong one, and it'll be confused. There are ways around this, like deleting the BSD versions, or linking the CUPS versions over them. I prefer to take the novel approach of not installing CUPS and just using the BSD printing system. Here's my article on that: lpd Printing With FreeBSD


Geeze! . . .where in the documentation is that noted?  I've lost sooo much time loading and deleting spooled files from the lpd's spooler.  I'm talking four man-days lost.  x(   I just executed: 
	
	



```
/usr/local/bin/lpr printtest
```
. . .and almost jumped out of my chair when the networked "dlink" printer started  :beergrin

Two different sets of programs !!!  This nuance *SHOULD* be noted in the CUPS documentation!  I have a friend who frequently says, "This will make perfect sense . . .once I understand it."   . . .so true.

Also, your comments regarding the symlink:
	
	



```
# ln -s /usr/local/lib/libjpeg.so.11 /usr/local/lib/libjpeg.so.9
```
. . .noted and appreciated.


----------

