How to Install HPLIP on Ubuntu (26.04, 24.04, 22.04)

Install HPLIP on Ubuntu to get reliable HP printing, scanning, and fax support through CUPS, plus tools like HP Device Manager for setup and maintenance. This is especially helpful for USB printers, older networked HP models, and multifunction devices that need features beyond driverless IPP. By the end, you will have HPLIP installed, your printer added, and a verified print and scan test.

This guide walks through the APT packages, HPโ€™s automatic .run installer, manual source compilation, and the HPLIP Printer Application snap. It also covers compatibility checks, plugin installation, USB and network setup, and troubleshooting so you can finish the job without guessing.

Check HP Device Compatibility

Not every HP device is supported, and newer models can require a newer HPLIP release. The HPLIP source tarball includes a models database that lists the minimum required HPLIP version (support-ver) and whether a proprietary plugin is needed (plugin=1). Use the commands below to download the latest models file and search for your printer model.

Replace the example model string with your exact printer name from the label or device menu.

latest_version=$(curl -fsSL "https://sourceforge.net/projects/hplip/rss?path=/hplip" | grep -oE '/hplip/[0-9]+\.[0-9]+\.[0-9]+/' | sed -e 's|/hplip/||' -e 's|/||' | sort -V | tail -n 1)
curl -fL -o "hplip-${latest_version}.tar.gz" "https://sourceforge.net/projects/hplip/files/hplip/${latest_version}/hplip-${latest_version}.tar.gz/download"
tar -xf "hplip-${latest_version}.tar.gz" "hplip-${latest_version}/data/models/models.dat"
grep -n -i -A 30 -B 2 "OfficeJet All-in-One Printer" "hplip-${latest_version}/data/models/models.dat" | head -n 30

Example output from the models file looks like this:

38-job-storage=0
39-linefeed-cal-type=0
40:model1=HP OfficeJet All-in-One Printer
41-monitor-type=0
42-panel-check-type=0
43-pcard-type=0
44-plugin=0
45-plugin-reason=0
46-power-settings=0
47-pq-diag-type=0
48-r-type=0
49-r0-agent1-kind=3
50-r0-agent1-sku=26(51626A)
51-r0-agent1-type=1
52-scan-src=0
53-scan-type=0
54-status-battery-check=0
55-status-dynamic-counters=0
56-status-type=0
57-support-released=True
58-support-subtype=2de2
59-support-type=2
60-support-ver=0.9.5
61-tech-class=DJ540
62-family-class=PCL4-Class1
63-tech-subclass=GrayscaleOnly
64-tech-type=1
65-usb-pid=0
66-usb-vid=3f0
67-wifi-config=0

Look for the support-ver value in the output. If your installed HPLIP version is lower than that number, choose the manual installer or source build so the required driver files are available.

If your device requires a newer HPLIP version than the Ubuntu packages provide, move to the manual installer or source build sections later in this guide. Use the models database output to confirm the minimum required version before you choose a method.

Choose Your HPLIP Installation Method

HPLIP offers multiple installation paths depending on your Ubuntu release and how new your device is. Ubuntuโ€™s APT repositories prioritize stability and integrate cleanly with CUPS, while HPโ€™s manual installer and source builds provide newer device support at the cost of manual updates. The Snap-based printer application is a sandboxed alternative that focuses on printing through a web interface.

MethodChannelStabilityBest For
APT (Ubuntu Repositories)Ubuntu ReposHigh โ€“ stable, updates through Ubuntu repositoriesMost users who want full printing and scanning features with minimal maintenance
HP Manual Installer or Source TarballSourceForgeMedium โ€“ newest device support, manual updatesNewer HP devices that need a higher HPLIP version than Ubuntu provides
Snap (hplip-printer-app)Snap StoreHigh โ€“ sandboxed, automatic updatesPrinting-only workflows that prefer a web UI and isolated drivers

Recommended: Use the APT packages unless your device needs a newer HPLIP release than Ubuntu provides. Manual installs deliver newer device support but require manual updates.

These instructions cover Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. The APT packages ship different HPLIP versions (26.04: 3.24.4, 24.04: 3.23.12, 22.04: 3.21.12), so choose the manual installer or source build when your device needs a newer release. The steps for each method stay the same across supported LTS versions.

Update Ubuntu Before Installing HPLIP

Before installing HPLIP, first update your system packages to ensure compatibility and minimize potential conflicts during installation. Run the following command to update and upgrade your packages:

