Install recent HPLIP with GUI on Rocky Linux 8.x and 9.x

Hi,

I wonder if there’s some third-party repository to install a recent and full version of HPLIP on RHEL clones like Rocky Linux. The HPLIP version shipping with 8.x is quite old. As for HPLIP shipping with 9.x, Red Hat decided to cripple it and only provide a very minimal CLI version without the GUI.

Cheers,

Niki

Hi Niki,

According to https://pkgs.org there doesn’t seem to be a third-party repo that we know of.

However, this won’t be a huge problem, since we can grab the Fedora source rpm here: https://kojipkgs.fedoraproject.org//packages/hplip/3.25.2/5.fc41/src/hplip-3.25.2-5.fc41.src.rpm we can build it ourselves.

I’ve grabbed the Fedora 41 source rpm, because we are more likely to have success with this package under Rocky 8, than if we attempt the Fedora 42 one. Note that the version for Fedora 41 and 42 is the same anyway, so 3.25.2-5. Fedora 43 has 3.25.2-7 but is unlikely to build on older Rocky releases due to dependencies not being available. As it’s only a minor point release, you shouldn’t notice much difference between the packages anyway. It’s at least newer than what you have currently.

First you will need to install mock on your system, so:

dnf install -y mock

then, we need to add your user to the mock group. If we assume your username is niki, then the command will be:

gpasswd -a niki mock

you will most likely need to logout and back in again or just open a new terminal session. Now we can start building the hplip packages. If building for Rocky 8:

mock -r rocky+epel-8-x86_64 --installdeps hplip-3.25.2-5.fc41.src.rpm
mock -r rocky+epel-8-x86_64 hplip-3.25.2-5.fc41.src.rpm

If building for Rocky 9:

mock -r rocky+epel-9-x86_64 --installdeps hplip-3.25.2-5.fc41.src.rpm
mock -r rocky+epel-9-x86_64 hplip-3.25.2-5.fc41.src.rpm

The first command preps the mock environment by installing all the required dependencies for hplip. The second one then actually builds it. It will take a while to build, but this is normal when compiling something. So we just wait patiently.

Once the builds are successful, one of the last lines of output will say something like:

INFO: Results and/or logs in: /var/lib/mock/rocky+epel-8-x86_64/result

so, when we check that directory, we can see we have the packages:

[ian@rocky8 ~]$ ls /var/lib/mock/rocky+epel-8-x86_64/result | grep rpm
hplip-3.25.2-5.el8.src.rpm
hplip-3.25.2-5.el8.x86_64.rpm
hplip-common-3.25.2-5.el8.x86_64.rpm
hplip-debuginfo-3.25.2-5.el8.x86_64.rpm
hplip-debugsource-3.25.2-5.el8.x86_64.rpm
hplip-gui-3.25.2-5.el8.x86_64.rpm
hplip-libs-3.25.2-5.el8.x86_64.rpm
hplip-libs-debuginfo-3.25.2-5.el8.x86_64.rpm
libsane-hpaio-3.25.2-5.el8.x86_64.rpm
libsane-hpaio-debuginfo-3.25.2-5.el8.x86_64.rpm

and the results from Rocky 9:

INFO: Results and/or logs in: /var/lib/mock/rocky+epel-9-x86_64/result

ian@rocky9:~$ ls /var/lib/mock/rocky+epel-9-x86_64/result/ | grep rpm
hplip-3.25.2-5.el9.src.rpm
hplip-3.25.2-5.el9.x86_64.rpm
hplip-common-3.25.2-5.el9.x86_64.rpm
hplip-debuginfo-3.25.2-5.el9.x86_64.rpm
hplip-debugsource-3.25.2-5.el9.x86_64.rpm
hplip-libs-3.25.2-5.el9.x86_64.rpm
hplip-libs-debuginfo-3.25.2-5.el9.x86_64.rpm
libsane-hpaio-3.25.2-5.el9.x86_64.rpm
libsane-hpaio-debuginfo-3.25.2-5.el9.x86_64.rpm

On your system you should now be able to install all of those rpm packages and have a newer version of hplip.

You won’t need to install any of the src.rpm or debug packages. You’ll only need to install:

hplip
hplip-common
hplip-gui
hplip-libs
libsane-hpaio

and hopefully that will solve your problem. There isn’t a separate GUI package for hplip on Rocky 9 but luckily for Rocky 8 it exists. I haven’t installed any of the built rpm’s, this has purely been to show how you can obtain and do it yourself.

To recover the disk space used by mock, you can clean the build environment with:

mock --scrub=all

Just make sure you copied all the hplip rpms to a different location before you do this, else you’ll have to start building again.

As you can see from the above of me including the results, it has been successful to build those packages for Rocky 8 and 9 since I did it on two of my systems.

What you can then do is set up a web server, and configure yourself an RPM repository using the dnf install -y createrepo_c package. Then add a repo file under /etc/yum.repos.d on all your systems, and you’ll be able to install all the rpms you built yourself on all your systems. Mine looks something like this:

cat /etc/yum.repos.d/myrepo.repo 
[myrepo]
name=My Own Repository
baseurl=https://pkgs.example.com
enabled=1
gpgcheck=0
metadata_expire=5m

my webserver has a vhost for pkgs.example.com and the directory looks something like this:

root@www:~# ls /var/www/myrepo/
1password-latest.rpm                                nomachine_8.14.2_1_x86_64.rpm  webex.rpm
azuredatastudio-linux-1.47.1.rpm                    repodata                       windscribe_2.10.15_x86_64.rpm
check-mk-agent-2.3.0p34-1.noarch.rpm                tabby-1.0.220-linux-x64.rpm    windscribe_2.11.11_x86_64_fedora.rpm
check-mk-agent-2.4.0p4-1.noarch.rpm                 tabby-1.0.221-linux-x64.rpm    windscribe_2.12.7_x86_64_fedora.rpm
index.html                                          tabby-1.0.222-linux-x64.rpm    windscribe_2.14.12_x86_64_fedora.rpm
mysql-workbench-community-8.0.30-1.fc36.x86_64.rpm  tabby-1.0.223-linux-x64.rpm    zoom_x86_64.rpm

I basically use it for random rpms that I’ve downloaded to be able to distribute to multiple systems without having to download manually on each of them. But I could add the hplip ones here as well.

Once you’ve added the rpm’s to the directory, you can then just do to create it:

cd /var/www/myrepo
createrepo_c .

to update it in the future, you use a slightly different command:

cd /var/www/myrepo
createrepo_c --update .

and that should pretty much solve two problems. First, having a new hplip version, and second being able to distribute it via your own personal rpm repository.

Please note my above example doesn’t use any gpgcheck, which should be used if you are going to distribute publicly. For personal use however, it’s not as important.

3 Likes

Thank you for that detailed HOWTO, Ian. For the record, I’m already using mock to build a handful of packages that aren’t provided in any of the existing third-party repositories:

Before doing that, I thought I’d rather ask if someone had the idea of setting up a third-party HPLIP repository. Looks like I’ll have to do it myself.

Cheers,

Niki

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.