Monday, January 16, 2012

Installing HPLIP 3.11.12 on Linux Mint 12

I'm having trouble doing some scanning with my HP OfficeJet 6500 Wireless.  I keep getting an I/O Error when try using the auto document feeder at the commandline with the scanadf tool.

As a side note, I tried a demo of a commercial package for Linux/Windows/Mac called VueScan, and the demo version worked perfectly with the auto feeder out of the box.  However, it did not seem as customizable as I wanted for scanning a bunch of bills and receipts, so I still want to get the commandline method working.

From Googling around it seems this is a known issue that was resolved in a newer version of the HPLIP driver, but the latest supported version in the Linux Mint repo is 3.11.7.  Here is how I installed the latest version.

Get the shell script from here and run it:

wskellenger@gladstone ~/Downloads $ sh ./hplip-3.11.12.run

When prompted, be sure to choose the CUSTOM installation step:

 Please choose the installation mode (a=automatic*, c=custom, q=quit) : c

And then just answer yes to all of the features (all selected as default):

Initializing. Please wait...
 

INTRODUCTION
------------
This installer will install HPLIP version 3.11.12 on your computer.
Please close any running package management systems now (YaST, Adept, Synaptic, Up2date, etc).
 

DISTRO/OS CONFIRMATION
----------------------
Distro appears to be Linux Mint 12.

Is "Linux Mint 12" your correct distro/OS and version (y=yes*, n=no, q=quit) ?


SELECT HPLIP OPTIONS
--------------------
You can select which HPLIP options to enable. Some options require extra dependencies.

Do you wish to enable 'Network/JetDirect I/O' (y=yes*, n=no, q=quit) ?
Do you wish to enable 'Graphical User Interfaces (Qt4)' (y=yes*, n=no, q=quit) ?
Do you wish to enable 'PC Send Fax support' (y=yes*, n=no, q=quit) ?
Do you wish to enable 'Scanning support' (y=yes*, n=no, q=quit) ?
Do you wish to enable 'HPLIP documentation (HTML)' (y=yes*, n=no, q=quit) ?


I got an error that there were several missing dependencies, so I continued to iterate, attempting to install and the fixing dependencies, one by one.  It is a little bit ridiculous that the installer can't just tell the user what is missing -- clearly it KNOWS all of the package names but it does not reveal them all to you:

RUNNING PRE-INSTALL COMMANDS
----------------------------
OK


INSTALL MISSING REQUIRED DEPENDENCIES
-------------------------------------
warning: There are 5 missing REQUIRED dependencies.
note: Installation of dependencies requires an active internet connection.
warning: Missing REQUIRED dependency: python-devel (Python devel - Python development files)
warning: This installer cannot install 'python-devel' for your distro/OS and/or version.
error: Installation cannot continue without this dependency. Please manually install this dependency and re-run this installer.


So the installer knows there are five missing deps but it only tells you about one at a time?  This should be fixed in the install script IMO.  Anyway, here are the packages I needed:

sudo apt-get install g++
sudo apt-get install python-dev
sudo apt-get install libcups2-dev
sudo apt-get install libusb-dev
sudo apt-get install libcupsimage2-dev

If you are using the custom installation, it may tell you need some additional optional packages, and this time it lists them all out for you, which is further confirmation that the above behavior is a bug:


INSTALL MISSING OPTIONAL DEPENDENCIES
-------------------------------------
warning: There are 3 missing OPTIONAL dependencies.
note: Installation of dependencies requires an active internet connection.
warning: Missing REQUIRED dependency for option 'network': libnetsnmp-devel (libnetsnmp-devel - SNMP networking library development files)
warning: This installer cannot install 'libnetsnmp-devel' for your distro/OS and/or version.
warning: Option 'network' has been turned off.
warning: Missing REQUIRED dependency for option 'fax': dbus (DBus - Message bus system)
warning: This installer cannot install 'dbus' for your distro/OS and/or version.
warning: Option 'fax' has been turned off.
warning: Missing REQUIRED dependency for option 'scan': sane-devel (SANE - Scanning library development files)
warning: This installer cannot install 'sane-devel' for your distro/OS and/or version.
warning: Option 'scan' has been turned off.



I am a little surprised that it thinks dbus is missing but, let's install these deps also:

wskellenger@gladstone ~/Downloads $ sudo apt-get install dbus libsnmp-dev libsane-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
dbus is already the newest version.
The following extra packages will be installed:
  libavahi-client-dev libavahi-common-dev libdbus-1-dev libexif-dev
  libgphoto2-2-dev libieee1284-3-dev libperl-dev libsensors4-dev libsnmp-perl
  libv4l-dev libwrap0-dev
Suggested packages:
  libsane-extras-dev

The following NEW packages will be installed:
  libavahi-client-dev libavahi-common-dev libdbus-1-dev libexif-dev
  libgphoto2-2-dev libieee1284-3-dev libperl-dev libsane-dev libsensors4-dev
  libsnmp-dev libsnmp-perl libv4l-dev libwrap0-dev
0 upgraded, 13 newly installed, 0 to remove and 6 not upgraded.
Need to get 11.9 MB of archives.



See?  I knew dbus had to be there.  :)  I am going to install the suggested package libsane-extras-dev also:


wskellenger@gladstone ~/Downloads $ sudo apt-get install libsane-extras-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libsane-extras libsane-extras-common
The following NEW packages will be installed:
  libsane-extras libsane-extras-common libsane-extras-dev
0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 129 kB of archives.
After this operation, 537 kB of additional disk space will be used.
Do you want to continue [Y/n]?



You should see something like this during the compile (I am using the custom installation, not the automatic installation):

BUILD AND INSTALL
-----------------
Running './configure --prefix=/usr --enable-qt4 --enable-doc-build --disable-cups-ppd-install --disable-foomatic-drv-install --enable-foomatic-ppd-install --enable-hpijs-install --disable-policykit --disable-cups-drv-install --disable-hpcups-install --enable-network-build --enable-dbus-build --enable-scan-build --enable-fax-build'
Please wait, this may take several minutes...
Command completed successfully.

Running 'make clean'
Please wait, this may take several minutes...
Command completed successfully.

Running 'make'
Please wait, this may take several minutes...


Notice that the network and scan options are ENABLED.  If you don't use the custom build options I found that these were all DISABLED at compile-time.  They could have been disabled by the missing optional deps however, I am not sure.

The compile will take a while, perhaps 10 or more minutes.  After it is finished, it wants to restart or replug the printer, which doesn't really apply to me since I have a wireless printer.  I chose restart (thinking it would restart the PRINTER) and then realized it wanted me to restart the PC.

This is Linux, a restart shouldn't be necessary so I answered NO.  Note the other warnings around PyOS_InputHook.  Not sure what that is about, looks like something missing that it wants:

 RESTART OR RE-PLUG IS REQUIRED
------------------------------
If you are installing a USB connected printer, and the printer was plugged in 
when you started this installer, you will need to either restart your PC or   
unplug and re-plug in your printer (USB cable only). If you choose to restart,
run this command after restarting: hp-setup (Note: If you are using a parallel
connection, you will have to restart your PC. If you are using network/wireless,
you can ignore and continue).                                                 
Restart or re-plug in your printer (r=restart, p=re-plug in*, i=ignore/continue, q=quit) : /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK
  set_interactive(1)
"sni-qt/6771" WARN  15:58:22.564 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE
r
note:
note: IMPORTANT! Make sure to save all work in all open applications before restarting!
Restart now (y=yes, n=no*, q=quit) ? n


Now I ran the Linux Mint Printer setup under Settings --> Printing.  I removed the existing printer and added it again.  Running hp-setup did NOT work for me.

I printed a test page and all was well.

Now to try scanadf again:

wskellenger@gladstone ~ $ scanadf --mode Gray --resolution 300 --source ADF
Scanned document image-0001
Scanned document image-0002
Scanned document image-0003
Scanned 3 pages



Sweet!  If this helped you, click one of my ads, I might make a penny!  :-)