From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the Hardware series.
Laptops TV Tuner Cards Wireless Servers Storage Other Hardware Motherboards Related


[edit] Credits

This document is the result of countless frustrating hours spent dealing with CUPS, hplip, seemingly inconsequential dependencies, and forum posts. Many thanks go out to the Gentoo community for their support, as well as the Gentoo Wiki Team. Inspiration was from the HPOJ and CUPS article. Gentoo Forums article/support page is here.

[edit] Introduction

My experience is primarily with Ethernet-connected printers. As such, I'm using hplip, due to its built-in support for the scanner and card-reader, among other things. It also allows you to monitor ink levels, which is quite useful. If your only concern is printing, use hpijs. It has no dependencies to speak of (other than cups and foomatic, which should be obvious for printing) Of note, hplip/hpijs is the successor to hpoj. NOT another component, as some people seem to think. If you are still using hpoj, I strongly suggest upgrading. If not, this Wiki entry should be of benefit.

[edit] Required Components

usblp kernel module

[edit] Optional Components


[edit] Installation

A few USE flags you may or may not want to enable are gphoto2 and usb for sane-backends.

  • hplip-1.7.4a-r2 flags
    • qt3 - for the HP gui
    • parport - for accessing the device through the parallel port
    • snmp - for accessing a device on the network
    • usb - for accessing the device through USB
    • scanner - enables scanning support
    • ppds - adds printer drivers

Presumably, a mere 'emerge hplip' would pick everything up you need. On my machine, that failed to grab net-snmp, PyQt, and sane-backends, all of which are necessary for various functionality. You can just run an 'emerge -pv hplip' first and see what it picks up. If not, manually emerging each package (perhaps with some USE flags) works fine.

Code: Emerge Packages
emerge ghostscript PyQt sip foomatic gimp-print foomatic-filters libusb
echo "net-analyzer/net-snmp lm_sensors" >> /etc/portage/package.use
emerge net-snmp
echo "media-gfx/sane-backends gphoto2" >> /etc/portage/package.use
emerge sane-backends
echo "net-print/hplip ppds qt" >> /etc/portage/package.use
emerge hplip

Now that all everything's emerged, let's get on with it...

[edit] USE Flags

It's a good idea to put these flags into your package.use. Why? If you don't, they won't be utilized when you upgrade or re-emerge. If you don't mind how they're sorted, something like this works:

Code: Add USE Flags
echo "packageCategory/packageName flag1 flag2 ..." >> /etc/portage/package.use

If you do mind, just open up package.use with your favorite editor and place them in whatever order you wish. Alphabetical makes sense.

Tip: You can use app-portage/flagedit to edit use flags in a simple way.

[edit] SNMP

Note: The incorrect Net-SNMP dependency has been fixed. For info about snmp, read here

First, a word about SNMP. I have no experience with it whatsoever. It is a great mystery to me how or why it works in the first place. The default file /etc/snmp/snmpd.conf is below, with all comments and un-necessary options removed. I'm not even sure if this is necessary, though, as the snmpd service doesn't seem to be necessary for printing. Regardless, here you go.

As of hplip 0.9.4, this doesn't seem to be a problem. Apparently there was a mixup in the ebuild. Net-SNMP never was, and is not a dependency. net-snmp, however, is. Portage claims dev-perl/Net-SNMP is required for hplip. However, due to a typo on my part, I mistakenly emerged net-analyzer/net-snmp instead. When I later was looking through dependencies, I emerged Net-SNMP, and unmerged net-snmp. Hmm... no printing. Interesting. Emerged net-snmp (note, if you plan on doing this, I suggest making a package, as it takes a fair bit to compile), and it worked again. Stranger and stranger. Unmerged the supposedly necessary Net-SNMP, and still works. I've since then given up understanding in return for a working printer

Code: /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public

group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

view    systemview    included   .
view    systemview    included   .

access  notConfigGroup ""      any       noauth    exact  systemview none none

Also of note, if you compiled in support for lm_sensors, you'll need to do a few more things. First, if you're running a 2.6 series kernel, you'll need to compile in I2C support, found in Device Drivers --> I2C Support. lspci can come in handy here for determining what modules to include. Also useful /usr/bin/sensors-detect. This nifty little program will scan your various buses and determine what modules it needs, and if you want, even modify the configuration files for you.

[edit] Configuration

[edit] Using Cups

Note: At least for users with USB printers, make sure to start the service (/etc/init.d/hplip start) before this step!

Note: With the latest (2.7.10) hplip, there is no longer any init-script. Also, you may just wish to run hp-setup (next section) after emerging hplip and skip this section entirely. It doesn't seem to be necessary anymore.

Code: Configuring Device
# /etc/init.d/hplip start
# cd /usr/share/hplip     # Default install directory
# ./check.py                 # Checks for all required components, and proper versions. Should return OK on all.
# ./probe.py -busb
>> OR
# ./probe.py -bnet           # Probes either the USB or Network for attached devices.
                          # If you're lucky, it'll be picked up.  I wasn't.
