HP Printers and Hardware on Linux
Install HPLIP and CUPS on Linux to print and scan with HP printers. Covers USB and network setup, SANE scanning, and common troubleshooting steps.
Before you start
- ▸An HP printer connected via USB or on the same local network
- ▸sudo or root access on the Linux system
- ▸Active internet connection for package installation and the hp-plugin if needed
HP printers are among the best-supported hardware on Linux, largely thanks to HP's own HPLIP (HP Linux Imaging and Printing) project. With the right packages installed, most HP inkjet and laser printers work for printing and scanning out of the box. This guide walks through installing HPLIP and CUPS, adding your printer, scanning with SANE, and fixing the most common problems.
How HP Printing Works on Linux
The stack has three layers. CUPS is the print spooler — it manages queues and talks to hardware. HPLIP provides HP-specific drivers, PPD files, and the hp-setup tool. SANE (Scanner Access Now Easy) handles the scanning side. HPLIP bundles its own SANE backend called hpaio, so all-in-one devices work through a single package set.
Step 1: Install CUPS
CUPS is almost certainly already installed on a desktop system, but confirm and enable it.
Debian / Ubuntu
sudo apt update
sudo apt install cups cups-client
Fedora / RHEL / Rocky
sudo dnf install cups
Arch
sudo pacman -S cups
Enable and start the CUPS daemon with systemd, then allow your user to manage printers without sudo by adding yourself to the lpadmin group (called sys on Arch).
sudo systemctl enable --now cups
# Debian/Ubuntu/Fedora
sudo usermod -aG lpadmin $USER
# Arch
sudo usermod -aG sys $USER
Log out and back in for the group change to take effect.
Step 2: Install HPLIP
HPLIP ships in every major distro's repositories. The repo version lags behind the upstream release at developers.hp.com, but it is stable, patched, and sufficient for almost all printers released before 2023. For very new models you may need the upstream installer — the HP site will tell you.
Debian / Ubuntu
sudo apt install hplip hplip-gui
Fedora / RHEL / Rocky
sudo dnf install hplip hplip-gui
Arch
sudo pacman -S hplip python-pyqt5
hplip-gui (or python-pyqt5 on Arch) provides the graphical HP Device Manager. It is optional but useful for ink-level monitoring and firmware updates.
Step 3: Add the Printer
Connect the printer via USB or make sure it is on the same network segment. HP's hp-setup is the easiest route — it detects the device, downloads or selects the correct PPD, and registers it with CUPS automatically.
hp-setup
This opens a GUI wizard. Select the connection type (USB, network, or wireless), let it discover the device, accept or confirm the driver, and click Add Printer. If you prefer the terminal:
hp-setup -i
For network printers that are not auto-discovered, supply the IP address directly:
hp-setup -i 192.168.1.50
You can also use the CUPS web interface at http://localhost:631 — go to Administration → Add Printer. CUPS will list detected HP devices and suggest the correct driver from HPLIP.
Setting a Default Printer
# List installed printers
lpstat -p -d
# Set default (replace HP_LaserJet_Pro with your queue name)
lpoptions -d HP_LaserJet_Pro
Step 4: Verify Printing
Send a test page from the command line before trusting GUI apps.
hp-testpage
Or with standard CUPS tools:
echo "Linux Junkies test" | lp
Check the queue if nothing happens:
lpq
Step 5: Scanning with SANE and HPLIP
HPLIP includes the hpaio SANE backend for HP all-in-one devices. Install SANE tools and confirm the backend is registered.
Debian / Ubuntu
sudo apt install sane-utils libsane-hpaio xsane
Fedora / RHEL / Rocky
sudo dnf install sane-backends sane-backends-hp hplip
Arch
sudo pacman -S sane
Add your user to the scanner and lp groups so SANE can access the device without root.
sudo usermod -aG scanner,lp $USER
Verify SANE can see the scanner:
scanimage -L
Output will look something like: device `hpaio:/usb/HP_DeskJet?serial=CN123...' is a HP DeskJet flatbed scanner. If the device appears, scan a test page to a file:
scanimage --device "hpaio:/usb/HP_DeskJet?serial=CN123" \
--format=png --resolution 300 > ~/test-scan.png
For a graphical scan application, Simple Scan (GNOME) or Skanlite (KDE) both use the SANE backend transparently and are easier for day-to-day use.
# GNOME
sudo apt install simple-scan # Debian/Ubuntu
sudo dnf install simple-scan # Fedora
# KDE
sudo apt install skanlite
sudo dnf install skanlite
Step 6: Network Scanning (hpaio over IP)
If your all-in-one is connected over the network rather than USB, SANE needs the IP address. Edit (or create) /etc/sane.d/hpaio.conf and add the device URI:
echo "hpaio:/net/HP_OfficeJet?ip=192.168.1.50" | sudo tee -a /etc/sane.d/hpaio.conf
Then run scanimage -L again to confirm detection. Some HP network scanners also support the airscan (eSCL/WSD) protocol — install sane-airscan if available for your distro as a more reliable alternative.
# Debian/Ubuntu
sudo apt install sane-airscan
# Fedora
sudo dnf install sane-airscan
Troubleshooting
Printer shows "stopped" or jobs are held
This usually means a driver or permission issue. Restart CUPS and check the error log:
sudo systemctl restart cups
sudo journalctl -u cups -n 50 --no-pager
hp-setup can't find the printer on the network
HP printers use mDNS for discovery. Make sure Avahi is running:
sudo systemctl enable --now avahi-daemon
Also check that your firewall allows mDNS (UDP port 5353) and IPP (TCP port 631).
scanimage -L returns no devices
Confirm the hpaio backend is loaded:
grep hpaio /etc/sane.d/dll.conf
If the line is commented out, uncomment it. Also verify the user is in the scanner group with groups $USER. A fresh login is required after group changes.
Missing plugin (hp-plugin)
Some HP LaserJet and OfficeJet models require a proprietary binary plugin (for PDLS/LLCS rendering). HPLIP will tell you during setup. Download and install it with:
sudo hp-plugin
This downloads the plugin from HP's servers and installs it into /usr/share/hplip/. An internet connection is required at install time.
Printer works but produces garbled output
Re-select the driver. Open the CUPS web UI at http://localhost:631, click the printer, choose Modify Printer, and try the HP Recommended or Foomatic/hpcups driver instead of a generic PostScript one.
Frequently asked questions
- Do I need the upstream HPLIP installer from HP's website instead of my distro's package?
- Usually no. The distro package is stable and covers printers released up to a year or two before the current LTS. Only install the upstream version if hp-setup explicitly says your model is unsupported or if you need a very recent printer.
- My HP all-in-one prints fine but the scanner is not detected. Why?
- The most common causes are: missing libsane-hpaio package, the user not being in the scanner group, or the hpaio line being commented out in /etc/sane.d/dll.conf. Check all three, then log out and back in.
- Can I print over Wi-Fi without hp-setup if I know the IP address?
- Yes. Add the printer in the CUPS web UI at http://localhost:631 using the URI ipp://192.168.1.50/ipp/print and select the HP driver from the list. This bypasses hp-setup entirely.
- What is the hp-plugin and is it safe to install?
- It is a closed-source binary from HP required by certain models for advanced rendering (PDLS/LLCS). It is downloaded directly from HP's servers and verified with a GPG signature. It is safe in the sense that it comes from the hardware manufacturer, but it is not open source.
- Will my HP printer work on Wayland without any special configuration?
- Printing itself is handled by CUPS in the background and is Wayland-agnostic. The hp-toolbox and hp-setup GUI tools use Qt/GTK and work under Wayland on modern HPLIP versions, though if you see rendering issues you can run them with XWayland by prefixing the command with QT_QPA_PLATFORM=xcb.
Related guides
Linux Clipboards Explained (+ Clipboard Managers)
Learn the difference between Linux's PRIMARY and CLIPBOARD selections, use xclip, xsel, and wl-clipboard from the terminal, and manage history with GPaste or Klipper.
Configure LibreOffice for Daily Use
Configure LibreOffice for daily use: set default save formats for MS Office interop, tune autosave, install fonts, and add productivity extensions.
Configure the Touchpad and Multitouch Gestures
Configure Linux touchpad behavior and multitouch gestures using libinput, libinput-gestures, and native GNOME and KDE Plasma settings on both Wayland and X11.
Wayland vs X11: How to Choose and Configure Each
Know when to run Wayland or X11, how to check your current session, switch at login with GDM/SDDM/LightDM, and handle NVIDIA and XWayland edge cases.