How to connect HP printer to Linux

1020-plus

In some experiences of Linux customization printing is a sore point. Frankly, I still can’t figure out about Canon printers, where is no one official Linux driver. Here I want to share my experience about what to do with HP printers. In my example I used HP Laserjet 1020 and Fedora 23. So, I used DNF for some packages installation. You’re in your own at this case.

Sometimes printer is connecting and working effortlessly. Linux-distro has special drivers for this device and you’re lucky. But incredibly you have to select favourable driver personally. Openprinting helps you! Also you can pick the printer that’s working great in Linux if you just want to buy it. By HP case there are 2 ways to configure your contraption. Each way has it’s own features in installation. I tried both. First way just worked out up to reboot. Second option is still helps to print properly.

Before driver installation assure yourself about running CUPS daemon. If CUPS is not working – fix it. No CUPS – no party.

1. Install “hplip” driver


Hplip acronym means “HP Linux Imaging and Printing”. You can get it directly from the package manager or download from HP site. Don’t forget to find out your distro and connection method in available lists. Probably you have to install 4 packages; hplip, hplip-gui, hplip-common and hplip-libs. Package system will be better, because it makes up all necessary dependencies.

At first run “hp-setup” command without superuser rights. You can setup driver both ways: GUI or interactive, it’s up to you. If you have any errors in output stream – run “hp-check” command. It’s a main key for problem solution. You’ll get a message for plugin installation, take it for granted.

The main issue is a plugin installation. In my case it got stuck. What’s the catch? “Hp-plugin” utility wants to rule /etc directory as a simple user without root rights. Probably you see this message…

Creating directory plugin_tmp
 Verifying archive integrity... All good.
 Uncompressing HPLIP 3.15.9 Plugin Self Extracting Archive............................................
 
 HP Linux Imaging and Printing System (ver. 3.15.9)
 Plugin Installer ver. 3.0
 
 Copyright (c) 2001-15 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.
 
 Plug-in version: 3.15.9
 Installed HPLIP version: 3.15.9
 Number of files to install: 38
 
 /

…and nothing else. So, you can fix the installer code. What you can solve.

    a) download .run-file hp-plugin for direct usage;

    b) execute next commands:

sh ./hplip-3.15.7-plugin.run --keep
cd ./plugin_tmp //from new terminal window

    c) With –keep option hplip should exhibit tmp directory, where installer file is running. Don’t go any longer with plugin execution, just open py file.

    d) Find line №42 and comment this lines:

 #if os.geteuid() == 0:
 #        print("hp-plugin should not be run as root/superuser. Exiting.")
 #        sys.exit(1)

It allows you to run plugin installer as a superuser and finish installation correctly.

    e) Run python ./plugin_install.py as a superuser. Eventually you ought to see this message.

 HP Linux Imaging and Printing System (ver. 3.15.7)
 Plugin Installer ver. 3.0
 
 Copyright (c) 2001-15 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.
 
 Plug-in version: 3.15.7
 Installed HPLIP version: 3.15.7
 Number of files to install: 0
  
 Done.

Don’t worry. For “hp-setup” it means your plugins installed and you can start to print pages.

    f) Run “hp-setup” again and finish the installation. If you still have any problems – once again, run “hp-check”. You might forget to install any dependence. Or it could be SELinux issue, thus switch it to “permissive” mode. Reboot your PC/laptop for double check.

2) Install foo2zjs


“foo2zjs” is an open source printer driver for printers. The main feature is Zenographics ZjStream wire protocol, used for data printing. At first find your printer in accessible list. Also add a printer to your system through GUI printing manager or through CLI. Linux should recognize a device without any drivers. Driver is compulsory for printing directly.

2

After that pull foo2zjs archive and install it through “make”. Do it as a superuser (root).

wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
tar zxf foo2zjs.tar.gz
cd foo2zjs
make
./getweb 1020 #there should be number of your printer model
make install
dnf remove system-config-printer-udev #necessary for hotplug installation
make install-hotplug

Actually your printer should start to work without system reboot. But you can do it just in case. If you have a GNOME, you would be get better to use “system-config-printer” utility.

Hope I helped you to make a friendship between our system and printer. If you have any more problems or any ways else to setup HP – go to the comments.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s