How to install a package for which there is no dependency of the required version (in Kali Linux, Debian)

It happens that you need to install a .deb package for which certain version of a dependency is absent in the standard repositories. For example, the libcurl3 package is a dependency, but only libcurl4 is available on the system; or libssl1.0.0 dependency is required, but the system has only libssl1.0.2.

By itself, such a .deb package is usually taken not from the standard repository, so it is no hope that the problem will be fixed in the future.

At the same time, it is highly likely that the .deb package of interest to us will work well with libcurl4 instead of libcurl3 (it may even work better) and with libssl1.0.2 instead of libssl1.0.0 - and so on, by analogy, you may have your own dependencies, which cause problems.

But you should not do what is shown here with the drivers, especially with the drivers for the video card - the probability of getting a system that loads into a black screen is too great. And with any application programs it is quite possible to try it – if all in all it would not work, we just uninstall it, it will not be worse.

I will show how to correct the list of dependencies in the .deb package using the example of Viber, at the same time we will get a little familiar with the structure of the .deb package. Not that Viber is my favorite instant messenger for communication - just installing it is a classic example of what I said at the very beginning: hard-coded dependencies of certain versions, but the program works fine with newer versions.

To install the package, you need to download it from the official website:

wget https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb

The package can be installed using the dpkg command and the --ignore-depends options:

sudo dpkg --ignore-depends libcurl3 --ignore-depends libssl1.0.0 -i viber.deb

but this will cause broken apt. Messages about unsatisfied dependencies will be displayed:

Get:1 http://mirror.kku.ac.th/kali kali-rolling InRelease [30.5 kB]
Fetched 30.5 kB in 1s (25.0 kB/s)  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 viber : Depends: libssl1.0.0 but it is not installable
         Depends: libcurl3 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

And no longer it is not possible to update the system, neither to install new packages until you remove the program causing these problems:

sudo apt remove viber

Therefore, it is better to go the other way.

To say simple, .deb file is an archive that contains program files (executable files, configuration files — everything needed to run the program), as well as service files, which contain a description of the package, required dependencies and other meta-information.

Unpack the downloaded deb package:

ar x viber.deb

For unpacking, we use the ar utility, which is designed to create, modify, and extract from archives.

As a result, the following files will be extracted:

  • control.tar.gz - archive with files that contain meta information
  • data.tar.xz - archive with files of the program itself
  • debian-binary

In general, since data.tar.xz contains the program itself, it may be an idea to simply scatter files in the system along the desired paths - this will also work, but we will select it a little more difficult, but more correct way.

We unpack control archive:

tar xzf control.tar.gz

Open the control file with a text editor:

gedit control

Find there a line starting with Depends:

Depends: libxss1, libssl1.0.0, libpulse0, libasound2, libnss3, libxcomposite1, libxcursor1, libxdamage1, libcurl3, libgstreamer-plugins-base1.0-0, libgstreamer1.0-0, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-plugins-ugly, gstreamer1.0-pulseaudio, gstreamer1.0-libav

That is, this is the list of dependencies.

Most likely, you've tried to install your .deb installation file and already know what dependencies are missing.

You can do the check as follows - we take the list that comes after Depends :, delete the commas, so as not to violate the apt syntax, and try to install all these dependencies by simply adding this list after sudo apt install, we get the following command:

sudo apt install libxss1 libssl1.0.0 libpulse0 libasound2 libnss3 libxcomposite1 libxcursor1 libxdamage1 libcurl3 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-libav libssl1.0-dev

Result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libcurl3 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libcurl4

Package libssl1.0.0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libssl1.0.0' has no installation candidate
E: Package 'libcurl3' has no installation candidate

So, libcurl3 is required, but only libcurl4 is in the system. I am simply changing the libcurl3 entry to libcurl4 in the control file.

Another missing package is libssl1.0.0. Since a specific version is specified, it can be assumed that the version in the repository has been updated and for this reason it is impossible to find what we need.

We are looking for a shorter version description, that is, for example, instead of libssl1.0.0, I am looking for libssl1:

apt search libssl1

As you can see, two options were found: libssl1.0.2 and libssl1.1. In my opinion, libssl1.0.2 is closer to libssl1.0.0, so I change the libssl1.0.0 record to libssl1.0.2 in the control file.

Save and close the control file.

Now we build the installation file - we do it in reverse order.

I have already tried it, so I know that the command will complain about the absence of the postrm file, so we simply create an empty postrm file with the command:

touch postrm

We pack all our files in control.tar.gz:

tar --ignore-failed-read -cvzf control.tar.gz pre{inst,rm} md5sums control

We will analyze the last command in more detail. The strings pre{inst,rm} post{inst,rm} are expanded to the following:

echo pre{inst,rm} post{inst,rm}
preinst prerm postinst postrm

That is, in fact, the postinst, postrm, preinst, prerm files are added to the archive being created. These files are scripts executed at various stages of installation/removal:

  • preinst - performed before installing the package
  • postinst - run after package installation
  • prerm - performed before removing the package
  • postrm - executed after package removal

They are optional - that is, they may be absent. If the tar command wrote that a file is missing (for example, a postrm file), then edit this command - remove the missing file from the list, for example, instead of creating a postrm, you could write the command as follows:

tar --ignore-failed-read -cvzf control.tar.gz pre{inst,rm} postinst md5sums control

We continue. Rebuild deb:

ar rcs viber_fixed.deb debian-binary control.tar.gz data.tar.xz

Install our fixed package:

sudo dpkg -i viber_fixed.deb

The ‘blank line in value of field 'Description'’ error

If the error occurred during the installation of the package:

dpkg: error processing archive viber_fixed.deb (--install):
 parsing file '/var/lib/dpkg/tmp.ci/control' near line 17 package 'viber':
 blank line in value of field 'Description'
Errors were encountered while processing:
 viber_fixed.deb

This means that there is the last blank line in the control file, so delete this blank line and rebuild the installation file.

After that, everything is installed as it should:

Did you like to gut .deb packages? Then see ‘8.4. APT Package Reference: Digging Deeper into the Debian Package System’.

Recommended for you:

One Comment to How to install a package for which there is no dependency of the required version (in Kali Linux, Debian)

  1. Kriss says:

    You are really cool. Rebuilt the package - it helped, only in my case it was necessary to add libcurl4

Leave a Reply to Kriss Cancel reply

Your email address will not be published. Required fields are marked *