Feb 18

I recently had to workaround an issue with getting a newly purchased HP Envy 4520 wireless printer work on my home network, and this gave me a good opportunity to write this post.

I was pleasantly surprised to find that HP ships GPL drivers to many of its printers, even the newest ones! It provides useful guides to find what driver supports your hardware, and there is also a full list of supported printers and a general guide on configuring printers for WiFi connections.

All these, and the fact that this printer had full support on the latest driver for GNU/Linux based distributions, made me give HP my money for the HP Envy 4520 model.

Unfortunately, this printer doesn’t have an ethernet port, and HP doesn’t ship a USB cable in the box of this model (which kinda makes sense, as it is advertised as a wireless model). However, you can imagine my disappointment when the hp-setup wizard that comes with the hplip package could not detect my printer. The issue was the same for all three of my laptops (running Chakra, Ubuntu and Lubuntu):  installing hplip and running hp-setup, even when using the latest available driver, could not detect the printer on the local wireless network.

I was presented with this error when selecting the network/ethernet/wireless option:

HPLIP cannot detect printers in your network.
This may be due to existing firewall settings blocking the required ports. When you are in a trusted network environment, you may open the ports for network services like mdns and slp in the firewall. For detailed steps follow the link. http://hplipopensource.com/node/374

wireless configuration of hp-setup fails

At the time of writing this post the http://www.hplipopensource.com/node/374 link mentioned in the popup window  above was not available.

To workaround this I had to go through this short procedure, which will probably work for most wireless HP printers:

1. Boot your printer and follow the instructions on its screen to connect it properly to your local network.

2. Then you need to find the IP address of your printer. The easiest way is by clicking on the wireless configuration icon on the front panel/display of the printer. In my case it the printer IP was 192.168.1.138.

3. Run hp-setup again, but this time click on Show Advanced Options, enable Manual Discovery and enter the IP address of your printer.

Alternatively you could run “hp-setup 192.168.1.138” directly from a terminal, just change the IP address to correspond to your printer’s IP, the one you found in step 2.

hp-setup manual configuration

4. Hit next, and your printer should now show up!

hp-setup printer found

5. After that it was as simple as clicking next and next! =)

I hope this post helps someone! If it does I would be happy to read about it, so please leave a comment to let me know!

 

