# [Seemingly Solved] HPLIP Network printer

## optiluca

EDIT:  The SAMBA issue is also sporadically occurring on my other gentoo system, so I guess my theory that the two issues were related was wrong, hence the change of title, as I will be splitting the thread.  The jury is still out as far as the HPLIP/CUPS issue goes though...

Issue # 2 is affecting network printing.  I have emerged hplip, and ran hp-setup, which successfully found and added my hp network printer.  However, any attempt to access this printer yields:

 *Quote:*   

> Photosmart_C5100_series Printer (Printer) Device communication error (5012)

 

The strange thing is that this Gentoo installation is a carbon copy of another which is perfectly functional in both respects, in the sense that it inherits the same make.conf, package.use files, and has pretty much the same programs running as well.

I am sure this stuff requires more debugging info, so feel free to ask for whatever is needed  :Smile:   In the meantime, here is my emerge --info

 *Quote:*   

> Portage 2.2_rc82 (default/linux/amd64/10.0/desktop/kde, gcc-4.4.4, glibc-2.12.1-r1, 2.6.35-zen2 x86_64)
> 
> =================================================================
> 
> System uname: Linux-2.6.35-zen2-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_820_@_1.73GHz-with-gentoo-2.0.1
> ...

 

----------

## maxime1986

I am not an expert so take what I will say with caution...

The fact iptables isn't installed doesn't mean there is no firewall rule.

Iptables is just a frontend to configure the kernel firewall rules.

In fact, the default firewall rule is "everything open" so it's shouldn't change anything for you. But I think you should install iptables and check... just to be sure.

You also should verify you are not blocked on the server...

----------

## optiluca

Samba just started working fine by itself a while ago, now it just stopped again.  Whatever the issue is, it is pretty sporadic...  I will try installing iptables, though I doubt it will do much.  Thanks anyway though   :Very Happy: 

EDIT: No change after installing iptables and setting up a minimal config unfortunately.  Still open to any assistance   :Smile: 

----------

## optiluca

Split the two issues into separate threads, as they seem to be unrelated after all

----------

## bobspencer123

Probably would help to describe a couple of things and post some configs:

description: What does your internal network look like? What do you mean by your "hp network printer"? Is this a printer that is hooked up to another computer that you are trying to print from other computers on? Or is it truly a network printer that has it's own NIC, IP, etc.. (I have no experience with those). 

Configs that would probably help (i'm going from memory on these so spelling/syntax may not be perfect)

/etc/samba/smb.conf

## though samba isn't needed for network printing between *nix boxes only with windows.

/etc/cups/cupsd.conf

## on both clients and server

/etc/cups/clients.conf

## on both clients and server

Do you have the usblp0 module in kernel? If so, this can cause problems with the newer version of HPLIP as it no longer uses that protocol. If you do I would remove module completely and rebuild kernel and see if that helps. 

Can you other computers recognize the printer, i.e. 

```

lpstat -a

```

It might also have something do with the elog message that has just started popping up with HPLIP ... though I didn't need to change anything

 *Quote:*   

> 
> 
> "Starting with versions of hplip >=3.9.8 mDNS is the default network
> 
> search mechanism. To make use of it you need to activate the zeroconf flag on cups. If you prefer the SLP method you have to choose this when configuring
> ...

 

I see you have the zeroconf use flag ... but quite frankly I don't know squat about this message. But, maybe someone else does  :Smile: 

----------

## optiluca

 *bobspencer123 wrote:*   

> Probably would help to describe a couple of things and post some configs:
> 
> description: What does your internal network look like? What do you mean by your "hp network printer"? Is this a printer that is hooked up to another computer that you are trying to print from other computers on? Or is it truly a network printer that has it's own NIC, IP, etc.. (I have no experience with those). 
> 
> 

 

Truly network printer, plugged into router via switch, on static IP address 192.168.0.100, functioning just fine from all networked computers running windows 7 / vista, as well as my other gentoo installation.

 *Quote:*   

> Configs that would probably help (i'm going from memory on these so spelling/syntax may not be perfect)
> 
> /etc/samba/smb.conf
> 
> ## though samba isn't needed for network printing between *nix boxes only with windows.

 

Not involved, but here goes

```

#======================= Global Settings =====================================

[global]

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH

   workgroup = WORKGROUP

# server string is the equivalent of the NT Description field

  server string = Samba

# Security mode. Defines in which mode Samba will operate. Possible 

# values are share, user, server, domain and ads. Most people will want 

# user level security. See the Samba-HOWTO-Collection for details.

   security = user

# This option is important for security. It allows you to restrict

# connections to machines which are on your local network. The

# following example restricts access to two C class networks and

# the "loopback" interface. For more examples of the syntax see

# the smb.conf man page

   hosts allow = 192.168.0.

# this tells Samba to use a separate log file for each machine

# that connects

   log file = /var/log/samba/log.%m

# Put a capping on the size of the log files (in Kb).

   max log size = 50

# Backend to store user information in. New installations should 

# use either tdbsam or ldapsam. smbpasswd is available for backwards 

# compatibility. tdbsam requires no further configuration.

   passdb backend = tdbsam

# Browser Control Options:

# set local master to no if you don't want Samba to become a master

# browser on your network. Otherwise the normal election rules apply

   local master = no

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

# via DNS nslookups. The default is NO.

   dns proxy = no 

#============================ Share Definitions ==============================

[homes]

   comment = User Directories

   browseable = no

   writable = yes
```

 *Quote:*   

> /etc/cups/cupsd.conf
> 
> ## on both clients and server

 

No server, here is my cupsd.conf

```
#

LogLevel warn

SystemGroup lpadmin

Listen localhost:631

Listen /var/run/cups/cups.sock

Browsing On

BrowseOrder allow,deny

BrowseAllow all

BrowseLocalProtocols CUPS

DefaultAuthType Basic

<Location />

  Order allow,deny

</Location>

<Location /admin>

  Order allow,deny

</Location>

<Location /admin/conf>

  AuthType Default

  Require user @SYSTEM

  Order allow,deny

</Location>

<Policy default>

  # Job-related operations must be done by the owner or an administrator...

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>

    Require user @OWNER @SYSTEM

    Order deny,allow

  </Limit>

  # All administration operations require an administrator to authenticate...

  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>

    AuthType Default

    Require user @SYSTEM

    Order deny,allow

  </Limit>

  # All printer operations require a printer operator to authenticate...

  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>

    AuthType Default

    Require user @SYSTEM

    Order deny,allow

  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...

  <Limit Cancel-Job CUPS-Authenticate-Job>

    Require user @OWNER @SYSTEM

    Order deny,allow

  </Limit>

  <Limit All>

    Order deny,allow

  </Limit>

</Policy>

# Set the authenticated printer/job policies...

<Policy authenticated>

  # Job-related operations must be done by the owner or an administrator...

  <Limit Create-Job Print-Job Print-URI>

    AuthType Default

    Order deny,allow

  </Limit>

  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>

    AuthType Default

    Require user @OWNER @SYSTEM

    Order deny,allow

  </Limit>

  # All administration operations require an administrator to authenticate...

  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>

    AuthType Default

    Require user @SYSTEM

    Order deny,allow

  </Limit>

  # All printer operations require a printer operator to authenticate...

  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>

    AuthType Default

    Require user @SYSTEM

    Order deny,allow

  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...

  <Limit Cancel-Job CUPS-Authenticate-Job>

    AuthType Default

    Require user @OWNER @SYSTEM

    Order deny,allow

  </Limit>

  <Limit All>

    Order deny,allow

  </Limit>

</Policy>

#

# End of "$Id: cupsd.conf.in 8805 2009-08-31 16:34:06Z mike $".

#
```

I have not touched this file, all this stuff must be default I guess...  I just ran hp-setup directly.  Is it normal for the permissions to be such that I cannot even view the file as a normal user though?  Because that's what I am getting...

 *Quote:*   

> /etc/cups/clients.conf
> 
> ## on both clients and server

 

```
ServerName /var/run/cups/cups.sock
```

Same as above, and yes that is the entire file  :Razz: 

 *Quote:*   

> Do you have the usblp0 module in kernel? If so, this can cause problems with the newer version of HPLIP as it no longer uses that protocol. If you do I would remove module completely and rebuild kernel and see if that helps. 

 

Couldn't find the related setting, I have no /dev/usblp0 node if that would be an indicator

 *Quote:*   

> Can you other computers recognize the printer, i.e. 
> 
> ```
> 
> lpstat -a
> ...

 

```
optipad linux # lpstat -a

Photosmart_C5100 accepting requests since Mon 13 Sep 2010 15:38:41 CEST
```

Indeed

 *Quote:*   

> It might also have something do with the elog message that has just started popping up with HPLIP ... though I didn't need to change anything
> 
>  *Quote:*   
> 
> "Starting with versions of hplip >=3.9.8 mDNS is the default network
> ...

 

I would enable the flag on cups if it was there :S

```
equery h zeroconf

 * Searching for USE flag zeroconf ... 

[IP-] [  ] kde-base/kdelibs-4.5.1:4.5

[IP-] [  ] kde-base/kdnssd-4.5.1:4.5

[IP-] [  ] kde-base/kopete-4.5.1:4.5

[IP-] [  ] kde-base/krdc-4.5.1:4.5

[IP-] [  ] kde-base/krfb-4.5.1:4.5

[IP-] [  ] net-misc/dhcpcd-5.2.7:0

```

Thanks for the help  :Smile: 

----------

## bobspencer123

any chance this is a permission problem?

as root

```

# lp sometextfile.txt

```

----------

## optiluca

 *bobspencer123 wrote:*   

> any chance this is a permission problem?
> 
> as root
> 
> ```
> ...

 

Both as root and as my normal user I get the following:

 *Quote:*   

> lp -d Photosmart_C5100 exclude.txt
> 
> request id is Photosmart_C5100-2 (1 file(s))

 

The 2 becomes a 3 etc etc if I try again.  Nothing actually prints, and opening the hp toolbox to investigate gives me the usual error.  Opening up the cups control panel for the printer gives me :

 *Quote:*   

> Photosmart_C5100-2      exclude.txt      luca      1k      1      pending since Fri 24 Sep 2010 22:04:40 CEST 
> 
> "/usr/libexec/cups/backend/hp failed"     
> 
> 

 

Any idea as to what that error implies?

----------

## bobspencer123

are you using the "hpcups" use flag ..

emerge -va hplip

edit:

if yes, which I am now assuming is because I think it's the default.

You might want to try to edit /etc/cups/clients.conf

Servername 192.168.0.100

I do this from my other machines that aren't actually running the printer. I don't have a true networked printer like you though. I hook my printer up to a server (through usb) and then point my other computers at the ip of that computer. It might be similar though since the printer has its own ip. But, I don't really know since I have never used a "real" network printer.

edit 2: It looks like cups may have been downgrade recently. If you are using 1.3.11-r2 you should try the avahi use flag and zeroconf flag.

----------

## optiluca

 *bobspencer123 wrote:*   

> are you using the "hpcups" use flag ..
> 
> emerge -va hplip
> 
> edit:
> ...

 

Added that line (the hpcups flag is enabled), restarted the cups service, no change I am afraid.  As for the use flags, I have neither on cups 1.4.4-r2 (I'm on ~amd64)

Thanks for your help though   :Smile: 

----------

## bobspencer123

can you set the loglevel to debug in cupsd.conf

and then post the "relevant" ouput of

```

/var/log/cups/error_log

```

when you do the lp -d "printer name" sometxt.txt

----------

## optiluca

Positively impressed at the amount of info cups managed to produce there   :Laughing: 

Anyway..

 *Quote:*   

> I [25/Sep/2010:18:08:00 +0200] Listening to ::1:631 (IPv6)
> 
> I [25/Sep/2010:18:08:00 +0200] Listening to 127.0.0.1:631 (IPv4)
> 
> I [25/Sep/2010:18:08:00 +0200] Listening to /var/run/cups/cups.sock (Domain)
> ...

 

I get the impression some of that output was caused by me visiting the cups server web page to see if there was any progress, but all it says is "pending".  Any obvious clues in there anyway?

Thanks again   :Smile: 

----------

## bobspencer123

nothing in there that I see 

how about same thing with access_log and page_log

----------

## optiluca

access_log

 *Quote:*   

> localhost - - [26/Sep/2010:23:28:21 +0200] "POST /printers/Photosmart_C5100 HTTP/1.1" 200 361 Create-Job successful-ok
> 
> localhost - - [26/Sep/2010:23:28:21 +0200] "POST /printers/Photosmart_C5100 HTTP/1.1" 200 488 Send-Document successful-ok
> 
> localhost - - [26/Sep/2010:23:28:35 +0200] "POST /jobs HTTP/1.1" 401 139 Cancel-Job successful-ok

 

The cancellation is me cancelling the job manually I believe, after it just sits "pending", and opening hp-toolbox throws the usual errors.

page_log

Nothing at all relating to this job, the entire file has 2 lines:

 *Quote:*   

> Photosmart_C5100 1 luca [23/Aug/2010:09:25:06 +0200] 1 1DEBUG2: - localhost Gmail - Tageskarten ReservationsbestÃ¤tigung - -
> 
> Photosmart_C5100 2 luca [24/Sep/2010:22:04:41 +0200] 1 1DEBUG2: - localhost exclude.txt - -
> 
> 

 

They both look alright as far as I can tell, the only error outside hplip that I can see is that

 *Quote:*   

> "/usr/libexec/cups/backend/hp failed"

 

message in the CUPS printer page.  I have tried googling that string, and I hit the following

https://bugs.gentoo.org/287156 ,  https://forums.gentoo.org/viewtopic-t-663161-start-0.html , http://www.rrbrussell.com/node/23 .  I already have what should be the functioning USE flags enabled though..   :Confused: 

EDIT: Eureka!  Following a hint in the bug report, where the poster provisionally fixed the issue by changing the network search method from mDNS to SLP, I tried the same and the hp-toolbox successfully connects.  I am out of ink for actually trying to print, but it seems solved, and I shall mark it as such once I have tested it.  Time to re open that bug report by the looks of it...

Thanks for your help

----------

## bobspencer123

great clad you got it figured out. I thought that maybe it had something to do with mdns vs. slp but it's weird that there weren't any error's in the logs about this (like it that bug report -- I also had read that which is why I originally began asking for logs). 

It seems that printing can be very mysterious sometimes with linux.

----------

## optiluca

Hadn't tried /var/log/messages, and here goes..

 *Quote:*   

> Sep 26 23:47:20 optipad python2: io/hpmud/jd.c 780: error timeout mdns lookup Printer.local
> 
> Sep 26 23:47:21 optipad python2: io/hpmud/jd.c 784: mdns lookup Printer.local retry 1...
> 
> Sep 26 23:47:21 optipad python2: io/hpmud/jd.c 784: mdns lookup Printer.local retry 2...
> ...

 

I re opened the bug, but apparently since what used to be the fix is not supported anymore (using zeroconf), the fact that a network printer doesn't work by default is not a bug anymore...  Whatever, my issue is solved and hopefully this thread will help others who can't get a networked hp printer running.

Thanks again   :Very Happy: 

----------

## myceliv

 *optiluca wrote:*   

> 
> 
> EDIT: Eureka!  Following a hint in the bug report, where the poster provisionally fixed the issue by changing the network search method from mDNS to SLP, I tried the same and the hp-toolbox successfully connects.  ... it seems solved, and I shall mark it as such once I have tested it. ....

 

Yes, thanks very much for that, this finally got me back up and running again. I kept trying to work out how to enable SLP since I've been on cups-1.4 without much success. "you have to enable it when configuring the device" from the elog didn't make sense to me. I kept looking for a cups or hplip slp use flag, and never found hp-setup's mDNS/SLP pull-down till re-reading the bug you mentioned about 12 times.

Now it seems very obvious what the hplip ebuild is trying to say. For everyone else as stupid as me: "If you are running cups-1.4.x then run hp-setup (again), click Network/Ethernet and 'Show Advanced Options', pull down and select SLP for Network Discovery. If it's the first time you set up your printer, then finish the rest of hp-setup, but if you just needed to change to SLP then that's it, you can exit setup." (Hurrah, fast draft mode works well now, too!)

----------

## urcindalo

 *myceliv wrote:*   

> For everyone else as stupid as me

 

Thanks, thanks, thanks, thanks, thanks....

I spent the past whole Friday morning trying to print to my network attached HP OfficeJet Pro 8000. For no reason it had stopped working. Now I'm back in business.

----------

## thomasn

 *myceliv wrote:*   

> For everyone else as stupid as me...

 

Wow, I am seriously hopeless at using GUIs... I had looked for that option as per the hplip ebuild and not seen it until your impeccable instructions. Thank you so much, my HP Officejet Pro 8500A Plus now responds beautifully.

-- Thomas

----------

