Nixpkgs: printing hplip: - hp-toolbox (HP Device Manager) broken, needs pkg depends

Created on 26 Mar 2018  路  24Comments  路  Source: NixOS/nixpkgs

Issue description

if hplip is added to configuration.nix:

services.printing.enable = true;
services.printing.drivers = with pkgs; [ hplip ];
...
hardware.sane.enable = true;
hardware.sane.extraBackends = with pkgs; [ hplipWithPlugin ];

(not fixed, problem 4) hp-toolbox (HP Toolbox gui application) refuses to run, because it can't load dbus libraries.

(fixed p1) the drivers are added, however the toolbox refuses to run, because it requires sip.
(fixed p2) printer and fax can be added via "hp-setup".
(fixed p3) scanning fixed, user must be in "scanner" group.

Archive version for report about problem 2:
This is solution for the problem on OpenSuse: https://forums.opensuse.org/showthread.php/525171-Can-not-print-using-either-HP-printer-hooked-up-to-my-computer?s=390bfda07a55738d7b795bce37ba3fba&p=2825635#post2825635

Problem 2 was fixed with #37907

Steps to reproduce

Problem 4, surfaced after problem 2 was fixed:

$hp-toolbox
HP Linux Imaging and Printing System (ver. 3.17.11)
HP Device Manager ver. 15.0

Copyright (c) 2001-15 HP 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.

error: Unable to load DBus libraries. Please check your installation and try again.

and it quits.


Historical version of problem 2 (hp-toolbox requires sip, fixed):

$ hp-toolbox
HP Linux Imaging and Printing System (ver. 3.17.11)
HP Device Manager ver. 15.0

Copyright (c) 2001-15 HP 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.

error: No module named sip

Technical details

(updated, current)

  • system: "x86_64-linux"

    • host os: Linux 4.15.15, NixOS, 18.03.131807.489a14add9a (Impala)

    • multi-user?: yes

    • sandbox: yes

    • version: nix-env (Nix) 2.0

    • channels(root): "nixos-18.03.131807.489a14add9a, nixos-master-18.09pre133640.ea145b68a01"

    • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

bug python

All 24 comments

adding "python27Packages.sip" does not seem to contribute anything.

There is something wrong going on, when I start "hp-doctor". I understand is that utility misinterprets the results, because its looking for FHS, but there could be some dependencies lost:

--------------
| COMPILEDEP |
--------------

 error: gcc           gcc - GNU Project C and C++ Compiler                         REQUIRED        -               -               MISSING    'gcc needs to be installed'
 error: make          make - GNU make utility to maintain groups of programs       REQUIRED        3.0             -               MISSING    'make needs to be installed'
 error: libtool       libtool - Library building support services                  REQUIRED        -               -               MISSING    'libtool needs to be installed'

------------------------
| General Dependencies |
------------------------

 error: libcrypto     libcrypto - OpenSSL cryptographic library                    REQUIRED        -               -               MISSING    'libcrypto needs to be installed'
 python-xml           Python XML libraries                                         REQUIRED        -               2.2.4           OK         -
 error: libnetsnmp-devel libnetsnmp-devel - SNMP networking library development files REQUIRED        5.0.9           -               MISSING    'libnetsnmp-devel needs to be installed'
 error: sane-devel    SANE - Scanning library development files                    REQUIRED        -               1.0.27          MISSING    'sane-devel needs to be installed'
 pil                  PIL - Python Imaging Library (required for commandline scanning with hp-scan) OPTIONAL        -               1.1.7           OK         -
 error: pyqt4-dbus    PyQt 4 DBus - DBus Support for PyQt4                         REQUIRED        4.0             -               MISSING    'pyqt4-dbus needs to be installed'
 error: libpthread    libpthread - POSIX threads library                           REQUIRED        -               2.26            MISSING    'libpthread needs to be installed'
 error: python-devel  Python devel - Python development files                      REQUIRED        2.2             2.7.14          MISSING    'python-devel needs to be installed'
 error: cups-devel    CUPS devel- Common Unix Printing System development files    REQUIRED        -               -               MISSING    'cups-devel needs to be installed'
 python-dbus          Python DBus - Python bindings for DBus                       REQUIRED        0.80.0          1.2.4           OK         -
 error: cups-ddk      CUPS DDK - CUPS driver development kit                       OPTIONAL        -               -               MISSING    'cups-ddk needs to be installed'
 reportlab            Reportlab - PDF library for Python                           OPTIONAL        2.0             3.4.0           OK         -
 error: pyqt4         PyQt 4- Qt interface for Python (for Qt version 4.x)         REQUIRED        4.0             -               MISSING    -
 error: libusb        libusb - USB library                                         REQUIRED        -               1.0             MISSING    'libusb needs to be installed'
 error: cups-image    CUPS image - CUPS image development files                    REQUIRED        -               -               MISSING    'cups-image needs to be installed'
 python2X             Python 2.2 or greater - Python programming language          REQUIRED        2.2             2.7.14          OK         -
 error: python-notify Python libnotify - Python bindings for the libnotify Desktop notifications OPTIONAL        -               -               MISSING    'python-notify needs to be installed'
 error: libjpeg       libjpeg - JPEG library                                       REQUIRED        -               -               MISSING    'libjpeg needs to be installed'
 error: sane          SANE - Scanning library                                      REQUIRED        -               1.0.27          MISSING    'sane needs to be installed'

----------------------
| Scan Configuration |
----------------------

 scanext              Scan-SANE-Extension                                          REQUIRED        -               3.17.11         OK         -
 hpaio                HPLIP-SANE-Backend                                           REQUIRED        -               3.17.11         OK         'hpaio found in /nix/store/wv4l8yy3b77ikf5i5256c2659qyqfccl-hplip-3.17.11/etc/sane.d/dll.conf'

-------------------------
| External Dependencies |
-------------------------

 error: gs            GhostScript - PostScript and PDF language interpreter and previewer REQUIRED        7.05            -               MISSING    'gs needs to be installed'
 scanimage            scanimage - Shell scanning program                           OPTIONAL        1.0             1.0.27          OK         -
 error: cups          CUPS - Common Unix Printing System                           REQUIRED        1.1             -               INCOMPAT   'CUPS may not be installed or not running'
 network              network -wget                                                OPTIONAL        -               1.19.4          OK         -
 error: policykit     PolicyKit - Administrative policy framework                  OPTIONAL        -               0.113           MISSING    'policykit needs to be installed'
 error: xsane         xsane - Graphical scanner frontend for SANE                  OPTIONAL        0.9             -               MISSING    'xsane needs to be installed'
 error: dbus          DBus - Message bus system                                    REQUIRED        -               1.10.24         MISSING    'DBUS may not be installed or not running'
 error: avahi-utils   avahi-utils                                                  OPTIONAL        -               -               MISSING    'avahi-utils needs to be installed'

Duplicating current issue list here too:

  • printer will refuse to print any "custom paper", which is available through GIMP menu for example.
  • GIMP preview creates HUGE offset fields on some paper formats, however they are not printed
  • Qt-based applications, such as Okular refuse to accept some paper types - which is very similar to this: https://forum.kde.org/viewtopic.php?f=289&t=136325

Ok, patch arrives, hp-toolbox still refuses to run (in console, or via KDE menu "HP Device Manager").

hp-toolbox 

HP Linux Imaging and Printing System (ver. 3.17.11)
HP Device Manager ver. 15.0

Copyright (c) 2001-15 HP 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.

error: Unable to load DBus libraries. Please check your installation and try again.

I will update the header.

Great! The scanning is apparently broken too.

hardware.sane.enable = true;
hardware.sane.extraBackends = with pkgs; [ hplipWithPlugin ];

Skanlite says: "Sorry. No devices found."

Am I the only one using Nixos for desktop?

PInging everyone who contributed to hplip package: @nckx @ttuegel @FRidh @aristidb @urkud @regnat @bkchr @vcunat @dezgeg @sjagoe @orivej @pikajude @flosse @Mic92 @jgertm @jgeerds @cillianderoiste @edolstra @dywedir @aske

Try with sudo iptables -F, this will flush your firewall and scanning should work. I still did not find the right port to open in the firewall, to get this working without flushing iptables..

@bkchr Thanks, it didn't help. The hp ppd worked for me even without sip fix, but this is because I manually installed the printer via CUPS IP interface. It was possible, because the printer has own printserver and talks via local ip. The applications from hp-* chain are still broken, but now they miss Dbus. Scanning is broken as well.

$ scanimage -L
No scanners were identified.

On deb-based distributions, I would pull hplip and then use HP toolbox (hp-toolbox) to detect, add and test the whole printer/scanner/fax.

Hmm, hplip is again broken on master?
I just tried it, I installed my printer with hp-setup and after that scanimage -L finds my scanner(flushed my iptables).

@bkchr This is strange. hp-setup worked for printer installation. I removed the printer from CUPS, then ran hp-setup and it added printer and fax.
Flushed iptables - but no success with scanner. hp-toolbox still complains about missing Dbus libraries. I can access device over IP/browser.

@bkchr Thank you! Scanning fixed!.. Short version: user must be in "scanner" group.

Long version:
I went this way: https://wiki.archlinux.org/index.php/SANE/Scanner-specific_problems#HP

$ hp-makeuri 192.168.2.20
...
CUPS URI: hp:/net/Officejet_Pro_8600?ip=192.168.2.20
SANE URI: hpaio:/net/Officejet_Pro_8600?ip=192.168.2.20
HP Fax URI: hpfax:/net/Officejet_Pro_8600?ip=192.168.2.20

Tried to feed:
$ scanimage --device "hpaio:/net/Officejet_Pro_8600?ip=192.168.2.20" -L
with no results, but then decided to try:
$ sudo scanimage --device "hpaio:/net/Officejet_Pro_8600?ip=192.168.2.20" -L

et voila!..

Thus, listed groups (cat /etc/group | sort | less -X) , found scanner group (which wasn't there), # usermod myusername -aG scanner , re-loginned, scanimage could detect it as user!

I will edit the header of bug, that HP Toolbox does not work (hp-toolbox). Its great tool, but I can live without it now that I can use the device via 3rd party software. :)

Nice that it finally works. I thought that you followed the tutorial in the wiki: https://nixos.wiki/wiki/Scanners
It's saying that you need to add yourself to the scanner group. Don't forget to add that to your configuration.nix :)

@cx405 When you say scanning is fixed do you see your scanner when running scanimage -L? I still don't see my scanner. I can get scanning to work if I run simple-scan hpaio:/net/Officejet_Pro_8600?ip=192.168.2.20. That seems less then ideal to have to pass the device uri each time. My user is part of the scanner group.

@codedmart Hello there!
HP Toolbox is still broken:

$ hp-toolbox 

HP Linux Imaging and Printing System (ver. 3.19.1)
HP Device Manager ver. 15.0

Copyright (c) 2001-15 HP 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.

error: No module named enum

However scanner works:

[userp@nix01:~]$ scanimage -L
device `hpaio:/net/Officejet_Pro_8600?ip=192.168.2.20' is a Hewlett-Packard Officejet_Pro_8600 all-in-one

These are relevant items from configuration.nix:

users.extraUsers.userp.extraGroups = 
[ "audio" "disk" "video" "wheel" "scanner" "lp" "networkmanager" "systemd-journal" ];
...
hardware.sane.enable = true;
hardware.sane.extraBackends = with pkgs; [ hplipWithPlugin ];
...
services.printing.enable = true;
services.printing.drivers = with pkgs; [ hplip ];  #user must be in "lp" group
...
networking.firewall.enable = false;

If simple-scan is able to detect scanner, then its connected and responding. Scanimage will fail if no proper module is installed, if user is not in "scanner" group, if firewall is blocking (I dont know correct port, solved by opening port or disabling it) or if printer is not pingable. You can ping your printer, it has custom printserver running (check by giving this in your web browser: 192.168.2.20).

I think you have added user to "scanner" group in configuration.nix, but your user is not in "scanner" group still, because if your users are immutable ("users.mutableUsers = true;" in configuration.nix) which is also default, then nix will not touch any existing users.

Possible solution:
Do "$ groups" when logged with your user login.

If there is no "scanner" group listed, then do: "$ usermod -a -G scanner _your_user_"
where your_user is your user login.

Example for me:

[userp@nix01:~]$ groups
users wheel disk audio lp video networkmanager scanner systemd-journal

in above, _your_user_ = userp

Also, its strange that your printer uses same IP as me and same printer model... You need to use your printer IP and your printer model, which are listed by scan_image and IP is set in the printer itself (via touchscreen on printer).

@cx405 Thanks for the reply!

Let me explain a bit more. I just reused your device uri as an example. Here is what I have:

hardware.sane.enable = true;
hardware.sane.extraBackends = with pkgs; [ hplipWithPlugin ];
...
services.printing.enable = true;
services.printing.drivers = with pkgs; [ hplip ];  #user must be in "lp" group
...
networking.firewall.enable = false;
...
users.extraUsers.codedmart.extraGroups = 
[ "audio" "disk" "docker"  "lp" "messagebus" "networkmanager" "scanner" "systemd-journal" "video" "wheel"];

And if I run $ groups:

[~]-> groups
users wheel messagebus disk audio lp video networkmanager scanner systemd-journal

Yet running scanimage:

[~]-> scanimage -L
device `v4l:/dev/video0' is a Noname Apple Facetime HD virtual device

