Solved HPLIP printer setup does not load PPD

Summary:
I am trying to connect to my HP Laserjet MFP 29w.
I first followed the instructions in the Handbook, 9.1 "Quick Start". The print test did not work, so I moved on to installing /print/hplip.
I got stuck at the step 3 of 3 "Setup Device" screen where it asks for the PPD file. I click to browse files, select /usr/local/share/ppd/HP/hp-laserjet_mfp_m28-m31.ppd.gz, and it returns me to the "Setup Device" dialog. The "PPD file:" box still says (Not found. Click browse button to select a PPD file.), and the "Add Printer" button remains grayed-out/unclickable.

First, this is what I did from Handbook, 9.1 "Quick Start":
# mkdir -p /var/spool/lpd/lp
# chown daemon:daemon /var/spool/lpd/lp
# chmod 770 /var/spool/lpd/lp
Edited /etc/printcap to add
Code:
lp:\
        :lp=:rm=NPI031DBF:rp=raw:\
        :sh:\
        :mx#0:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/log/lpd-errs:
Edited /etc/rc.conf to add lpd_enable="YES"
# service lpd start
# printf "1. This printer can print.\n2. This is the second line.\n" | lpr

But nothing printed. There are several files in /var/spool/lpd/lp, I assume from my various attempts to get the printer DNS host name correct in /etc/printcap.

Seeing no success so far, I thought /print/hplip might just do it all. It hasn't yet. First, I got the results described above. After searching for some solutions to this, I ran
Code:
$ cupstestppd /usr/local/share/ppd/HP/hp-laserjet_mfp_m28-m31.ppd.gz
/usr/local/share/ppd/HP/hp-laserjet_mfp_m28-m31.ppd.gz: PASS
        WARN    Size "195x270mm" should be the Adobe standard name "194.73x269.88mm".
        WARN    Size "184x260mm" should be the Adobe standard name "185.21x254mm".
        WARN    Size "Envroc16k" should be the Adobe standard name "Env195.44x273.05mm".
        WARN    Size "8.5x13in" should be the Adobe standard name "FanFoldGermanLegal".
        WARN    Size "216x340mm" should be the Adobe standard name "FanFoldGermanLegal".
        WARN    PCFileName longer than 8.3 in violation of PPD spec.
                REF: Pages 61-62, section 5.3.
So I think that file is fine. I just don't know why printer/hplip appears to disagree.

Ultimately, a few questions:
1. How can I get printer/hplip to load that PPD?
2. Assuming I get the PPD loaded, should I keep everything I did from the Handbook, or undo it? Does printer/hplip use all of that anyway?

-

edit: The solution I found was to add cupsd_enable="YES" to /etc/rc.conf, then reboot. Details in a reply below.
 
Last edited:
Edited /etc/printcap to add
Code:
lp:\
        :lp=:rm=NPI031DBF:rp=raw:\
        :sh:\
        :mx#0:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/log/lpd-errs:
Edited /etc/rc.conf to add lpd_enable="YES"
# service lpd start
# printf "1. This printer can print.\n2. This is the second line.\n" | lpr

But nothing printed. There are several files in /var/spool/lpd/lp, I assume from my various attempts to get the printer DNS host name correct in /etc/printcap.
Does the name NPI031DBF correctly resolve to an IP address? You might try another remote print queue name for the rp parameter. HP printers usually support raw, text, auto and some support binps for binary postscript.
 
I don't know how to test that. Could you please give me a clue? Sorry, I do not understand printers. Learning as I go.

What I can say is printer/hplip discovered the printer during the printer setup, returning
Code:
Model: HP LaserJet MFP m28-m31
IP Address: 192.168.1.126
Host Name: NPI031DBF
Device URI: hp:/net/HP_Laserjet_MFP_M28-M31?ip=192.168.1.126

And this is consistent with what I saw on the HP program installed on the other computer, to which the printer is directly connected by USB. That program returned:
Code:
Name: HP LaserJet MFP M28-M31
Status: Ready
Model Name: HP LaserJet MFP M29w
Installation Status: Installed
Connection Type: USB
Connection Status: Active
Host Name: NPI031DBF
MAC Address: e4-e7-49-03-1d-bf
Product Number: Y5S53A
Serial Number: VNB3R10617
Service ID: 29021

Do I have to do something with the host name, like put it in /etc/hosts?
Will that help /printer/hplip load the PPD?
I'll be working on that for the next hour or so in case that's the answer.
 