sudo apt update && sudo apt upgrade

Check for Existing HPLIP Installation

Many Ubuntu installations include HPLIP by default. Before proceeding, verify whether HPLIP is already installed and check if the version meets your device requirements:

dpkg -l | grep -E '^ii[[:space:]]+hplip'

If HPLIP is installed, youโ€™ll see output similar to:

ii  hplip         3.24.4+dfsg0-0ubuntu5  amd64  HP Linux Printing and Imaging System (HPLIP)
ii  hplip-data    3.24.4+dfsg0-0ubuntu5  all    HP Linux Printing and Imaging - data files

The version number appears in the third column (3.24.4 in this example). Compare it with the support-ver value from the models database in the HPLIP source tarball. If your installed version is older than required, move to the manual installer or source build sections later in this guide. If no packages appear, proceed with the installation steps below.

Install HPLIP via APT (Recommended)

Install HPLIP from Ubuntuโ€™s repositories for the most stable integration. The installation includes four main packages:

  • hplip: Core drivers and command-line utilities
  • hplip-data: Device configuration files and printer definitions
  • hplip-gui: Graphical interface tools (HP Device Manager, setup wizard)
  • hplip-doc: Documentation and help files (optional)

Run the following command to install all packages:

sudo apt install hplip hplip-data hplip-gui hplip-doc

After installation completes, verify HPLIP installed correctly by checking the package status:

dpkg -l | grep -E '^ii[[:space:]]+hplip' | head -4
ii  hplip                          3.24.4+dfsg0-0ubuntu5            amd64  HP Linux Printing and Imaging System (HPLIP)
ii  hplip-data                     3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - data files
ii  hplip-doc                      3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - documentation
ii  hplip-gui                      3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - GUI utilities (Qt-based)

Server users can skip hplip-gui and hplip-doc if graphical tools and documentation are not needed:

sudo apt install hplip hplip-data

Proprietary Plugin Requirements

Some HP devices need a proprietary plugin for full functionality, especially on models that rely on HP-specific print languages. The models database marks this with plugin=1, and the hp-plugin tool downloads the binary after you accept HPโ€™s license agreement.

If the database shows a plugin requirement, install it before running the setup wizard so HPLIP can detect all device features.

Install HPLIP via Manual Build from Source

Use the manual methods when the Ubuntu packages are too old for your device. HP provides an automatic .run installer that handles dependencies, plus the source tarball for a full manual build. These installs sit outside APT, so you handle updates manually.

Option 1: HP Automatic Installer (Recommended for Manual Installation)

HPโ€™s automatic installer script checks system dependencies, configures build options for Ubuntu, and installs the version you downloaded. This method works well for users who need newer versions without manual compilation complexity.

If curl is missing on your system, install it first:

sudo apt install curl

Download and run the automatic installer:

curl -fL -o hplip-3.25.8.run https://sourceforge.net/projects/hplip/files/hplip/3.25.8/hplip-3.25.8.run/download
chmod +x hplip-3.25.8.run
./hplip-3.25.8.run

Replace 3.25.8 with the current version listed on the HPLIP SourceForge download page. The installer script presents an interactive menu that guides you through dependency checks, build configuration, and installation. Follow the on-screen prompts, which will notify you of any missing dependencies and offer to install them automatically.

The automatic installer requires build tools (gcc, make) and development libraries. If dependency installation fails, the installer displays specific package names. Install them manually with sudo apt install <package-name> and re-run the installer.

Option 2: Manual Tarball Compilation

For complete control over build options and installation paths, compile HPLIP from the source tarball. This method suits advanced users who need to customize features or integrate HPLIP into custom distributions.

If you already installed HPLIP from APT, remove those packages before installing from source to avoid file conflicts.

First, install the build dependencies that every supported Ubuntu release needs:

sudo apt install build-essential curl gawk pkg-config libcups2-dev libdbus-1-dev libavahi-client-dev \
libavahi-core-dev libavahi-common-dev libusb-1.0-0-dev libjpeg-dev libsnmp-dev libssl-dev \
libtool libtool-bin python3-dev python3-pyqt5 python3-dbus python3-gi python3-pil \
python-is-python3 libsane-dev sane-utils avahi-utils cups-ppdc

Create a build directory in your home folder so cleanup is simple later:

mkdir -p ~/hplip-src
cd ~/hplip-src

Download and extract the HPLIP tarball (replace the version with the current release from the HPLIP SourceForge download page):

