HP printers broken in Linux? Here's a fix.


Updated: May 28, 2014

This is a very quick tutorial that should help you get your printing working again. Namely, you have a printer, made by HP, and it used to work well in previous releases of your favorite distribution, openSUSE, Fedora, Ubuntu, it does not matter. Now, suddenly, it no longer works.

This guide will show you how to work around the problem at hand. It comes down to choosing the right drivers for your printer during the configuration of the device. I will demonstrate with Ubuntu Trusty, but please, believe me, it's the same thing with all other distributions. Honest. Now, after me.

Problem

So you've setup your printer. It may be a local device, or it may be a network device, perhaps connected to a Windows Samba share. It makes no difference. And supposedly, it's all good, right. Only the printer does not really print. Nothing happens. You are at loss here. What should you do? How do you debug the issue you are facing right now?

Supposedly good printer config

Solution

First, consult the command line. Or rather, the system log. This can be done by executing a simple command, like less /var/log/syslog or less /var/log/messages. Then, jump to the end of the file to see the most recent messages, which will most likely be related to your printing effort. Lo and behold, the system log read thus:

hpcups[3166]: common/utils.c 69: unable to open /var/lib/hp/hplip.state: No such file or directory
hpcups[3166]: common/utils.c 119: validate_plugin_version() Failed to get Plugin version from [/var/lib/hp/hplip.state]
hpcups[3166]: common/utils.c 157: Plugin version is not matching
hpcups[3166]: prnt/hpcups/HPCupsFilter.cpp 456: m_Job initialization failed with error = 48
hpcups[3166]: common/utils.c 220: Invalid Library hanlder pLibHandler = NULL.

Yes, a broken plugin. The proprietary HP plugin is bad. So you will need to redo your printer setup and try a different plugin. In fact, using my HP LaserJet Professional P1102 printer as an example, instead of selecting this full name string, with the corresponding hpcups proprietary plugin:

Properietary plugin

You select the LaserJet Pro P1102 string, and the Foomatic/foo2zjs-z2 plugin.

Foomatic plugin

Printer setup with foomatic drivers

Printer work

And then you will have a well configured device that prints well. In this case, the printer is connected to a Windows 7 box, so it's a Samba share, and I'm accessing it over a 5GHz Wireless network. All good there.

Optional

You may also have problems with AppArmor or SELinux, spewing nonsense and flagging legitimate processes. For example, this does happen with Trusty Tahr, and AppArmor is interfering with the printing. In the system log, you might see:

Apr 19 15:52:48 ultra kernel: [ 1411.223607] type=1400 audit(1397911968.197:78): apparmor="DENIED" operation="mknod" profile="/usr/sbin/cupsd" name="/var/cache/samba/gencache.tdb" pid=7875 comm="smb" requested_mask="c" denied_mask="c" fsuid=7 ouid=7

If this happens, you may want to consider the following: Teardown the AppArmor profiles, stop the service, disable the service from starting up after reboot, deleting the profile for the printing service, or adding a symlink in the disable sub-directory of the apparmor.d master directory, which will allow AppArmor to skip the specific process, similar to the current practice with Firefox. Now, this is a specific configuration for this security suite, so we won't go into details here. But be aware that this could happen, and that you can work around that problem, too.

More reading

Printing is a sore business in Linux. Some more guides:

Linux printing tutorial

Ubuntu family printing woes

Conclusion

This is a very short, but important tutorial. Finding solutions to a problem begins and ends with reading the error message. Right there, you may find the exact reason why something does not work. And while you might not be able to fix it, because you are not a programmer, you will know the root cause, and search for an alternative.

In our case, the Foomatic drivers seem to be superior to the HP proprietary plugin. It is possible that you may lose some advanced features, like maybe toner level warning or such, and I can't exclude that. But if you need to be able to print, right now, then here is a very simple and elegant workaround. Just choose a different driver. And that's it. Enjoy.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate