# FreeBSD 9.0 + CUPS + HPLIP + HP Deskjet F2200 = no success yet.



## nickednamed (Jul 12, 2012)

I am using FreeBSD 9.0 + CUPS + HPLIP + HP Deskjet F2200. I have compiled everything from ports, found my printer via the CUPS web interface, all without any obvious problems.

However, when I click "Print test page" nothing happens. Here is what /var/log/cups/error_log says:

```
X [12/Jul/2012:15:26:18 +0200] kevent() returned Bad file descriptor
E [12/Jul/2012:15:41:34 +0200] Returning IPP client-error-not-authorized for Print-Job.
```
Here are the contents of my /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
add path 'usb*' mode 0770 group cups
add path 'ugen*' mode 0660 group cups

#the following didnt work either
#add path 'usb/3.2' mode 0660 group cups
```

Both my root and regular users are members of the cups and wheel groups.

I am starting *cupsd* and my devfs(8) ruleset at startup:

```
#invoke local devfs rule
devfs_system_ruleset="system"
#start cups
cupsd_enable="YES"
```
I have read CUPS on FreeBSD numerous times. What am I missing?

Any help would be greatly appreciated.


----------



## nickednamed (Jul 12, 2012)

Oh and I should have mentioned that my /var/log/cups/access_log says:

```
localhost - - [12/Jul/2012:16:27:07 +0200] "POST /printers/HP_Deskjet_F2200_series HTTP/1.1" 200 464 Print-Job successful-ok
```

And sorry for the lack of formatting, I am writing using elinks, and I haven't worked out how to do formatting with it yet :/


----------



## TheDreamer (Jul 13, 2012)

I think its /usr/local/etc/cups/cupsd.conf


```
# Restrict access to the server...
<Location />
  Order allow,deny
</Location>
```

Try adding an Allow your subnet to this section.


----------



## nickednamed (Jul 13, 2012)

Sorry, this might seem dumb, but I'm quite bad at networking:

What exactly is my subnet?

`% ifconfig`

```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether b0:48:7a:d0:df:c9
inet6 fe80::b248:7aff:fed0:dfc9%wlan0 prefixlen 64 scopeid 0xa 
inet 192.168.1.8 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
status: associated
ssid DumbDumb channel 1 (2412 MHz 11g) bssid f4:3e:61:29:8e:08
regdomain 32924 country CN indoor ecm authmode WPA2/802.11i
privacy ON deftxkey UNDEF TKIP 2:128-bit txpower 20 bmiss 7
scanvalid 450 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
roam:rate 5 protmode CTS wme burst roaming MANUAL
```

And after looking at /usr/local/etc/cups/cupsd.conf I can see that

```
# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
</Location>
```

doesn't stop me from viewing the admin pages, so I'm wondering if it is the problem which you suggest.

As soon as I work out my subnet, however, I will try what you've suggested.

Thanks


----------



## SirDice (Jul 13, 2012)

Looking at your ifconfig(8) output your subnet is 192.168.1.0/24.


----------



## nickednamed (Jul 13, 2012)

Thanks for the subnet. I'll be sure to go and work out how you worked that out 

I've added

```
# Restrict access to the server...
<Location />
  Allow 192.168.1.0/24
  Order allow,deny
</Location>
```

to my /usr/local/etc/cups/cupsd.conf

then

`% /usr/local/etc/rc.d/cupsd restart`

After that, I tried once again to print a test page, but nothing. Here is what's written in /var/log/error_log:


```
X [13/Jul/2012:11:16:32 +0200] kevent() returned Bad file descriptor
```

In /var/log/access_log it just says "print job successful" or something like that.


----------



## JimW (Jul 14, 2012)

Is it safe to assume that you have Foomatic (Foomatic filters) installed? I can't remember if CUPS automatically installs it.

Well anyway .... try this ....

See if you have a /usr/local/etc/foomatic directory. If so, take a look at the file filter.conf.

Edit it to make sure that the following line is uncommented...


```
cupsfilterpath: /usr/local/lib/cups/filter:/usr/local/lib/cups/filter:/usr/local/libexec/cups/filter:/opt/cups/filter:/usr/lib/cups/filter
```

Save the file, then restart CUPS again.

See if that works. If it doesn't, post your complete /usr/local/etc/cups/cupsd.conf file.


----------



## TheDreamer (Jul 14, 2012)

Might check to see that all the settings match between your computer and the printer.  I have a brother all-in-one...and its set with US Letter size pages.  But, when I built things from ports the first time, I didn't catch that you have to pick US Letter size in some of the configuration screens.  And, my printer will just quietly accept print jobs for wrong size paper and give no indication of error.

The other possibility is that the printer is advertising capabilities it doesn't have.  Since my printer is physically the same as a higher end model, but the firmware makes it the lower-end model.  It stumped me that my printer was reporting that it was capable of Postscript, when it wasn't.  Again, it would just quietly /dev/null things sent to its IPP/Postscript queue....

The Dreamer.


----------



## nickednamed (Jul 14, 2012)

I have uncommented the line you mentioned, restarted cupsd, and tried again, but no luck.

And I am pretty sure my printer is capable of printing a test page. It was working under PC-BSD with HPLIP and CUPS.

The /var/log/error_log syill shows:


```
X [14/Jul/2012:15:41:00 +0200] kevent() returned Bad file descriptor
```

and my /var/log/access_log still shows:


```
ocalhost - - [14/Jul/2012:15:46:01 +0200] "POST /printers/HP_Deskjet_F2200_series HTTP/1.1" 200 464 Print-Job successful-ok
```

So here is my cupsd.conf


```
#
# "$Id: cupsd.conf.in 9407 2010-12-09 21:24:51Z mike $"
#
# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
# complete description of this file.
#

# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn

# Administrator user group...
SystemGroup wheel


# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols CUPS

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Web interface setting...
WebInterface Yes

# Restrict access to the server...
<Location />
  Allow 192.168.1.0/24
  Order allow,deny
</Location>

# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>

# Set the default printer/job policies...
<Policy default>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    Order deny,allow
  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

# Set the authenticated printer/job policies...
<Policy authenticated>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Default
    Order deny,allow
  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

#
# End of "$Id: cupsd.conf.in 9407 2010-12-09 21:24:51Z mike $".
#
```


----------



## TheDreamer (Jul 16, 2012)

Well, I guess since it was only listen localhost:631, the Allow 192.168.1.0/24 was unnecessary.

Though you first reported the message:


```
E [12/Jul/2012:15:41:34 +0200] Returning IPP client-error-not-authorized for Print-Job.
```

Which made me think that it was an IP restriction.

I think print/hplip includes print/foomatic-filters as a dependency.

An HP Deskjet F2200 is USB only right?  Having a hard time finding out what the specs are on it online.  Personally, I'm using an HP Photosmart 8450xi...but I'm using its network interface....oh, and I'm using the HP Photosmart 7550 driver in CUPS.

How do you have you're printer configured in CUPS?

Also how does the printer show up?  ugen or ulpt

Seem to recall that it has to be ugen, which meant you couldn't use the GENERIC kernel.

The Dreamer


----------



## nickednamed (Jul 19, 2012)

Thanks for the continuing help and support! Perhaps the 
	
	



```
Allow 192.168.1.0/24
```
 was unnecessary, but thanks anyway. I haven't had that IPP client error again, it may have been something that happened when I tried reinstalling the printer.

And at the risk of creating a wave of facepalms and anger, I have to say I was told that HPLIP could be used with the GENERIC kernel on FreeBSD 9.0, and that the HPLIP documentation [which I have read, I promise!] was simply out-of-date.

So yes, I am using the GENERIC kernel. I guess I'll get on and recompile my kernel then, as soon as my blood returns from my face to my fingers, that is.


----------



## TheDreamer (Jul 19, 2012)

nickednamed said:
			
		

> And at the risk of creating a wave of facepalms and anger, I have to say I was told that HPLIP could be used with the GENERIC kernel on FreeBSD 9.0, and that the HPLIP documentation [which I have read, I promise!] was simply out-of-date.



Well, that could be the case.  I don't have a USB printer handy to try at the moment.  Though seems finding a new network AIO inkjet printer that'll print onto CDs is hard.


----------



## kpa (Jul 19, 2012)

Where do you get this information that you need to recompile the kernel to use an USB printer with CUPS? And what kind of changes do you need to do the kernel configuration? To me it sounds like bogus information.


----------



## nickednamed (Jul 20, 2012)

I have no information as to whether CUPS requires kernel modification, but I have read in many places including http://freebsd.kde.org/howtos/hplip.php that HPLIP requires such modification.

The HPLIP documentation has it somewhere, although I can't find it now. If I do, I will edit this post. There are also warning message following the installation of HPLIP.

However, as I said, I am now unclear as to the accuracy of even the documentation of HPLIP. Once I connected my PC I got a message to the effect:


```
ugen3.2: <HP>
ulpt0: <HP Deskject F2280>
```

Or something very similar, which was in line with what I was told - specifically that FreeBSD 9.0 can be configured to set the printer as ugen without removing ulpt from the kernel.

I may be very wrong on this.


----------



## tingo (Jul 20, 2012)

For HPLIP, you are correct: your printer needs to be a ugen device. The newest / newish usb stack provides multiple nodes for usb devices, to aid in scenarios where more than one driver would like to use a device. If that came with 9.0 or eometime in 8.x, I can't remember.
What happens if you do
`$ ls -l /dev/ugen3.2 /dev/ulpt0`
do they point to the same device / link?


----------



## nickednamed (Jul 21, 2012)

tingo said:
			
		

> For HPLIP, you are correct: your printer needs to be a ugen device. The newest / newish usb stack provides multiple nodes for usb devices, to aid in scenarios where more than one driver would like to use a device. If that came with 9.0 or eometime in 8.x, I can't remember.
> What happens if you do
> `$ ls -l /dev/ugen3.2 /dev/ulpt0`
> do they point to the same device / link?



`$ > ls -l /dev/ugen3.2 /dev/ulpt0` gives me


```
lrwxr-xr-x  1 root  wheel            9 Jul 21 12:22 /dev/ugen3.2 -> usb/3.2.0
crw-r--r--  1 root  operator    0, 164 Jul 21 12:22 /dev/ulpt0
```

I don't know the significance of this information though. Is it good?


----------



## tingo (Jul 21, 2012)

That depends. Does /dev/usb/3.2.0 point to the same device as /dev/ulpt0?
(do `$ ls -l /dev/usb/3.2.0` to find out)


----------



## nickednamed (Jul 22, 2012)

`% > ls -l /dev/usb/3.2.0`

```
crw-------  1 root  operator    0, 107 Jul 22 12:05 /dev/usb/3.2.0
```

`% > ls -l /dev/ulpt0`

```
crw-r--r--  1 root  operator    0, 164 Jul 22 11:56 /dev/ulpt0
```

I guess not.

Perhaps this is opening a whole new can of worms, but here goes: Before recompiling my kernel, I thought I would try the FreeBSD handbook one more time, from the beginning, this time using LDP as the handbook suggests.

I got as far as Checking Printer Communications but `% lptest > /dev/ulpt0` did nothing. Neither did variants such as `% cat file > /dev/ulpt0` or `% lptest 20 5 | lpr` etc. No printer noises, no flashing lights, nothing.

Perhaps the problem is much more basic than a CUPS / HPLIP problem. Although the printer was workin fine under Windows and PC-BSD so I know the hardware is in good working order.


----------



## wblock@ (Jul 22, 2012)

If it works with PC-BSD, just copy that configuration.  It may be as simple as using the non-resetting USB device, /dev/unlpt0.

lptest(1) or any ASCII output will only print on printers that understand plain ASCII.  Many do not, the vendors having chosen to use proprietary page description languages, "host-based" printers, or hardware so cost-reduced it doesn't have ROM and must have firmware downloaded by the driver before use.  Some have a combination of these misfeatures.  The openprinting.org website shows this printer as using LIDIL, a proprietary page description language.


----------



## nickednamed (Jul 23, 2012)

Thank you for the continuing help. I will have to re-install PC-BSD to get a look at the config, as I failed to take note of it as I was happy that it "just worked".

I did come across that openprinting.org link early on in my printing mission, but I wasn't sure how similar that model is to mine. Similar enough I guess.

Just my luck to get an HP printer that doesn't even speak PCL! You get what you pay for I guess.

Does anyone know if it would be worth my time setting up LPD + HPIJS instead of CUPS + HPLIP? My printing needs are quite basic I suppose: I need to print only a few pages of PDFs; the odd black and white, line-drawn image; text documents and things like that.

I am running a fairly "light" system, doing as much as possible from the command line [as the whole point of me using FreeBSD is to learn something], so I don't / won't use many / if any of the graphical aspects of CUPS + HPLIP.


----------



## wblock@ (Jul 23, 2012)

Some of us prefer lpd(8)/lpr(1) to the internally-complex CUPS: lpd Printing With FreeBSD.


----------



## nickednamed (Jul 25, 2012)

I'm going to try LPD + HPIJS + Ghostscript. I have followed both the FreeBSD Printing and the guide just posted [thank you]. Here is my /etc/printcap:

```
hp|lp|f2280:\
        :sh:\
        :sd=/var/spool/lpd/f2280:\
        :lp=/dev/ulpt0:\
        :mx#0:\
        :lf=var/log/f2280.log:
