2

This thread is derived from an askubuntu-thread

There the thread-opener tried to install hplip-libraries, but failed because hplip handled his system as a pure Debian one, instead of an Ubuntu one.

A very related problem affects users of distros other than Ubuntu -- because Ask Ubuntu is for Ubuntu only, I am opening this thread here to hopefully help some people of other distros.

The symptom of the problem is: during the execution of hplip-*.run, you are asked for your root password, but, entering your correct password, the installer will tell you your password is wrong. This only affects people with a disabled root account (people using sudo).

How can one fix this problem and install the hplip on a machine that has the superuser disabled?

2 Answers 2

2

I don't doubt Leon's solution will work, but from reading the installer code it shouldn't be necessary to edit the installer contents in order to run hplip-install on an su platform without a root password.

The installer's password code maps different distributions to their root-access method (su or sudo), but it also supports an override. From the base/password.py source:

    def __readAuthType(self):
        # TBD: Getting distro name should get distro class
        # added replace() to remove the spaces in distro_name
        distro_name = get_distro_name().lower().replace(" ","")

        self.__authType = user_conf.get('authentication', 'su_sudo', '')

The user_conf file is located at ~/.hplip/hplip.conf. So if you create or modify that file to contain the following configs:

[authentication]
su_sudo=sudo

it will override the distro mapping and force use of sudo to obtain root access even on an su distribution, when the installer is run under your user account.

2
  • 1
    This worked great when hplips was installed using typical methods but I was just unable to complete 'install required plugin'. Jan 10 at 10:47
  • @TablooQuijico Yeah, that's the problem most people have... you can run the installer under sudo directly and it'll get installed, but then when it tries to get root privs again to install the plugin it falls back to its brain-dead default methods. Overriding that configuration permanently is the best path towards eliminating those issues.
    – FeRD
    Jan 12 at 6:34
1

Fixing the password-problem

The problem is that the hplip-Installer incorrectly assumes an existing su-user, even though it has been deleted in favor of using sudo. This can be alleviated in the following way:

Download the hplip-*-.run-file for your distro from the hp-website from here.

Make the file executable, then run it. Now if you get the problem that this thread is about, abort the installation.

At this point, a folder has already been created at the directory where you ran the .run-file. Inside this folder, there is a subfolder called base. Inside this subfolder, there is a file called password.py

In this file, you will see a list named AUTH_TYPES, it contains key-value-pairs, where the key is a distro, and the value is the authentication-type. Locate your distribution, which, if you are having the ascribed problem, will likely have a 'su' as the value. Just change this value to 'sudo' and save the file.

Now restart the installation (run hplip-install in the created directory), and entering your password should now work as expected.

Cant install dependencies

This may not be the only problem though - the installer may also not be able to install the dependencies on your system. There are two possible solutions to this:

Either: Install dependencies manually (the installer prints out a list of dependencies, just install them manually)

Or: Change the code for dependency-installation in the installer as well:

  • Open the file installer/distros.dat
  • Locate your distribution in that file.
  • Replace commands of the form su -c "<command> by sudo <command>, also make sure to delete the closing-quotes. Laborious, yes, but with an editor with a good replace-tool, not too bad.

After you used one of the solutions above, go ahead and rerun the installer. It will now either see your manually installed packages, or be able to install the dependencies itself based on the changes you made to the file mentioned above.

still getting unresolved dependencies

In my case the installer still claimed that pyqt5 and pyqt5-dbus would not be installed, even though I had them installed using pip. Maybe the installer would have needed the apt-packages, I am not really sure.

Anyway, if you are getting this problem as well, you can fix it by making changes to yet another file, namely installer/text_install.py.

In this file, search for conditions like if num_req_missing, then comment-out the related code-branches, to stop the installer from exiting when it finds missing packages. Only do this if you are sure that all the dependencies are installed!!!

Start the installer again, and when it asks you if you want it to install the missing dependencies, enter n, and now it should finish.

Configuration-problem

After the installation, or when running hp-setup, you need to setup your printer. Here the password-problem hit once again, because after entering the correct credentials the program would tell me that they were wrong. Easy fix: run sudo hp-setup from your terminal, and you will be able to configure your printer.

remarks

This procedure was successfully used with the hplip-3.20.11 on a debian 10.7-system. I assume it should work on many other distros, but haven't tried. Other versions of the hplip may of course work a bit different, I hope not so different to render this answer unhelpful.

1
  • FYI, you can extract the installer code without running it by using sh ./hplip-$VERSION.run --noexec. It'll extract into a directory named hplip-$VERSION, and then stop without launching.
    – FeRD
    Dec 24, 2021 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.