# ./info.py                  # ver. 0.9.8 doesn't seem to have a 'probe' util
#                         # info seems to do the trick and may be a replacement
                          # for probe.

Assuming the probe/info went fine, restart cups, fire up your browser of choice, and navigate to [1] You should be greeted with the CUPS main page.

Change to Manage Printers, and then click 'Add Printer'. Login as root, with your root password. In the next page, you need at least a name. The name must be <= 127 characters, and contain no spaces. I suggest your model number, i.e. PSC2610. The other fields are optional, but can be handy if you have multiple printers.

In the 'Device' field, bounce down to hp:/net/modelNumber?ip=nnn.nnn.nnn.nnn OR hp:/usb/modelNumber?serial=xxx... (depending on whether it's connected via Ethernet or USB) If it's not there (although if that's the case, that means the probe command failed, so why are you reading this section?), don't despair; we'll fix that in a bit. If it is, though, choose it, and go on.

In the 'Make' field, choose your manufacturer; presumably HP, if you're reading this. Pretty straight forward. Onward.

In the 'Model' field, pick your driver. Note that many times, there are more than one that will work. In my case, I had to download the correct .ppd file from HP's site, which was then placed in /usr/share/cups/model. Anyway, hopefully you have one that reads something like '$MAKE $MODEL Foomatic/hpijs (recommended)'. Also of note, if you chose not to emerge foomatic-filters you may not have much of anything. If this is the case, you can alternatively download the PPD file directly from the manufacturer's site, or LinuxPrinting.org. IMPORTANT: If you forgot to set the 'ppds' USE flag for net-print/hplip then you won't see any of the printers supported by HPLIP.

That's it! Print a test page, and check that everything's correct; particularly the margins. If something's amiss, skip down to the HP Toolbox section.

[edit] Using hp-setup

Start CUPS and HPLIP.

Code: Start Services
# /etc/init.d/hplip start
# /etc/init.d/cupsd start

Start the "HP Device Manager" from the "Start Menu" and choose "Setup new device" from the "Device Menu", or from Terminal call

# /usr/bin/hp-setup

Follow the instructions on screen until the printer is set up. For further information refer to the hplip configuration page.

Tip: If hp-setup fails to find a ppd for your printer, be sure that you emerged both hplip and cups with the "ppds" USE flag.

[edit] Troubleshooting

./check may show:

Checking for dependency 'lsb (LSB - Linux Standard Base support)'...
error: Not found!
error: This is a REQUIRED dependency.

... but I cheerfully ignored this message without obvious ill effect.

So, probe failed, did it? Join the club. Seriously; join it. Tons of help available there. But on with the show.

[edit] Basic Steps

Let's check the obvious first. Is it plugged in and powered up? Are your cables good? Are the required services started/being loaded by default?

Code: Service Check
rc-update show default     # Check for cupsd and hplip; they should have 'default' to the right.
                           # If it's not, make it so with the bash script below.
for i in cupsd hplip ; do rc-update add $i default ; done
/etc/init.d/cupsd restart    # Start/restart cups - often times restarting a service fixes problems.
/etc/init.d/hplip restart    # Ditto for hplip

[edit] Network

Code: Network
ping nnn.nnn.nnn.nnn          # Where nnn.nnn.nnn.nnn is the IP address you've assigned to your printer.
                              # If you can ping it, there's one less thing to worry about.
cd /usr/share/hplip
./makeuri nnn.nnn.nnn.nnn

Now navigate back to Manage Printers and select 'Add Printer', only this time, choose 'AppSocket/HP Jet Direct' as the Device. In the 'Device URI' field, type in (or better yet, paste, as it's long) the URI ./makeuri returned. Continue as normal.

If makeuri fails (which does happen occasionally), you can look at /usr/share/hplip/data/xml/models.xml for your model number, and use that for the URI.

Code: /usr/share/hplip/data/xml/models.xml
cd /usr/share/hplip/data/xml
sed '/model.*$MODEL/!d' models.xml   # Where $MODEL is your model name.
                                     # Use only the model number; and round down.
                                     # 2610 becomes 2600, and so on.
                                     # Retain the 'model' bit as-is, though.

The only part you want is in the <model name="x"> field. For me, it's 'Photosmart_2600_series'. Armed with this, return to Manage Printers, and select 'Add Printer' as above. Follow the same steps, selecting 'AppSocket/HP Jet Direct' as the Device. Only now, in the 'Device URI' field, type in the following:

Code: Manual URI Creation
hp:/net/$SED_OUTPUT?ip=nnn.nnn.nnn.nnn     # For me, this looks like hp:/net/Photosmart_2600_series?ip=

[edit] USB

I don't have a USB printer. As such, the only help I can offer you is some basic advice. First, did you compile in support for USB/USB Printers in your kernel? What does the command lsusb return, if anything? Did you compile hplip with the usb USE flag? Is your kernel compiled with the usblp module? If so, did you load it?

[ Side Note ] (by Creator)

If you are using UDEV and HPLIP is unable to find your printing device, try the following:

Code: HPLIP Probing with UDEV
# mkdir /dev/usb
# mknod /dev/usb/lp0 c 180 0

Then, try re-probing (however you might conduct it, depending upon your HPLIP version).

[ Side Note ]

Make sure the usblp kernel module is loaded at boot time. HPLIP refused to detect my printer until I did.

Run the following to be sure it's loaded:

Code: Checking for usblp
# lsmod | grep usblp

If you're using coldplug, you should be okay. Regardless, if it's not loaded, add it to /etc/modules.autoload.d/kernel-2.x. Then reboot or do the following:

Code: Checking for usblp
# modprobe usblp

[edit] Parallel

"No devices found" - this happens when you build without the parport use flag, or when you don't have all the necessary kernel drivers.

You need the following kernel drivers, either built-in or as kernel modules.

  • ppdev (PPDEV - Device Drivers -> Character devices -> Support for user-space parallel port device drivers)
  • parport (PARPORT - Device Drivers -> Parallel port support -> Parallel port support)
  • parport_pc (PARPORT_PC - Device Drivers -> Parallel port support -> PC-style hardware)
  • IEEE 1284 (not a module; PARPORT_1284 - Device drivers -> Parallel port support -> IEEE 1284 transfer modes)
Code: Editing kernel configuration, non genkernel
(as root)
# cd /usr/src/linux
# make menuconfig
(add missing drivers and exit)
# make && make modules_install
(now copy arch/YOUR_ARCH/bzImage to your boot directory/partition)

For genkernel users:

Code: Editing kernel configuration for genkernel users
(as root)
(add --no-clean to the command line if you want to keep your old config)
# genkernel --install --menuconfig all
(add missing drivers and exit)

Afterwards, add "ppdev" (as a separate line) to /etc/modules.autoload.d/kernel-2.6. Now reboot your system and try running hp-setup again.

[edit] Printer doesn't print (but hp-toolbox says print completed)

In my special case this worked for me:

Code: Setting foomatic filter correctly
# rm /usr/lib/cups/filter/foomatic-rip
# ln -s /usr/bin/foomatic-rip /usr/lib/cups/filter/foomatic-rip

Before the symbolic link pointed to /usr/local/bin/foomatic-rip, causing cups to fail

-- For me, remerging net-print/foomatic-filters solved this.

[edit] Error "foomatic-rip failed"

If you get "/usr/lib/cups/filter/foomatic-rip failed": Sometimes, by gentoo instalation, ghostscript-gpl is emerged default, although it causes some printers not to work at all. To solve this, you need to install ghostscript-esp (remember about cups flag!):

Code: Replacing ghostscript-gpl with ghostscript-esp
# emerge -C ghostscript-gpl
# emerge ghostscript-esp

[edit] Scanning/Photo Cards

If you have an All-In-One, you'll likely also want to enable the scanner and card reader. If you managed to get the printer working, and emerged sane-backends, that should be all that's necessary. (Note: Make sure to emerge hplip with "scanner" useflag enabled, otherwise the hpaio sane-backend is not built.) I didn't have to do any extra configuration. Probably you will have to add a line hpaio to /etc/sane.d/dll.conf. Fire up xsane, or your scanning program of choice, and try it out. For the card reader, you can use the photo utility in the /usr/share/hplip directory, or through a CLI interface by executing /usr/bin/hp-unload, whence you can use an ftp-like set of commands to unload a photo-card to your computer. If you prefer the graphical interface that PyQt has to offer (many consider this much easier), use the HP Toolbox method as described below.

[edit] HP Toolbox

If you have the printer working correctly, the only other thing that may hamper you is dev-python/PyQt. I forgot to emerge this, and had quite a time dealing with it. Once installed, you can do most anything.

Note: The PyQt emerge is a bit mixed up at this writing. Before emerging the PyQt, you MUST emerge or reemerge the sip package else PyQt emerge fails. See forum discussion

From the Functions tab, there are options for 'Print', 'Scan', and 'Access Photo Cards'. This last one is very useful. It presents you with a GUI that allows downloading and uploading from any inserted media cards, rather than using the confusing CLI interface.

From the Status tab, you can check recent jobs the printer completed, it's current status, and any error messages.

From the Settings tab, you can set special options, if your printer supports them. This is also where fax options can be set, once hplip has support for it.

From the Print Jobs tab, you can check on any current or previous print jobs.

From the Supplies tab, you can check on ink levels, and the type of installed cartridges.

From the Maintenance tab, you can clean the nozzles, align the print heads, or calibrate the color output.

From the Panel tab, it appears you can view the information contained on the front LCD panel. It doesn't appear to be functional yet, but this could prove very promising.

From the Information tab, you can view information about your printer and it's connection, as well as print a test page, and open up the CUPS web interface.

[edit] Conclusion

hplip is a very powerful and sometimes difficult piece of software. Once configured correctly, it's just as usable as the Windows bundle.

Main things to watch out for are installed packages and USE flags. Those bit me more times than I can count. Double and triple-check that everything's been installed to spec, and you should have no problems.

[edit] External links

HP Color LaserJet 2600n and 1600 driver - printer unsupported by HPLIP

Personal tools