DebianDebian Based

How To Install HPLIP on Debian 12

Install HPLIP on Debian 12

HP printers and scanners are commonly used in both home and office environments. When running Debian 12, you need the HP Linux Imaging and Printing (HPLIP) software to ensure these devices work correctly. HPLIP provides comprehensive support for printing, scanning, and faxing with HP devices on Linux systems. This guide will walk you through different methods to install HPLIP on Debian 12, from the simplest repository-based installation to more advanced manual compilation approaches.

Understanding HPLIP

HPLIP, which stands for HP Linux Imaging and Printing, is an open-source driver solution developed by HP specifically for Linux operating systems. This comprehensive software package enables full functionality of HP printers and multifunction devices on Linux distributions, including Debian 12.

The HPLIP system consists of several core components:

  • System services that handle communications with HP devices
  • HP CUPS backend driver (hp:) providing bidirectional communication
  • HP fax backend driver (hpfax:) for sending faxes
  • CUPS Raster driver (hpcups) for printing functionality
  • HPIJS Ghostscript IJS driver for rasterizing output
  • Command-line utilities for printer maintenance
  • GUI tools for accessing printer features
  • HPAIO SANE backend for scanning functionality

HPLIP supports a wide range of HP devices, including inkjet printers, LaserJets, and multifunctional peripherals that combine printing, scanning, and faxing capabilities. The software is regularly updated to support new HP devices as they are released.

Currently, Debian 12’s official repository includes HPLIP version 3.22.10, which supports devices released before October 2022. However, the latest version of HPLIP (3.24.4) offers expanded device support, including newer HP printers and official compatibility with Debian 12.

Version Comparison:

  • Repository version: 3.22.10 (supports devices up to October 2022)
  • Latest HPLIP version: 3.24.4 (supports newer devices and officially recognizes Debian 12)

Prerequisites for Installation

Before installing HPLIP on your Debian 12 system, ensure you have the necessary prerequisites in place to avoid installation issues. Proper preparation will streamline the installation process and reduce potential complications.

System Requirements

Your Debian 12 system should meet the following basic requirements:

  • A functioning Debian 12 installation with internet access
  • At least 100 MB of free disk space for HPLIP and its dependencies
  • Root or sudo privileges for installing packages
  • CUPS (Common UNIX Printing System) properly installed and configured

Required Permissions and Access

Installation of HPLIP requires administrative privileges. You’ll need to use the sudo command before administration tasks if you’re not logged in as root. If your user doesn’t have sudo privileges, you can add them to the sudo group or use the root account directly.

Removing Previous Installations

If you have a previous version of HPLIP installed, it’s advisable to remove it before proceeding with a new installation to prevent conflicts. Use the following commands to remove existing HPLIP packages:

sudo apt-get remove hplip
sudo apt-get autoremove
sudo apt-get purge hplip

Installing Dependencies

Different installation methods require different dependencies. For basic installations, ensure you have the essential packages installed:

sudo apt update && sudo apt upgrade -y
sudo apt install libcups2-dev libssl-dev libusb-1.0-0-dev python3-dev python3-pip

For more comprehensive installations or if you plan to compile from source, you’ll need additional development packages which we’ll cover in the specific installation methods.

Connecting Your HP Device

You can connect your HP device via USB or network (wired/wireless) connection:

  • For USB printers, connect the device directly to your computer using a USB cable.
  • For network printers, ensure the printer is connected to the same network as your computer.

Note that for USB printers, you may need to disconnect and reconnect the device after installing HPLIP to ensure proper detection.

Method 1: Installing HPLIP from Debian Repository

The simplest way to install HPLIP is through Debian’s official repository. This method is straightforward and doesn’t require manual compilation, making it ideal for beginners and users who don’t need support for the very latest HP devices.

Using Synaptic Package Manager

If you prefer a graphical interface for installation, you can use Synaptic Package Manager:

  1. Launch Synaptic Package Manager from your applications menu
  2. Search for “hplip” in the search bar
  3. Right-click on “hplip-gui” package and select “Mark for Installation”
  4. The package manager will automatically mark necessary dependencies
  5. Click “Apply” to install the selected packages

Synaptic provides a visual representation of the installation process and automatically handles dependencies, making it user-friendly for those who aren’t comfortable with command-line operations.

Using Terminal Commands

For those who prefer the command line or are accessing their system remotely, terminal installation is quick and efficient:

  1. Open a terminal window (Ctrl+Alt+T)
  2. Update your package lists:
    sudo apt update
  3. Install the HPLIP package with GUI components:
    sudo apt -y install hplip-gui

Alternatively, if you don’t need the graphical interface, you can install just the core HPLIP package:

sudo apt -y install hplip

Using the -y flag automatically confirms installation prompts, streamlining the process.

Verifying the Installation

After installation completes, verify that HPLIP was installed correctly:

  1. Check the installed version:
    hp-check -v
  2. This command will display information about your HPLIP installation, including version number and detected devices

The repository version (3.22.10) supports most HP devices released before October 2022, but may not recognize the newest models.

Method 2: Installing Latest HPLIP Using the Official Installer

If you need support for the newest HP devices or want the latest features, installing the most recent version of HPLIP directly from HP is recommended. HPLIP 3.24.4 includes official support for Debian 12 and adds compatibility with recently released HP printers.

Downloading the Installer

  1. Navigate to the HP Linux Imaging and Printing project page or directly download the installer from the official source
  2. Save the installer file (hplip-3.24.4.run) to your Downloads folder or another easily accessible location
  3. Open a terminal and navigate to the download location:
    cd ~/Downloads/

Preparing for Installation

Before running the installer, you need to make it executable:

  1. In the terminal, make the installer executable with:
    chmod +x hplip-3.24.4.run
  2. Ensure that you have all the necessary dependencies installed:
    sudo apt install --assume-yes libcups2-dev libdbus-1-dev build-essential ghostscript openssl libjpeg-dev libsnmp-dev libtool-bin libusb-1.0-0-dev python3-pil python3-pyqt5 python3-dbus.mainloop.pyqt5 python3-dev python3-notify2 python3 python3-reportlab libsane-dev

Running the Installer

  1. Start the installation by executing the installer:
    ./hplip-3.24.4.run
  2. The installer will launch in interactive mode, presenting a series of prompts
  3. Read each prompt carefully and respond with ‘y’ (yes) or ‘n’ (no) as appropriate
  4. When asked about installation type, choose “Automatic” for the simplest installation
  5. The installer will check for dependencies and may prompt you to install missing packages
  6. Follow the terminal output until the installation process completes

Handling Compatibility Issues

The HPLIP 3.24.4 installer officially supports Debian 12, so compatibility issues should be minimal. However, if you encounter any problems:

  1. Make sure all dependencies are correctly installed
  2. If the installer doesn’t recognize Debian 12, you may need to manually specify your distribution
  3. For persistent issues, consider the manual build and installation option

After successful installation, you’ll have access to the latest HPLIP features and support for the newest HP devices, including those not supported by the repository version.

Method 3: Manual Build and Installation from Source

For advanced users or in cases where other installation methods fail, building HPLIP from source provides the most control over the installation process. This method is more complex but gives you flexibility in configuration options.

Downloading and Extracting the Source Code

  1. Download the HPLIP source tarball from the official website
  2. Navigate to the download location in terminal:
    cd ~/Downloads/
  3. Extract the tarball:
    tar xvfz hplip-3.24.4.tar.gz
  4. Change to the extracted directory:
    cd hplip-3.24.4

Installing Build Dependencies

Manual compilation requires several development packages:

sudo apt install --assume-yes libcups2-dev libdbus-1-dev build-essential ghostscript openssl libjpeg-dev libsnmp-dev libtool-bin libusb-1.0-0-dev wget python3-pil policykit-1 policykit-1-gnome python3-pyqt5 python3-dbus.mainloop.pyqt5 python-gi-dev python3-dev python3-notify2 python3 python3-reportlab libsane-dev xsane libavahi-client-dev libavahi-core-dev avahi-utils

This comprehensive set of dependencies ensures all HPLIP components can be built successfully.

Configuration and Compilation

  1. Configure the build with appropriate options:
    ./configure --prefix=/usr --enable-qt5 --disable-qt4

    This configuration uses Qt5 instead of the outdated Qt4 and sets the installation prefix to /usr for proper system integration.

  2. Compile the source code:
    make -j4

    The -j4 flag tells make to use 4 parallel threads, which speeds up compilation. Adjust this number based on your CPU’s core count.

  3. Install the compiled software:
    sudo make install

Post-Installation Setup

After installation completes:

  1. Add your user to the “lp” group for proper device access:
    sudo usermod -a -G lp $USER
  2. Log out and log back in for the group changes to take effect
  3. If you have a USB printer connected, disconnect and reconnect it for proper detection

This manual installation method gives you the most control over the HPLIP configuration and is useful when troubleshooting compatibility issues or when you need specific features.

Setting Up Your HP Printer

After installing HPLIP, the next step is to set up your specific HP printer. The HP Device Manager (hp-setup) provides a straightforward way to configure your devices.

Launching HP Device Manager

  1. Open a terminal and run:
    hp-setup

    This will launch the HP setup utility in graphical mode if you have the GUI components installed.

  2. Alternatively, for text-mode setup:
    hp-setup -i

USB Printer Setup

For printers connected via USB:

  1. Ensure your printer is connected and powered on
  2. The HP Device Manager should automatically detect your USB printer
  3. Select your printer from the list of detected devices
  4. Follow the setup wizard to install printer drivers
  5. The wizard will offer to print a test page to verify functionality

If your USB printer isn’t detected:

  • Check the physical connection
  • Ensure the printer is powered on
  • Disconnect and reconnect the USB cable
  • Run sudo hp-check to diagnose connection issues

Network Printer Configuration

For printers connected via network (Ethernet or Wi-Fi):

  1. Ensure your printer is connected to the same network as your computer
  2. In the HP Device Manager, select “Network” as the connection type
  3. The utility will scan your network for available HP printers
  4. Select your printer from the discovered devices list
  5. If your printer doesn’t appear, you can manually enter its IP address
  6. Follow the wizard to complete the installation

To find your printer’s IP address, you can check your router’s connected devices list or print a network configuration page from the printer’s control panel.

Setting Default Printer Options

After your printer is set up, you can configure default printing options:

  1. Open the CUPS web interface in your browser:
    http://localhost:631/
  2. Navigate to the “Printers” section
  3. Click on your HP printer
  4. Select “Administration” > “Set Default Options”
  5. Configure settings like paper size, print quality, and color options

These settings become the default for all applications but can be overridden on a per-print basis.

Configuring Scanner Functionality

For HP multifunction devices with scanning capabilities, HPLIP provides integration with the SANE (Scanner Access Now Easy) system to enable scanning functionality.

Setting Up Basic Scanning

  1. Ensure your HP device is properly connected and configured for printing
  2. Open a terminal and run:
    hp-scan

    This launches the HP Scanning utility if you have the GUI components installed.

  3. For command-line scanning, use:
    scanimage -L

    This lists all available scanning devices.

  4. To perform a basic scan from the command line:
    scanimage > scan.pnm

Integration with Scanning Applications

HPLIP works with various scanning applications in Debian:

  1. Simple Scan (Document Scanner) – A user-friendly GUI for basic scanning needs
  2. XSane – A more feature-rich scanning application with advanced options
  3. GIMP – For scanning directly into an image editor

To use these applications, simply install them from the Debian repository and select your HP scanner as the input device.

Scanner Resolution and Settings

When using hp-scan or other scanning applications, you can adjust various settings:

  • Resolution (measured in DPI – dots per inch)
  • Color mode (color, grayscale, or black and white)
  • Scan area and paper size
  • Contrast and brightness

Higher resolution scans provide better quality but create larger files and take longer to process, so adjust based on your specific needs.

Troubleshooting Common Issues

Even with careful installation, you might encounter some issues when setting up HPLIP. Here are solutions to common problems:

Missing Dependencies

If you encounter dependency errors during installation:

  1. Note the missing packages mentioned in the error messages
  2. Install them using:
    sudo apt install package-name1 package-name2
  3. Run the HPLIP installer again

For a thorough dependency check, run:

hp-doctor

This utility identifies and helps resolve HPLIP-related issues.

Permission and Access Problems

If you experience permission issues:

  1. Ensure your user is in the “lp” group:
    sudo usermod -a -G lp $USER
  2. Log out and log back in for changes to take effect
  3. Check file permissions on HPLIP-related directories:
    sudo chmod -R a+r /usr/share/hplip/

USB Detection Failures

When USB printers aren’t detected:

  1. Check if the USB subsystem sees your printer:
    lsusb
  2. Verify that the printer appears in the list
  3. Try a different USB port or cable
  4. Reconnect the printer and check dmesg for hardware detection messages:
    dmesg | tail

Plugin Installation Challenges

Some HP printers require proprietary plugins that aren’t included in the open-source HPLIP package. If you see plugin errors:

  1. Run the plugin installer:
    hp-plugin
  2. Follow the prompts to download and install necessary plugins
  3. If downloads fail, check your internet connection or firewall settings

Error Messages Interpretation

Common error messages and their solutions:

  • “Error: No devices found” – Check connections and ensure the printer is powered on
  • “Error: Permission denied” – Add your user to the appropriate groups or run the command with sudo
  • “Error: CUPS server is not running” – Start the CUPS service with sudo systemctl start cups
  • “Error: Missing dependency” – Install the mentioned dependency package

Dealing with Debian 12 Compatibility Issues

If you encounter the error where the installer doesn’t recognize Debian 12:

  1. Check if HPLIP version 3.24.4 or later is being used, as earlier versions don’t officially support Debian 12
  2. Consider the manual build option if the installer doesn’t support your distribution

In case of package conflicts like the one mentioned in search result:

dpkg: error processing archive /tmp/apt-dpkg-install-jEfRdO/7-printer-driver-postscript-hp_3.22.10+dfsg0-2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/cups/filter/hpps', which is also in package hplipclassdriver 3.23.5

You may need to force the installation:

sudo dpkg -i --force-overwrite /path/to/package.deb
sudo apt --fix-broken install

Advanced Configuration and Features

Once HPLIP is installed and your basic printing and scanning functions are working, you can explore advanced features and configurations to get the most out of your HP device.

Customizing Printer Settings

Fine-tune your printer’s behavior:

  1. Access advanced printer settings through CUPS:
    http://localhost:631/printers
  2. Select your printer and click “Administration” > “Modify Printer”
  3. Adjust advanced options like duplexing, color management, and paper handling

Ink/Toner Level Monitoring

Monitor supply levels to avoid unexpected outages:

  1. Check levels from the command line:
    hp-levels
  2. Or use the graphical interface:
    hp-toolbox

    This opens the HP Device Manager with supply status information.

Automated Maintenance Features

HPLIP includes utilities for printer maintenance:

  1. Clean print heads:
    hp-clean
  2. Align print heads for better quality:
    hp-align
  3. Run printer diagnostics:
    hp-testpage

These commands help maintain optimal print quality and extend the life of your printer.

Setting Up Printer Sharing on Network

Share your HP printer with other computers on your network:

  1. Enable printer sharing in CUPS:
    sudo cupsctl --share-printers
  2. Edit the CUPS configuration file:
    sudo nano /etc/cups/cupsd.conf
  3. Configure the Listen directive to listen on all interfaces:
    Listen 0.0.0.0:631
  4. Set appropriate access permissions for the printer
  5. Restart CUPS:
    sudo systemctl restart cups

Other computers on your network can now access your printer using the IPP protocol.

Command-Line Administration Options

HPLIP provides several command-line tools for advanced users:

  • hp-info – Displays detailed information about your device
  • hp-firmware – Updates printer firmware
  • hp-mkuri – Creates device URIs for manual setup
  • hp-wificonfig – Configures wireless settings for supported printers

These tools offer precise control over your HP device beyond what’s available in the graphical interfaces.

Congratulations! You have successfully installed HPLIP. Thanks for using this tutorial for installing the HPLIP on the Debian 12 “Bookworm” system. For additional help or useful information, we recommend you check the HPLIP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button