HPLIP_VERSION="3.25.8"
curl -fL -o "hplip-${HPLIP_VERSION}.tar.gz" "https://sourceforge.net/projects/hplip/files/hplip/${HPLIP_VERSION}/hplip-${HPLIP_VERSION}.tar.gz/download"
tar -xf "hplip-${HPLIP_VERSION}.tar.gz"
cd "hplip-${HPLIP_VERSION}"

Configure the build for modern Ubuntu releases (64-bit systems):

./configure --with-hpppddir=/usr/share/ppd/HP --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr \
--enable-network-build --enable-scan-build --enable-fax-build --enable-dbus-build \
--disable-qt4 --enable-qt5 --enable-hpcups-install --enable-cups-drv-install
checking for sane_open in -lsane... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for DBUS... yes
checking for dbus_connection_open in -ldbus-1... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating hplip.conf
config.status: creating hplip.desktop
config.status: creating hp-uiscan.desktop
config.status: creating hplip-systray.desktop
config.status: creating prnt/drv/hpijs.drv
config.status: creating prnt/drv/hpcups.drv
config.status: creating hplip.list
config.status: creating data/policykit/com.hp.hplip.service
config.status: executing depfiles commands
config.status: executing libtool commands

For 32-bit systems, use --libdir=/usr/lib instead. The configuration script checks dependencies and reports missing packages. Install any missing items with APT before proceeding.

Compile the source code (run as regular user, not root):

make -j"$(nproc)"

The -j"$(nproc)" flag uses all available CPU cores to speed up compilation.

On Ubuntu 22.04 and 24.04, a successful build ends with output similar to:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/libhpmud_la-hpmud.o .libs/libhpmud_la-mlc.o .libs/libhpmud_la-model.o .libs/libhpmud_la-pml.o .libs/libhpmud_la-dot4.o .libs/libhpmud_la-jd.o .libs/libhpmud_la-pp.o .libs/libhpmud_la-utils.o .libs/libhpmud_la-musb.o   -Wl,-rpath -Wl,/tmp/hplip-3.25.8/.libs -lpthread -ldl -lusb-1.0 -lnetsnmp ./.libs/libhpdiscovery.so -lavahi-common -lavahi-client -lcrypto    -Wl,-soname -Wl,libhpmud.so.0 -o .libs/libhpmud.so.0.0.6
libtool: link: (cd ".libs" && rm -f "libhpmud.so.0" && ln -s "libhpmud.so.0.0.6" "libhpmud.so.0")
libtool: link: (cd ".libs" && rm -f "libhpmud.so" && ln -s "libhpmud.so.0.0.6" "libhpmud.so")
/bin/bash ./libtool --tag=CC   --mode=link gcc -DCONFDIR=\"/etc/hp\" -DCONFDIR=\"/etc/hp\" -version-info 0:1:0  -o libhpipp.la -rpath /usr/lib/x86_64-linux-gnu libhpipp_la-hp_ipp.lo libhpmud.la -lavahi-common -lavahi-client -lcrypto 
/bin/bash ./libtool --tag=CC   --mode=link gcc -I/usr/include/python3.12 -Iprotocol/discovery -I/usr/include/libusb-1.0  -DCONFDIR=\"/etc/hp\" -module -avoid-version  -o hpmudext.la -rpath /usr/local/lib/python3.12/dist-packages hpmudext_la-hpmudext.lo libhpmud.la libhpdiscovery.la -lavahi-common -lavahi-client -lcrypto

On Ubuntu 26.04, the HPLIP 3.25.8 tarball currently fails to compile in prnt/cupsext/cupsext.c with implicit function declaration errors. Use the APT packages or the Snap method until HP updates the source.

prnt/cupsext/cupsext.c:106:5: error: implicit declaration of function '_releaseCupsInstance'; did you mean 'releaseCupsInstance'? [-Wimplicit-function-declaration]
prnt/cupsext/cupsext.c:375:14: error: implicit declaration of function 'addCupsPrinter'; did you mean 'addPrinter'? [-Wimplicit-function-declaration]
prnt/cupsext/cupsext.c:398:14: error: implicit declaration of function 'delCupsPrinter'; did you mean 'getCupsPrinters'? [-Wimplicit-function-declaration]
prnt/cupsext/cupsext.c:423:14: error: implicit declaration of function 'setDefaultCupsPrinter'; did you mean 'setDefaultPrinter'? [-Wimplicit-function-declaration]
make: *** [Makefile:6597: cupsext_la-cupsext.lo] Error 1