```

But if I have understood correctly, this will not be enough for my needs [printing PDFs, images, the odd webpage, etc]. I believe I will need the print jobs translated into LIDIL.

Would I be correct in assuming for this I need the HPIJS driver? It lists my printer as supported. The requirements are listed as ghostscript9 and foomatic-filters. Is this sufficient?

If so, should I add the following to my /etc/printcap?

```
:if=/path/to/foomatic-rip:\
:af=/path/to/my/printer's/ppd:\
```


----------



## wblock@ (Jul 25, 2012)

Can't speak to the specifics (haven't used HPIJS), but yes.  The if= (input filter) is a filter to render incoming data into something the printer can understand.  The lf= log file entry is not required.  If you leave it out, errors go to /var/log/lpd-errs, which is usually adequate.


----------



## nickednamed (Jul 26, 2012)

Ok so I have installed HPIJS + Ghostscript + Foomatic-Filters. Trouble is, there is no .ppd file for my printer despite the claim the my printer is supported: Supported Printers

A simple search for PPD files gives me:

`# find / -name \*ppd\*` gives me a long list ff ppd files, but none for my printer. 

No 2200 series printers at all. I will perhaps try, by trial and error, to find the right PPD file, but in the meantime, does anyone know which might be best? And why mine isn't there!?

