Several years ago when I needed a new printer, I had gotten some sort of HP inkjet, and I was pleasantly surprised by how easy it was to enable printing using HPLIP on top of CUPS. I had previously used Apsfilter with various printers. That was still worlds better than manually configuring print filters and spools and hacking on /etc/printcap directly. However, the HPLIP setup was even nicer out of the box than with Apsfilter. Thus, when it was time for a new printer recently, I went with an HP printer. With this printer I hit a few bumps with HPLIP and here is how I solved them:
Installing the HPLIP Plugin
My new printer required a plugin for HPLIP during setup, and trying to fetch and install the plugin using hp-setup did not work. Instead, hp-setup just hung without any errors. To get around this I had to install the plugin manually.
First, I had to find and download the plugin. I probably could have sniffed the URL out via tcpdump on the connection hp-setup was opening when it tried to install the plugin, but I did not think of that at the time. Instead, after some searching I eventually found the URL http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.11.12-plugin.run (Note that I am using version 3.11.12 of HPLIP, you can modify the URL for different HPLIP versions as needed). I used fetch(8) like so:
> fetch -o /tmp/plugin http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.11.12-plugin.run
The file downloaded to /tmp/plugin was just a fancy self-extracting shell archive. Running it by hand failed with this message:
> sudo sh /tmp/plugin Verifying archive integrity... All good. Uncompressing HPLIP 3.11.12 Plugin Self Extracting Archive......................................... eval: ./hplip-plugin-install: not found
Of course, when I checked, there was no ./hplip-plugin-install file to examine. After perusing the script, I found that it accepted an optional ‘–keep’ option that would leave the directory of extracted files around instead of cleaning them up on exit. I also found that the script extracted to the current directory, so I ran the script from /tmp after that point.
> cd /tmp > sudo sh /tmp/plugin --keep Creating directory plugin_tmp Verifying archive integrity... All good. Uncompressing HPLIP 3.11.12 Plugin Self Extracting Archive......................................... eval: ./hplip-plugin-install: not found
This left behind a /tmp/plugin_tmp directory that contained a hplip-plugin-install file:
> sudo cat plugin_tmp/hplip-plugin-install #!/bin/bash # su/sudo wrapper for HPLIP installer python ./plugin_install.py $*
Of course, FreeBSD doesn’t typically have /bin/bash (nor does this script even need /bin/bash AFAICT). Instead, I just ran the python script directly as root. The first time I tried this it failed:
> sudo -s # cd plugin_tmp # python ./plugin_install.py Error setting home directory: /etc/hp/hplip.conf not found. Is HPLIP installed?
I created a symlink from /etc/hp to /usr/local/etc/hp and ran it again. This time it popped up a dialog box with a EULA and installed successfully. After it finished, I deleted /tmp/plugin_tmp and /tmp/plugin to cleanup.
Adding the Printer
Once the plugin was installed manually, hp-setup ran fine and recognized that the plugin was already installed. However, I did run into a couple of glitches.
First, for the specific printer I was using (an HP LaserJet 100 M175nw), hp-setup wasn’t able to determine the ppd file automatically. I was able to install the printer just fine though by selecting ‘hp-laserjet_100_color_mfp_m175-ps.ppd.gz’ manually.
Second, I let hp-setup use the default setting for discovering the printer over the network (mDNS). However, the printer didn’t actually work even though hp-setup had claimed it had added it successfully. All attempts to use it failed with this error:
> hp-info HP Linux Imaging and Printing System (ver. 3.11.12) Device Information Utility ver. 5.2 Copyright (c) 2001-9 Hewlett-Packard Development Company, LP This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. Using device: hp:/net/HP_LaserJet_100_colorMFP_M175nw?zc=NPIA32010 error: Unable to communicate with device (code=12): hp:/net/HP_LaserJet_100_colorMFP_M175nw?zc=NPIA32010 error: Unable to open device hp:/net/HP_LaserJet_100_colorMFP_M175nw?zc=NPIA32010. Done.
Some web searching led me to suspect mDNS as the problem. I tried starting avahi-daemon, but that did not help. Eventually, I punted on mDNS and assigned my printer a static IP. I re-ran hp-setup to attach to the printer via the static IP at which point it worked fine.