What I can say is printer/hplip discovered the printer during the printer setup, returning
Code:
Model: HP LaserJet MFP m28-m31
IP Address: 192.168.1.126
Host Name: NPI031DBF
Device URI: hp:/net/HP_Laserjet_MFP_M28-M31?ip=192.168.1.126

And this is consistent with what I saw on the HP program installed on the other computer, to which the printer is directly connected by USB.
I was under the impression your printer is directly connected to the network (i.e. integrated print server). If it is connected to another machine via USB that machine will probably have to run some software to act as a print server and make the printer available to the network. You could try using that IP address in your /etc/printcap and see if lpd(8) is able to establish a connection.
Code:
lp:\
        :sh:lp=:rm=192.168.1.126:rp=text:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/log/lpd-errs:
 
Sorry, I should've clarified that in the beginning. It didn't occur to me, because even while the other computer is in sleep mode, I can still print from this computer (Windows10), and from my cell phone. All computers are wired to a router, and Windows says this one's wifi is "off", so I assume the print job goes computer-(wire)->router-(wifi)->printer. And I assume the phone connects to the printer directly by wifi.

In other news, I'll mention that hp-setup -i 192.168.1.126 gives me the same result as the graphical program. The program detects the printer as the correct model, but it refuses the PPD file.

I will edit /etc/printcap in a few hours. Thank you for the suggestion.
 
Sorry, I should've clarified that in the beginning. It didn't occur to me, because even while the other computer is in sleep mode, I can still print from this computer (Windows10), and from my cell phone. All computers are wired to a router, and Windows says this one's wifi is "off", so I assume the print job goes computer-(wire)->router-(wifi)->printer. And I assume the phone connects to the printer directly by wifi.
I see now, it has integrated WiFi, so it should basically work just like a wired network printer and the USB connection is only for printing from that one computer attached. Then the printcap should work provided that the IP address is correct and doesn't change. You should check your router whether it assigns a fixed IP address to the printer based on it's MAC address.
 
Success!

Someone had a similar problem on EndeavourOS: https://forum.endeavouros.com/t/hplip-and-file-ppd/461.
This was his solution:
Code:
sudo pacman -S cups gutenprint foomatic-db foomatic-db-engine foomatic-db-nonfree foomatic-db-gutenprint-ppds foomatic-db-ppds foomatic-db-nonfree-ppds splix
sudo systemctl enable --now org.cups.cupsd.service

I already had print/cups installed. I don't know if print/gutenprint or foomatic (or equivalents) would help. So I merely edited /etc/rc.conf to add cupsd_enable="YES", rebooted, and print/hplip immediately entered the correct PPD during printer setup: drv:///hpcups.drv/hp-laserjet_mfp_m28-m31.ppd.

mickey, sadly I did not have any success editing /etc/printcap even after searching online for guides. I appreciate your help and will continue working on that file for future knowledge. It's gradually becoming less mysterious.
 
So this would have been much easier if print/cups was used in the first place without enabling the lpd service and making an /etc/printcap. Cups does not require any of those configurations. Suggest you read the FreeBSD handbook on printing with cups: CUPS

Glad you got it working.
 
Success!
[...]
So I merely edited /etc/rc.conf to add cupsd_enable="YES", rebooted...
It's gradually becoming less mysterious.
Great work!

So dumb that the answer takes days to find, because it is just a silly omission for that not to happen as part of the install.

To clarify some of the mystery, there is logic to where cupsd should be started using rc.conf, depending on situation.
https://docs.freebsd.org/en/books/handbook/config/.

HP says to use the installer for HPLIP rather than the freebsd standard $ pkg install. https://developers.hp.com/hp-linux-imaging-and-printing/install/install/index?language=es but HP has no specific "installer" for FreeBSD.
 
print/hplip, lpd(8), and print/cups are mutually exclusive. All three provide completely separate print spooling mechanisms. [hplip and cups offer scanning and faxing too - but I'll ignore that.]

print/cups installs lpr/lpd commands in /usr/local which usurp the original Berkeley ones (which is *really* annoying).

However print/hplip installs a bunch of ppd files that cups(1) is very happy to use.

You can download ppd files in the hplip tarball for all HP printers from the HP Developers website. You can then extract the ppd files, for use by cups, without having to install the hplip application.
 
Back
Top