My HP is a Photosmart C4795. I can ping it and printing works fine. It is at 192.168.1.172. The only way I have gotten it to work is by passing the device uri directly to simple-scan/xsane. It is not detected otherwise by scanimage or anything else so far as I can tell. Not sure what else I am missing, but having to pass the device uri directly doesn't seem right since I have had no problems with this scanner in Ubuntu/Gentoo/Arch/Void.

@codedmart Hm, hp utility installs some files, so even if device is offline, scanimage gives me the results, however "hp-scan" actually tries to connect. I forgot, maybe I run some hp thing, which placed files in place, that allowed it to work. You are using sane via network, which is currently not officially supported, so it could be it. Also see #17411 and wiki (scroll all way to bottom).

Meanwhile I will try to remember how I set this up...

Edit: also, may be worth checking, does sudo scanimage -L work for you?

The problem with "enum" seem to be fixed with #58515, but I need a reboot to confirm.. :/
Edit2: no, not fixed.
Edit3: nvm, that #58515 is not merged into 19.03 yet.

Can someone merge it into 19.03 please? Ok, I created request: #64990

@cx405 Yeah I have tried all that. Here is what I just tried:

I tried hplip and hplipWithPlugin from nixpkgs-unstable.
I tried the info from #17411 and wiki:

hardware = {
    sane = {
      enable = true;
      extraBackends = [ pkgs.unstable.hplipWithPlugin ];
      extraConfig."hpaio" = ''
      net 192.168.1.172
      '';
    };
  };

I tried scanimage with sudo:
[~]-> sudo scanimage -L device `v4l:/dev/video0' is a Noname Apple Facetime HD virtual device

@codedmart Unstable unlikely to fix, because your printer is not new, so it should be supported by scanimage. Also nixpkgs is for non-Nixos (for nix installed in other OS), as it misses some of Nixos specifics.

I think the real issue is that hp tools can create a network link to scanner, this is what sane can't do - except you load the special "sane-extra-config.nix" like stated in wiki (I hope you did) and then add it into "configuration.nix".

Hm, I think I run some of hp tools (as user), try hp-diag, hp-setup, hp-scan, hp-doctor (hp-*), which create this link for sane.

As a temporary workaround till its known how to fix, one could cp desktop file locally and add uri manually, ie:
$cp /run/current-system/sw/share/applications/simple-scan.desktop ~/.local/share/applications/
then edit ~/.local/share/applications/ and add printer uri to Exec argument.

Devs have cherrypicked which fixes the enum problem, so 19.03 should get working hp tools really soon.

Also, try $ sudo scanimage --device "hpaio:/net/Photosmart_C4795?ip=192.168.1.172" -L

hp-setup doesn't even work for me. It's a similar python-dbus error. It first prints warning: python-dbus not installed, and then a traceback on line import dbus: ImportError: No module named dbus. I'm on 19.03, nixos-unstable, and hplip version 3.19.6.

I get the same output as yours from hp-doctor dependencies except python-dbus is not found. I'm guessing your output was from before problem 2 was fixed.

hp-setup doesn't even work for me. It's a similar python-dbus error. It first prints warning: python-dbus not installed, and then a traceback on line import dbus: ImportError: No module named dbus. I'm on 19.03, nixos-unstable, and hplip version 3.19.6.

I get the same output as yours from hp-doctor dependencies except python-dbus is not found. I'm guessing your output was from before problem 2 was fixed.

Same here. Did you manage to fix it in the meantime?

I already ran hp-makeuri and scanimage --device ..., but without success:

$ hp-makeuri 172.16.3.1
warning: python-dbus not installed.

HP Linux Imaging and Printing System (ver. 3.19.6)
Device URI Creation Utility ver. 5.0

...

CUPS URI: hp:/net/Officejet_Pro_8600?ip=172.16.3.1
SANE URI: hpaio:/net/Officejet_Pro_8600?ip=172.16.3.1
HP Fax URI: hpfax:/net/Officejet_Pro_8600?ip=172.16.3.1

Done.

$ scanimage --device "hpaio:/net/Officejet_Pro_8600?ip=172.16.3.1" -L
device `v4l:/dev/video0' is a Noname FaceTime HD Camera (Built-in):  virtual device
$ sudo scanimage --device "hpaio:/net/Officejet_Pro_8600?ip=172.16.3.1" -L
device `v4l:/dev/video0' is a Noname FaceTime HD Camera (Built-in):  virtual device

@christianharke try starting it in interactive mode (hp-setup -i). Tell it that you don't want to install another queue. And that should be enough for a printer to start working.

Thank you for your hint @sheepfleece! Unfortunately, I am still not lucky making my scanner work.

In the interactive mode, I get the error:

$ hp-setup -i
warning: python-dbus not installed.

HP Linux Imaging and Printing System (ver. 3.19.6)
Printer/Fax Setup Utility ver. 9.0

...

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


--------------------------------
| SELECT CONNECTION (I/O) TYPE |
--------------------------------

  Num       Connection  Description
            Type
  --------  ----------  ----------------------------------------------------------
  0*        usb         Universal Serial Bus (USB)
  1         net         Network/Ethernet/Wireless (direct connection or JetDirect)

Enter number 0...1 for connection type (q=quit, enter=usb*) ? 1

Using connection type: net

error: No device selected/specified or that supports this functionality.

There seemed to be more luck when passing the printer's ip to hp-setup:

$ hp-setup -i 172.16.3.1
warning: python-dbus not installed.

HP Linux Imaging and Printing System (ver. 3.19.6)
Printer/Fax Setup Utility ver. 9.0

...

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


Setting up device: hp:/net/Officejet_Pro_8600?ip=172.16.3.1



---------------------
| PRINT QUEUE SETUP |
---------------------


please enter a name for this print queue (m=use model name:'Officejet_Pro_8600'*, q=quit) ? q
OK, done.

# I tried it with "hp:/net/Officejet_Pro_8600?ip=172.16.3.1" as well...
$ scanimage --device "hpaio:/net/Officejet_Pro_8600?ip=172.16.3.1" -L
device `v4l:/dev/video0' is a Noname FaceTime HD Camera (Built-in):  virtual device

Same result using sudo. My current user is in following groups:

$ groups
users wheel audio scanner vboxusers docker

Currently using NixOS聽19.09 stable channel. My printing.nix file looks like this:

{ config, pkgs, ...}:

{

  services.printing = {
    enable = true;
    drivers = [ pkgs.hplipWithPlugin ];
  };

  hardware = {
    printers.ensurePrinters = [{
      name = "pr-hp-chr";
      location = "Home Office";
      description = "HP Officejet Pro 8600 Plus";
      deviceUri = "socket://pr-hp-chr";
      model = "drv:///hp/hpcups.drv/hp-officejet_pro_8600.ppd";
      ppdOptions = {
        "PageSize" = "A4";
        "Duplex" = "DuplexNoTumble";
        "InputSlot" = "Tray2";
        "ColorModel" = "RGB";
        "MediaType" = "Plain";
        "OutputMode" = "Normal";
        "OptionDuplex" = "True";
      };
    }];

    sane = {
      enable = true;
      extraBackends = [ pkgs.hplipWithPlugin ];
    };
  };
}

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

still important to me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaibhavsagar picture vaibhavsagar  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

spacekitteh picture spacekitteh  路  3Comments

domenkozar picture domenkozar  路  3Comments

lverns picture lverns  路  3Comments