Install the compiled binaries:

sudo make install

Compilation time varies by system performance. If compilation fails, check the error output for missing dependencies or configuration issues, install the required packages, and run make clean before trying again.

Install HPLIP via Snap

The HPLIP Printer Application snap (published by OpenPrinting) wraps HPLIP inside a Printer Application and emulates a driverless IPP printer. This approach is aimed at older HP models that still need classic HPLIP drivers while keeping printing managed through a web interface.

If the snap command is missing, install the Snap runtime first:

sudo apt install snapd

Install the HPLIP Printer Application:

sudo snap install hplip-printer-app

Because the Snap runs in strict confinement, connect the interfaces that grant access to USB printers and mDNS discovery (network-only printers may not need raw-usb):

sudo snap connect hplip-printer-app:raw-usb
sudo snap connect hplip-printer-app:avahi-control

After the interfaces are connected, open the web interface at http://localhost:8000 to add and configure printers. If port 8000 is already in use, the application may use http://localhost:8001 instead. A working setup loads the Printer Application page with an Add Printer option and a device list.

OpenPrinting notes that the snap targets around 3,000 HPLIP-supported models, but scanning support is planned for a later release. It also does not include the classic HPLIP command-line utilities or HP Device Manager, so use the APT or source install when you need full HPLIP tooling.

Post-Installation Configuration Steps

After installing HPLIP through any method, complete the steps that apply to your setup so permissions and device discovery work correctly.

Add User to Printer Groups

HPLIP requires your user account to belong to the lp (line printer) and lpadmin (printer administration) groups for permission to access printing hardware and manage printer queues. Add your current user to these groups:

sudo usermod -a -G lp,lpadmin $USER

After running this command, you must log out and log back in (or restart your PC) for group membership changes to take effect. The system only reads group assignments during login, so changes wonโ€™t apply to your current session. Verify membership after logging back in with the groups command.

groups

Your output should include lp and lpadmin.

Reconnect USB Printers

If you have a USB printer already connected during HPLIP installation, Ubuntu wonโ€™t recognize it properly until you reset the USB connection. This happens because HPLIPโ€™s udev rules (device detection rules) werenโ€™t active when the printer was first plugged in. Reset the connection by doing one of the following:

  1. Unplug the USB cable from your computer and plug it back in, or
  2. Restart your computer (which also reloads all USB devices)

After reconnecting, Ubuntuโ€™s device manager will recognize the printer with HPLIPโ€™s drivers and make it available for configuration.

Install Proprietary Plugin (If Required)

If the models database shows plugin=1 for your device (or your printer documentation requires it), install the proprietary plugin before configuring your printer:

sudo hp-plugin

The plugin installer downloads the binary plugin from HPโ€™s servers and prompts you to accept HPโ€™s license agreement. Run it with sudo so it can place firmware under /usr/share/hplip. The download requires internet access and may take a few minutes depending on connection speed. If the download fails, check your network connection and firewall settings, then try again.

Corporate or restrictive networks may block access to HPโ€™s plugin servers. If downloads consistently fail after multiple attempts, temporarily connect to a different network (mobile hotspot, home network) to complete plugin installation, or configure proxy settings to allow access to sourceforge.net and HPโ€™s download servers.

Launch HPLIP After Installation

After installation completes, launch HPLIP using either the desktop tools or the terminal. The HP Device Manager requires the hplip-gui package and an active desktop session.

Launch HPLIP from the Applications Menu

Open your application menu and search for โ€œHPLIPโ€ or โ€œHP Device Manager.โ€ Click the HP Device Manager icon to launch the interface. Alternatively, access the setup wizard by searching for โ€œHP Device Setup.โ€

Launch HPLIP from the Terminal

Open the HPLIP toolbox directly from the terminal:

hp-toolbox

This command opens the HP Device Manager where you can configure printers, check ink levels, and perform maintenance tasks. If the command is missing, install hplip-gui.

Set Up Your HP Printer with HPLIP

After installing HPLIP, you need to configure your HP devices and verify they work correctly. The setup process uses the hp-setup wizard to detect devices, install drivers, and establish connections.

Step 1: Run HPLIP Setup

Run the hp-setup command with administrative privileges so it can create printers under CUPS. Use the graphical flag on desktop systems:

sudo hp-setup -u

On headless or server installs without an X session, switch to the interactive text mode:

sudo hp-setup -i

Step 2: Select Connection Type

When the HPLIP setup window appears, you will be prompted to choose the connection type for your HP device. Available options include USB, Network/Ethernet/Wireless, and Parallel (legacy printers) based on how your device connects. Choose the appropriate connection type for your device and click โ€œNext.โ€

Parallel port connections are rare on modern systems but still supported for legacy HP LaserJet and DeskJet printers from the 1990s-early 2000s. Most current HP devices use USB or network connections. If your system lacks a parallel port, USB-to-parallel adapters may work but arenโ€™t officially supported by HPLIP.

Step 3: Discover and Select Your Device

HPLIP will now scan for connected HP devices based on the connection type you selected. If your device is not automatically detected, you may need to manually enter its IP address or hostname (for Network/Ethernet/Wireless connections). Once your device appears in the list, select it and click โ€œNext.โ€

Step 4: Configure Printer Settings

Next, configure basic settings for your HP printer, such as the printer name and description. You can also share the printer on your local network if desired. After configuring the settings, click Next to continue.

Step 5: Install the Printer Driver

HPLIP will now prompt you to install the appropriate printer driver for your device. It will automatically select the recommended driver, but you can also choose a different driver from the list if needed. Click โ€œNextโ€ to begin the driver installation process.

Testing HPLIP Installation

After configuring your HP devices, test the installation to confirm everything works correctly. This section covers discovering connected devices and testing print and scan functionality.

Discover Connected HP Devices

Before testing, verify HPLIP detects your HP devices correctly. Run hp-probe as your normal user; it warns if you run it with sudo. The command scans for all connected HP printers and scanners regardless of connection type (USB, network, or parallel):

hp-probe

This command outputs device URIs (Uniform Resource Identifiers), connection types, and model information for each detected HP device. USB devices appear with URIs like hp:/usb/DeskJet_2600_series?serial=XXXXX, while network devices show hp:/net/DeskJet_2600_series?ip=192.168.1.100. Use these URIs when manually specifying devices in other HPLIP commands.

Add the -g flag when you need verbose debug output that shows every discovery step and USB query:

hp-probe -g

If you prefer a graphical device list, open HP Device Manager instead of relying on hp-probe:

hp-toolbox

Verify CUPS Scheduler Status

Confirm that the CUPS scheduler is running before printing a test page:

lpstat -r
scheduler is running

If you see scheduler is not running, start the CUPS service in the troubleshooting section below.

Print a Test Page

First, identify your configured printer name. Run this command to list all available printers:

lpstat -p -d

The output shows your printer names and the default printer. The -p flag lists all printers, while -d displays the default printer. Use this information for the test print commands below.

Print Test Page via Command Line

Print a test page from the terminal using either the HPLIP-specific command or the standard CUPS command. The HPLIP method automatically selects your default printer and sends HPโ€™s test page:

hp-testpage

This command prints a formatted test page showing your printer model, HPLIP version, and color/alignment patterns. Alternatively, use the standard CUPS test print command to target a specific printer, replacing printer_name with your actual printer name from the previous lpstat command:

lp -d printer_name /usr/share/cups/data/testprint

The hp-testpage command is simpler for quick verification, while lp offers more control when managing multiple printers.

Print a Test Page from the Printers App

  1. Open the Printers application on your Ubuntu system.
  2. Locate and select your HP printer in the list of available printers.
  3. Right-click on the printer and choose Properties.
  4. In the printer properties window, click the Print Test Page button.

A successful test page confirms your HP printer is properly configured with HPLIP.

Test Scanning Functionality

For HP all-in-one devices with scanning capabilities, test the scanner using HPLIPโ€™s built-in scan utility. If you have multiple scanners, first list available devices:

hp-scan -i

This command starts interactive mode, lists detected scanners, and prompts you to choose the correct device URI before running a scan.

Test Scan via Command Line

Once youโ€™ve identified your scanner, run the scan as your normal user and save the output:

hp-scan --output=my-test-scan.png

This saves the scan to my-test-scan.png in your current directory. Choose a different filename if you want to keep multiple test scans.

Test Scanning from the Applications Menu

  1. Launch the HPLIP Toolbox by searching for โ€œHPLIPโ€ in your application menu and clicking the HPLIP Toolbox icon.
  2. In the HPLIP Toolbox window, locate and select your HP all-in-one device.
  3. Click the Scan button to open the scanning utility.
  4. Follow the on-screen instructions to perform a test scan, adjusting the scan settings as needed.