33 Responses to “Setting up a wireless HP printer on GNU/Linux”

  1. FM33 says:

    For me manual discovery doesn’t work neither. Only Ubuntu’s default printer manager can detect the printer. I opened the port mentioned in the link on software and router firewalls but doesn’t change anything.

  2. tetris4 says:

    @FM33
    Did you try running “hp-setup ENTERIPADDRESSHERE” in a terminal and check for the output? Are you using the correct IP address for the printer?

  3. FM33 says:

    @tetris4
    I figured out that hplip works perfectly with the printer added from default printer manager (that selects hplip driver automatically).
    For another machine I was asked to try “hp-setup IP” and it worked fine.

  4. tetris4 says:

    Glad to see you got it working, enjoy! =)

    Am very satisfied with the experience I had with this printer and nowadays recommend HP printers to everyone.

  5. Jelte says:

    Your a hero! Searched for this solution all night! just add the ip after the hp-setup command. thank you

  6. tetris4 says:

    Thanks for your kind words Jelte! It always feels good to know you have helped a fellow Linux user. =D

  7. copernicus says:

    The default default discovery method is with Simple Location Protocol (SLP). The 4520 does not have an SLP agent. Activate Bonjour on the device and choose mdns as the discovery method.

  8. Yoda says:

    I like HP in regards to printers, but they are far from perfect, and you still have to be very careful with what you buy. I like them because they have for many many years had models that have proper back end support where the sources have been released for select models. It’s kinda hard to decipher the documentation and it’s getting harder- but at least we still have options (though apparently fewer and fewer).

    End user support (I don’t mean phone / email I mean documentation for end-users) is another matter entirely these days. I made a mistake and bought a random HP printer. I just spent 12 hours or so working through a half dozen issues with one model HP printer. The documentation from HP has gotten much worse and HP incorrectly labeled this printer as not requiring a plug-in when it in fact does. However that wasn’t even one of the problems I really had with HP today. Today the documentation for the distribution and version I was using was terrible. It was outdated, missing critical information, the server contained corrupted RPM files and then the hp-setup program didn’t work after the fact because apparently there were dependencies which were never made clear needed to be installed for things to work amongst other issues.

    However backing up a moment if you know where to go for select HP printers you can avoid all this. ThinkPenguin.com stocks a dozen or so of HP’s properly supported models (ie sources available, no plug-ins, etc) even models that’ll work out of the box with distributions built off older software stacks like Debian, Cent OS, RHEL, Trisquel, etc. Many models aren’t even available elsewhere because of the fast turn over. Every six months or so HP releases new models and by the time you go to buy a printer the models that your favorite distribution support aren’t available at retail. Think Penguin makes sure to stock some slightly older models (which more often than not actually have the same general spec) to ensure the current and older releases will work out of the box. The company also lists which major distributions and versions will work out of the box and has all sorts of additional documentation and support for GNU/Linux users.

  9. stef says:

    Thanks a lot!

  10. fp says:

    Works perfectly – thanks a lot!

  11. Bill says:

    Thanks! No longer have to boot to Windows to scan.

  12. tetris4 says:

    So glad to see that this post has been useful! Thanks for leaving a comment, every time I see such a post it makes my day. =)

  13. Chris says:

    I feel kinda dumb that I didn’t realize that manual entry area existed… Thanks so much! Worked perfectly!

  14. francesco says:

    you saved my life!

  15. Joey says:

    Thanks this worked for me!

  16. Mike says:

    Thanks… as per my setup, when you run hp-setup, in the ensuing dialog I find that if you then select the radio button “Wireless…” that the Advanced options (if you show them) are then greyed-out.

    It is only the USB radio button that allows you to check “Manual discovery”.

    As it happens I was able to set up my Wifi connection for scanning (printing had been working anyway) using the “automatic discovery”. As per instructions this was with a USB connection initially … and if you have the good fortune for things to work out (after choosing the local Wifi signal and entering the secret key), you are then told to remove the USB and then run “hp-setup [scanner IP]”…

    Beautiful scans (used in conjuction with Gimp and XSane). Hurrah!

    One more step on the long, hard road from M$ serfdom to the Promised Land.

  17. Tim says:

    Thank you so much – this is the only solution I can find that works. I’ve had to use it twice so far.

  18. tetris4 says:

    Wow, 5 new posts in just a month. It’s great to see such a simple post helping people around the world. =) I really wish HP included some decent Linux instructions in their manual.

  19. Juanjo says:

    Thank you for this tip, I was trying to configure my printer/scan for a couple of days without success until I got your note

  20. Icue says:

    Thank you for the tip, I was getting bananas with this problem!!

  21. Chris says:

    Thanks. This was good for me. I was able to connect the printer to my home network first using android, the IP address was then obtainable by printing out an information page and your solution worked very easily. (HP Deskjet 2620.)

  22. Ray says:

    Sadly I can’t get your excellent solution to work. I’ve tried all the various input hp-check with the IP address etc but I keep coming back to
    HPLIP cannot detect printers in your network.
    This may be due to existing firewall settings blocking the required ports. When you are in a trusted network environment, you may open the ports for network services like mdns and slp in the firewall. For detailed steps follow the link. http://hplipopensource.com/node/375

    My question

  23. Ray says:

    Ran out of space ! My Questio ref, if it helps https://answers.launchpad.net/hplip/+question/684102

  24. tetris4 says:

    Hi Ray, sorry to hear you can’t resolve this. I hope you manage to find a solution or workaround soon. Do keep us posted on how this worked out and I can update the post accordingly for people having similar issues.

  25. Samuel says:

    Very good, thanks!!!

  26. GSAS says:

    I had been having problems with my HP C4580 that I had purchased at a used store for 15($. Pretty old model. Had not been able to install and get to work with Mint when I first used it. Found your article and site, followed instructions, (your screen captures were good) and presto it’s working wireless. Had to find the proper IP address.
    Thank you, great work!

  27. JJ says:

    Works for my HP Envy 5055.

    Thanks!

  28. Someone says:

    Works on HP Photosmart Premium c309g-m Fedora 32

    You\’ve help me use a 10+ years Printer without having to use a 10 meters cable.

    Thanks! I love you <3

  29. Todd says:

    I am running Manjaro and for me both the UI > advanced > manual ip address and the CLI `hp-setup IP_ADDR_HERE` resulted in the firewall error:

    error: HPLIP cannot detect printers in your network. This may be due to existing firewall settings blocking the required ports. … http://hplipopensource.com/node/374

    Though I had no firewall setup

    I had to open `Add / Remove software` then search for and install `Print Settings (system-config-printer)` once installed that application found the printer no problem. I do not understand what it does different though.

  30. Alex says:

    This helped me so much. Thank you. It was all so simple. I use Ubuntu MATE 20.10. I have a HP Envy 6000 series printer.

  31. tetris4 says:

    Thank you all for leaving a comment and sharing your feedback!

    It is satisfying to learn that this post is still helpful.

  32. Me says:

    Thank you very much

  33. Prakash Jose K says:

    The preferred way is to NOT use hplip driver for most hp printers as of now. The method is explained here:
    https://askubuntu.com/questions/1437940/hp-2778-wireless-printer-cannot-add-this-printer-in-ubuntu-22-10-wirelessly-h/1440601#1440601

Leave a Reply

preload preload preload