LaoBlog

Debian Stretch 9.3 + hplip 3.7.11 + HP Laserjet Pro MFP M26nw


The current hplip version in Debian 9.3 is oblosete and doesn't support the HP Laserjet Pro MFP M26nw. Hplip 3.7.11 does, but unfortunately installing the package from https://developers.hp.com/hp-linux-imaging-and-printing I'm getting troubles with the dependencies. The most problematic packages are pyqt4 and pyqt4-dbus; the hplip installer requires them, but already since Debian 8.7 (or maybe before), those packages have been renamed to python-qt4 and python-qt4-dbus. It can be that while trying to install hplip 3.7.11 some more dependencies are missing, but you can easily install them in the usual way, through you package manager or apt.Anyway, after struggling for some days, I've found a very useful post on Launchpad, which has helped me in finding the solution: https://answers.launchpad.net/hplip/+question/452076First, download hplip-3.17.11.run from https://developers.hp.com/hp-linux-imaging-and-printingEnter in the folder where you've downloaded it, and make it executable with:sudo chmod a+x hplip-3.17.11.runMind that you should install this package as a normal user, not as root. If there's no such user on your computer, create it and also his home directory, because later the installer will create some files in the home directory of the user, It's not really needed, but it'll avoid the installer to throw out some error. Before everything, uninstall the older version of hplip, if it's installed (btw, the new installer should also ask you about that).Once done, run the installer:./hplip-3.17.11.runThe installer will try to go on as long as possible, asking you different questions about the version of your operating system, dependencies and so on. Try to go on as long as possible, to get an idea about what to expect later, and especially try to solve the other missed dependencies, which could be related to python packages, cups, etc.p, li { white-space: pre-wrap; }When the installer will stop, complaining that pyqt4 and pyqt4-dbus are missing and can't be installed, it'll be your turn!The installer has created a folder, hplip-3.17.11. You now have to edit the file hplip-3.17.11/installer/core_install.py with your favorite editor (vi, nano, emacs, leafpad...)In that file locate the following:'pyqt4-dbus' : (True, ['gui_qt4'], QT4DBUS_STR, self.check_pyqt4_dbus, DEPENDENCY_RUN_TIME,'4.0','FUNC#get_pyQt4_version', GENERALDEP),and change it into:'python-qt4-dbus' : (True, ['gui_qt4'], QT4DBUS_STR, self.check_pyqt4_dbus, DEPENDENCY_RUN_TIME,'4.0','FUNC#get_pyQt4_version', GENERALDEP),Note that pyqt4-dbus must be changed in python-qt4-dbus.Then locate: 'pyqt4': (True, ['gui_qt4'], QT4_STR, self.check_pyqt4, DEPENDENCY_RUN_TIME,'4.0','FUNC#get_pyQt4_version', GENERALDEP), # PyQt 4.x )and change it into:'python-qt4': (True, ['gui_qt4'], QT4_STR, self.check_pyqt4, DEPENDENCY_RUN_TIME,'4.0','FUNC#get_pyQt4_version', GENERALDEP), # PyQt 4.x )Here we have changed pyqt4 into python-qt4.Save the file and close it.Now you have to edit the file hplip-3.17.11/installer/distros.dat to add the compatibility with Debian 9.3.Around line 4717 you'll find the following:[debian] index=2 versions=7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7,7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,9.1display_name=DebianYou need to add the version's number 9.3 (and 9.2) at the end of that line which begins with the word version as the following:versions=7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7,7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,9.1,9.2,9.3Once done, around line 6102 of the same file, there's the configuration section for the last supported Debian version, code number 9.1. Basically you have to copy it and change the code number from 9.1 to 9.3 for all the recurrencies. To be clean, you should add 2 sections, one for Debian 9.2 and one for Debian 9.3, where the only difference is the code number of the version. I personally didn't add the section for 9.2, the installer has shown an error about that but then went on. Let's see how to do:at the end of the section for Debian 9.1, around line 6102, as previously written, add the following text:[debian:9.3] code_name=Stretch supported=1 scan_supported=1 fax_supported=1 pcard_supported=1 network_supported=1 parallel_supported=1 usb_supported=1 packaged_version=3.17.10 release_date=22/07/2017 notes=NOTE: Disable the CD Sources in your apt sources.list or the install will fail and hang. ppd_install=drv udev_mode_fix=1 ppd_dir=/usr/share/ppd/HP fix_ppd_symlink=0 drv_dir=/usr/share/cups/drv/HP ui_toolkit=qt5 native_cups=1 policykit=0 # This libdir_path will be used only for 64 bit machine. libdir_path=/usr/lib/x86_64-linux-gnu [debian:9.3:cups] packages=cups,libcups2 [debian:9.3:cups-devel] packages=libcups2-dev,cups-bsd,cups-client [debian:9.3:gcc] packages=g++ [debian:9.3:gs] packages=ghostscript,ghostscript-cups,ghostscript-x [debian:9.3:libcrypto] packages=libssl-dev [debian:9.3:libjpeg] packages=libjpeg62-turbo-dev [debian:9.3:libnetsnmp-devel] packages=libsnmp-dev,snmp [debian:9.3:libpthread] packages=libc6 [debian:9.3:libtool] packages=libtool,libtool-bin [debian:9.3:libusb] packages=libusb-1.0.0-dev [debian:9.3:make] packages=make [debian:9.3:pil] packages=python-imaging [debian:9.3:ppdev] packages= commands=su -c "modprobe ppdev",su -c cp -f /etc/modules /etc/modules.hplip,echo ppdev | su -c tee -a /etc/modules [debian:9.3:pyqt] packages=python-qt3 [debian:9.3:python-devel] packages=python-dev [debian:9.3:pyqt4] packages=python-qt4 [debian:9.3:pyqt4-dbus] packages=python-qt4-dbus [debian:9.3:python23] packages=python [debian:9.3:python2X] packages=python [debian:9.3:reportlab] packages=python-reportlab [debian:9.3:sane] packages=sane [debian:9.3:sane-devel] packages=libsane-dev [debian:9.3:scanimage] packages=sane-utils [debian:9.3:xsane] packages=xsane [debian:9.3:cups-ddk] packages= [debian:9.3:python-dbus] packages=python-dbus,python-gobject [debian:9.3:dbus] packages=libdbus-1-dev [debian:9.3:python-ctypes] packages=python-ctypes [debian:9.3:cups-image] packages=libcupsimage2,libcupsimage2-dev [debian:9.3:policykit] packages=policykit-1,policykit-1-gnome [debian:9.3:python-notify] packages=python-notify [debian:9.3:network] packages=wget [debian:9.3:avahi-utils] packages=avahi-utils [debian:9.3:gtk] packages=libcanberra-gtk-module [debian:9.3:python3-notify2] packages=python3-notify2 [debian:9.3:python3-pyqt4-dbus] packages=python3-dbus.mainloop.qt [debian:9.3:python3-pyqt4] packages=python3-pyqt4,gtk2-engines-pixbuf [debian:9.3:python3-dbus] packages=python3-dbus,python3-gi [debian:9.3:python3-xml] packages=python3-lxml [debian:9.3:python3-devel] packages=python3-dev [debian:9.3:python3-pil] packages=python3-pil [debian:9.3:python3-reportlab] packages=python3-reportlab [debian:9.3:python3-pyqt5-dbus] packages=python3-dbus.mainloop.pyqt5 [debian:9.3:python3-pyqt5] packages=python3-pyqt5,gtk2-engines-pixbuf [debian:9.3:pyqt5] packages=gtk2-engines-pixbuf,python-pyqt5 [debian:9.3:pyqt5-dbus] packages=python-dbus.mainloop.pyqt5 [debian:9.3:automake] packages=automake1.11 [debian:9.3:epm] packages=epmThat's it! Save the file, close it and then re-run the installer ./hplip-3.17.11.run which now should work. Once finished, you'll eventually need to reboot and run again hp-setup to install the printer, if it can't be detected at the first try.Good luck!