A successful test scan confirms your HP all-in-one deviceโ€™s scanning functionality works properly with HPLIP.

Manage Printers via CUPS Web Interface

The CUPS (Common UNIX Printing System) web interface provides advanced printer management capabilities beyond what HPLIPโ€™s tools offer. Through this browser-based interface, you can configure print queues, modify printer options, view detailed job histories, adjust PPD (PostScript Printer Description) settings, and manage printer sharing across your network. This is particularly useful for server environments, troubleshooting complex configuration issues, or when you need fine-grained control over printer behavior.

Access the CUPS administration panel by opening your browser and visiting http://localhost:631.

The CUPS interface organizes functions under several tabs:

  • Administration: Add/remove printers, manage server settings, enable printer sharing, configure remote administration
  • Printers: View all configured printers, check status, set defaults, access printer-specific options
  • Jobs: Monitor active print jobs, view completed jobs, cancel or hold queued jobs
  • Classes: Create printer pools (groups of printers that share a queue for load balancing)

When you click administrative functions like โ€œAdd Printerโ€ or modify printer settings, CUPS prompts for authentication. Enter your Ubuntu username and password (the same credentials you use with sudo). Your user must belong to the lpadmin group to perform administrative tasks.

By default, CUPS only accepts connections from localhost (127.0.0.1), preventing remote access to the web interface. To enable remote administration from other computers on your network, you must explicitly configure CUPS to listen on network interfaces and allow remote connections. This creates security risks; only enable remote access when necessary and implement firewall rules or VPN tunnels to restrict access to trusted networks.

Common CUPS administrative tasks include:

  • Setting default options: Configure paper size, print quality, duplex settings, and color management as defaults for all jobs
  • Enabling printer sharing: Allow other Linux, macOS, or Windows computers on your network to print through your Ubuntu system
  • Viewing error logs: Access detailed logging information when troubleshooting printer communication or driver issues
  • Managing print quotas: Set page limits or implement accounting for shared printers in office environments

The CUPS web interface complements HPLIPโ€™s tools by providing system-level printing configuration, while HPLIP focuses on HP-specific features like ink level monitoring, print head alignment, and scanner access.

Troubleshooting HPLIP Issues

Common HPLIP issues typically involve device detection, permissions, or network connectivity. Before diving into specific problems, run HPLIPโ€™s built-in diagnostic tool to identify issues automatically:

hp-doctor

This command checks for deprecated configurations, missing plugins, dependency issues, printer queue problems, and permission errors. Run it as your normal user; it will prompt you if elevated privileges are needed. For a more detailed dependency check, use:

hp-check -r

The -r flag performs a runtime check of all HPLIP dependencies, confirming that Python modules, scanning libraries, and CUPS communication are working correctly.

Printer Not Detected During Setup

If HPLIP fails to detect your printer during setup, first verify the connection. For USB printers, check the physical connection and run:

lsusb | grep -i hewlett

If you see lsusb: command not found, install the USB utilities package:

sudo apt install usbutils

This command lists connected HP USB devices. If nothing appears, the issue is hardware-related. Check the cable and try a different USB port. For network printers, verify the printerโ€™s IP address is reachable:

ping -c 4 printer_ip_address

Replace printer_ip_address with your printerโ€™s actual IP address. Network discovery failures often indicate firewall issues, incorrect network settings, or the printer being on a different subnet.

Repository HPLIP Version Too Old

When your HP device requires a newer HPLIP version than Ubuntuโ€™s repositories provide, the device may not appear during setup, or certain features may fail even after successful configuration. This commonly affects recently released HP printers that werenโ€™t supported in the HPLIP version packaged with your Ubuntu release.

First, verify your installed HPLIP version and compare it to the support-ver value in the models database from the HPLIP tarball (see the compatibility section earlier):

dpkg -l | grep -E '^ii[[:space:]]+hplip' | head -1

The version number appears in the third column. If the installed version is older than required, install a newer release using HPโ€™s automatic installer or manual compilation method covered earlier in this guide. Newer HPLIP versions add device support that cannot be backported to older repository packages.

CUPS Service Not Running

HPLIP requires the CUPS (Common UNIX Printing System) printing service to function. This service manages all print jobs and printer communication on Linux systems. First, check if the CUPS scheduler is running:

lpstat -r

If the scheduler is not running, start and enable CUPS so it launches on boot:

sudo systemctl enable --now cups