Also, HPIJS helpfully told me after the install that there is a sample printcap file located in the files directory. OK, I found it and it contains the line: 
	
	



```
:if=/usr/local/etc/bin/ifhp
```
 I also found the files it refers to so I will try with this line (and copy the files to apporpriate places, etc) and see how it goes. 

But now I'm left with the question: Where do I reference foomatic-rip in  printcap if not in the ":if" part?


----------



## wblock@ (Jul 26, 2012)

There is a PPD for the F2200 in print/hplip.  One of the IJS or HPLIP packages is the newer replacement, one is the older, I don't know which is which.

The ifhp script should handle calling the foomatic scripts.


----------



## nickednamed (Jul 27, 2012)

Ok so here is what I have done so far, from the beggining, according to the handbook and wblock's guide posted above:

`# mkdir /var/spool/lpd/f2280`
`# chown daemon:daemon /var/spool/lpd/f2280`
`# chmod 770 /var/spool/lpd/f2280`
`# echo 'lpd_enable="YES"' >> /etc/rc.conf`

Then I installed HPLIP in order to get the PPD file for my printer:

`# portmaster print/hplip`

I copied the ppd:
`# cp hp-deskjet_f2200_series-hpijs.ppd /usr/local/etc/ppd/hp-deskjet_f2200_series-hpijs.ppd`

Then uninstalled HPLIP: 
	
	



```
portmaster -e hplip
```

I then tried to install HPIJS, but was informed that foomatic-filters conflicts with HPIJS so I uninstalled it.

I then reinstalled HPIJS:
`# portmaster /print/hpijs` and, according to the post-insallation information, I copied ifhp:
`# cp ifhp /usr/local/etc/bin/` where to ym surprise I found foomatic-rip which must have been installed by HPIJS, judging by the dates. Ghostscript9 was installed as a dependency.

So I decided to re-write my /etc/printcap which now looks like this:

```
hp|lp|f2280:\
        :sh:\
        :sd=/var/spool/lpd/f2280:\
        :lp=/dev/ulpt0:\
        :lf=/var/log/lpd-errs:\
        :if=/usr/local/bin/ifhp:\
        :af=/usr/local/etc/ppd/hp-deskjet_f2200_series-hpijs.ppd:
```

And I tried to print numerous things (from Xpdf, lpr from the command line, typical lptest commands, etc). Nothing happened. I also tried using unlpt0 but no change.

My error log, /var/log/lpd-errs says only: 
	
	



```
Jul 26 22:49:41 host lpd[6474]: lpd startup: logging=0
Jul 27 11:52:15 host lpd[1787]: lpd startup: logging=0
Jul 27 11:58:18 host lpd[2153]: lpd startup: logging=0
```

I will play around with my /usr/local/bin/ifhp to see if that will make any difference, specifically the parts which read:

```
-sDeviceModel="DESKJET 960"  ... and ... -sIjsParams="Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2" \
```

As "DESKJET 960" is not my printer, I will try to dinf the exact name for my printer, and make sure that the following quality setting are supported by my printer by checking /usr/local/share/doc/hpijs

However, I'm starting to wonder if I'm not barking up the wrong tree: my ifhp says nothing about LIDIL language and also says that plain text will not be translated and will be sent straight to the printer. And I'm pretty sure now that my printer doesn't speak plain text.

I think I found a few extra grey hairs this morning, and I'm sure it's because of my printer! So any more of your patience and help would be very much appreciated. Thank you.


----------

