Feb 18

I haven’t blogged for a while now, since I am contributing most of my time and efforts into Chakra, a GNU/Linux distribution with an emphasis on KDE/Qt technologies, a unique half-rolling release model, and an amazing community!

But 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. Finally, a guide for running hp-setup to setup your printer is available.

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 hpsetup even using the latest driver (at the moment of writing 3.15.11) 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. HP again offers some useful information on their website. The easiest way is to find it through the front panel/display of the printer, by browsing to the wireless configuration. If you can find it there, you can go ahead with step 3.

In case you can’t locate that, you can run ifconfig on your desktop or laptop and get the local IP range (in my case it reported 192.168.1.x, you should replace this with yours accordingly).
Then run nmap -sn 192.168.1.* (special thanks to Ram-Z for introducing me to nmap) to scan for the connected devices on the defined range:

[tetris4@lappy ~]$ nmap -sn 192.168.1.*

Starting Nmap 7.00 ( https://nmap.org ) at 2016-02-17 22:40 CET
Nmap scan report for
Host is up (0.0017s latency).
Nmap scan report for
Host is up (0.061s latency).
Nmap scan report for
Host is up (0.010s latency).
Nmap scan report for
Host is up (0.00039s latency).
Nmap scan report for
Host is up (0.0076s latency).
Nmap done: 256 IP addresses (5 hosts up) scanned in 3.20 seconds

Knowing the IPs for my laptops and phones (you can check through the settings on your phone and ifconfig on your desktop/laptop), it wasn’t hard to realize that my printer’s IP address is

3. Run again hp-setup, but this time click on Show Advanced Options, enable Manual Discovery and enter the IP address of your printer. Alternatively I could run “hp-setup” directly from a terminal.

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!


7 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:

    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:

    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.

Leave a Reply

preload preload preload