On Ubuntu, CUPS can be socket-activated; seeing cups.socket active with cups.service inactive is normal until a print job arrives.

Missing Printer Driver or Plugin

Some HP printers require proprietary plugins for full functionality, while others may have missing dependencies that prevent proper operation. Run the diagnostic tool to check for missing dependencies:

hp-check -r

This command performs a runtime check and reports missing components like Python libraries, scanning tools, and communication libraries. Review the output for error messages or warnings about missing packages.

If dependencies are missing or broken, fix them automatically:

sudo apt --fix-broken install

The --fix-broken option attempts to correct broken package installations by installing missing dependencies or removing conflicting packages. This is particularly useful after manual installations or when dependency resolution fails during initial HPLIP installation.

If the diagnostic indicates your printer requires a proprietary plugin, install it:

sudo hp-plugin

Follow the on-screen instructions to download and install the proprietary plugin. The plugin must be downloaded from HPโ€™s servers, requires accepting their license agreement, and needs root privileges so files can be written into system directories.

If the plugin download fails due to network issues or server unavailability, wait a few minutes and try again. Some corporate or restrictive networks may block access to HPโ€™s plugin servers. Temporarily disable proxy settings or try from a different network if the download consistently fails.

Multi-Function Device Partial Failure

When printing works but scanning fails (or vice versa), this typically indicates missing dependencies for one function. Check if the required scanning packages are installed:

dpkg -l | grep -E 'python3-pil|libsane-hpaio'

If either package is missing, install the common scanning dependencies:

sudo apt install python3-pil libsane-hpaio

After installing missing packages, restart the CUPS service and test both functions again:

sudo systemctl restart cups

Network Printer Hostname Resolution Issues

If network printer discovery fails despite correct network configuration, mDNS (multicast DNS) may not be functioning properly. First, verify the printer responds to its hostname:

ping -c 4 printer-hostname.local

If the hostname doesnโ€™t resolve, install Avahi (the Linux mDNS implementation):

sudo apt install avahi-daemon avahi-utils

Then enable and start the Avahi service:

sudo systemctl enable --now avahi-daemon

Alternatively, use the printerโ€™s IP address directly instead of its hostname during setup. Find the IP address from your routerโ€™s admin panel or the printerโ€™s network settings menu.

Network Printer Security Considerations

Network printers expose services to your local network and potentially beyond if not properly secured. When configuring network printers, consider these security practices:

  • Restrict firewall rules: Only allow printer ports (631/tcp, 5353/udp) from trusted networks, not all interfaces
  • Verify plugin authenticity: The hp-plugin tool downloads proprietary code from HP servers; ensure youโ€™re on a trusted network during installation
  • Disable remote administration: Access the CUPS web interface at http://localhost:631 and disable remote administration unless specifically needed
  • Use printer authentication: Configure printer passwords or access controls when available to prevent unauthorized print jobs

For public-facing servers, avoid exposing CUPS ports directly to the internet. Use VPN access or SSH tunneling instead.

Network Printer Firewall Configuration

Network printer access requires specific firewall ports. If using UFW firewall on Ubuntu, allow CUPS and IPP (Internet Printing Protocol) traffic:

If you manage this system over SSH, confirm your firewall rules before enabling or reloading UFW to avoid locking yourself out.

sudo ufw allow 631/tcp
sudo ufw allow 5353/udp

Port 631 handles CUPS/IPP printing, while port 5353 enables Bonjour/mDNS (multicast DNS) printer discovery for automatic network printer detection.

Manage HPLIP Installation

This section covers updating and removing HPLIP for each installation method.

Update HPLIP (APT)

APT updates come from Ubuntuโ€™s repositories. Refresh the package index and upgrade only the HPLIP packages you installed:

sudo apt update
sudo apt install --only-upgrade hplip hplip-data hplip-gui hplip-doc

On server installs where you only installed hplip and hplip-data, limit the upgrade to those packages.

Verify the updated version:

dpkg -l | grep -E '^ii[[:space:]]+hplip' | head -4
ii  hplip                          3.24.4+dfsg0-0ubuntu5            amd64  HP Linux Printing and Imaging System (HPLIP)
ii  hplip-data                     3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - data files
ii  hplip-doc                      3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - documentation
ii  hplip-gui                      3.24.4+dfsg0-0ubuntu5            all    HP Linux Printing and Imaging - GUI utilities (Qt-based)

For production servers, consider configuring unattended upgrades on Ubuntu to keep HPLIP and other system packages current automatically.

Update HPLIP (Snap)

Snaps refresh automatically, but you can trigger an update at any time:

sudo snap refresh hplip-printer-app

Reopen the web interface to confirm the Printer Application loads after the refresh.

Update HPLIP (Source Build) with a Script

If you compiled HPLIP from source, use a script to track new releases and recompile safely when needed.

Create the update script:

cat <<'EOF' > ~/hplip-src/hplip-update.sh
#!/usr/bin/env bash
set -euo pipefail

# Basic tool checks
for cmd in curl tar make gcc pkg-config; do
  if ! command -v "$cmd" >/dev/null 2>&1; then
    echo "Missing required tool: $cmd"
    echo "Install the build dependencies from the manual build section, then re-run."
    exit 1
  fi
done

# Determine the latest HPLIP version from SourceForge RSS
latest_version=$(curl -fsSL "https://sourceforge.net/projects/hplip/rss?path=/hplip" | \
  grep -oE '/hplip/[0-9]+\.[0-9]+\.[0-9]+/' | \
  sed -e 's|/hplip/||' -e 's|/||' | sort -V | tail -n 1)

if [[ -z "$latest_version" ]]; then
  echo "Could not determine the latest HPLIP version."
  exit 1
fi

version_file="$HOME/.local/share/hplip-source-version"
installed_version=""
if [[ -f "$version_file" ]]; then
  installed_version=$(cat "$version_file")
fi

if [[ -n "$installed_version" && "$installed_version" == "$latest_version" ]]; then
  echo "HPLIP is already up to date ($installed_version)."
  exit 0
fi

echo "Latest HPLIP version: $latest_version"
if [[ -n "$installed_version" ]]; then
  echo "Installed version: $installed_version"
fi

build_root="$HOME/hplip-src"
mkdir -p "$build_root"
cd "$build_root"

echo "Downloading HPLIP $latest_version..."
curl -fL -o "hplip-${latest_version}.tar.gz" "https://sourceforge.net/projects/hplip/files/hplip/${latest_version}/hplip-${latest_version}.tar.gz/download"

echo "Extracting source..."
tar -xf "hplip-${latest_version}.tar.gz"
cd "hplip-${latest_version}"

echo "Configuring build..."
./configure --with-hpppddir=/usr/share/ppd/HP --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr \
  --enable-network-build --enable-scan-build --enable-fax-build --enable-dbus-build \
  --disable-qt4 --enable-qt5 --enable-hpcups-install --enable-cups-drv-install

echo "Compiling..."
make -j"$(nproc)"

echo "Installing..."
sudo make install

mkdir -p "$(dirname "$version_file")"
echo "$latest_version" > "$version_file"

echo "Update complete."
EOF

Make the script executable:

chmod +x ~/hplip-src/hplip-update.sh

The script stores the last installed version in ~/.local/share/hplip-source-version so it can skip rebuilds when you are already up to date.

Run the script when you want to check for updates:

~/hplip-src/hplip-update.sh
HPLIP is already up to date (3.25.8).

Remove HPLIP (APT)

If you no longer need HPLIP on your system, remove all HPLIP packages along with their configuration files:

sudo apt remove --purge hplip hplip-data hplip-gui hplip-doc

The --purge flag removes configuration files in addition to the packages themselves. Next, clean up unused dependencies:

sudo apt autoremove

The autoremove command removes packages that were installed as dependencies but are no longer needed, including scanning libraries and Python modules that HPLIP required.

Remove HPLIP (Snap)

Remove the Printer Application snap:

sudo snap remove hplip-printer-app

Remove HPLIP (Source Build)

From the source directory you used for installation, run the uninstall script (replace the version with the one you installed):

cd ~/hplip-src/hplip-3.25.8
sudo ./uninstall.py

Removing the build directory and your HPLIP profile deletes local configuration and cached data. Back up anything you want to keep before running the cleanup commands.

rm -rf ~/hplip-src
rm -f ~/.local/share/hplip-source-version
rm -rf ~/.hplip

Conclusion

HPLIP gives Ubuntu a complete HP printing and scanning stack through CUPS, with tools for setup, maintenance, and troubleshooting. Use the APT packages for stability, the manual installer when you need newer device support, and the Snap Printer Application if a sandboxed printing-only workflow fits your setup.

2 thoughts on “How to Install HPLIP on Ubuntu (26.04, 24.04, 22.04)”

Leave a Comment

Let us know you are human: