Debian - get all dependencies updated when they 'wont be installed'

6,175

Solution 1

First try installing by which will fail.

dpkg -i percona-toolkit.deb

Then do following to install and fix the missing dependencies.

apt-get install --fix-missing -f

Then try again to install the .deb package

dpkg -i percona-toolkit.deb

Solution 2

First, run apt-get -f install to make APT happy about the current state of the system. Having half-installed or half-removed packages or broken dependencies tends to put APT in a state where it won't do what you tell it to do, even if that would theoretically be possible because it wouldn't affect the broken packages.

dpkg is a low-level tool that does only what you explicitly tell it to do. It verifies dependencies, but it is unable to fulfill them. apt-get and other APT tools are higher-level tools that manage dependencies, among other things. For example, if you tell apt-get to install a package, it will automatically download install the package's dependencies as well; but if you tell dpkg to install a package (which you must provide in a local file) and the required dependencies are not installed, it just signals an error.

When you install third-party packages manually with dpkg, you need to install dependencies first. You can see what a deb file depends on with the command

dpkg-deb -I percona-toolkit.deb

Look at the Depends: line and install packages listed there. This is a comma-separated list; if some package names are separated by a | then you need to install only one of those. Also check the Recommends: line, which lists packages that are not necessary to everyone but are very useful or are necessary for one of the package's feature.

Alternatively, you can initiate the installation with

dpkg -i percona-toolkit.deb

see what packages it complains are missing, and (assuming these packages are provided by the distribution) immediately use apt-get to install them. So in your case:

apt-get install libio-socket-ssl-perl libnet-ssleay-perl libterm-readkey-perl
apt-get -f install

(The second command takes care of finishing the installation of percona-toolkit which was interrupted midway due to missing dependencies.)

If you have several deb files that are not provided by your distribution and they have dependencies among themselves, install them in the order given by their dependencies, or pass them all on a single dpkg -i command line.

Share:
6,175

Related videos on Youtube

IGGt
Author by

IGGt

Updated on September 18, 2022

Comments

  • IGGt
    IGGt over 1 year

    I've been trying to install Percona Toolkit onto my Debian (wheezy) server. I downloaded it as per the instructions: wget percona.com/get/percona-toolkit.deb

    then installed it sudo dpkg -i percona-toolkit.deb

    But it told me there were missing dependencies that weren't installed, and wouldn't be installed.

    I have been downloading these one by one, but each one seems to have a missing dependency of it's own. I've also noticed that most of these are installed, but the toolkit requires a later version. In one case the only version I could find suggested it was designed for the next release of Debian.

    So far I have downloaded:

    libio-socket-ssl-perl_2.002-2_all.deb
    libnet-ssleay-perl_1.65-1+b1_amd64.deb
    libterm-readkey-perl_2.30-4+b2_amd64.deb
    

    and now it wants

    perl (>= 5.20.0-4)
    perlapi-5.20.0
    libc6 (>= 2.14)
    

    Is there an easy way to get the system to download / install all of these in one go, and is it likely to cause stability issues if I install versions higher than the default that are already installed?


    UPDATE - output from apt-get -f install:

    sudo apt-get -f install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Correcting dependencies... Done
    The following packages will be REMOVED:
      libio-socket-ssl-perl libnet-ssleay-perl percona-toolkit
    0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
    3 not fully installed or removed.
    After this operation, 7,319 kB disk space will be freed.
    Do you want to continue [Y/n]? y
    (Reading database ... 26051 files and directories currently installed.)
    Removing percona-toolkit ...
    Removing libio-socket-ssl-perl ...
    Removing libnet-ssleay-perl ...
    Processing triggers for man-db ...
    
    • Admin
      Admin about 9 years
      or dpkg -i percona-toolkit.deb and then apt-get install --fix-missing
    • Admin
      Admin about 9 years
      cheers, I tried that, but it gets stuck at libnet-ssleay-perl: Depends: perl (>= 5.20.0-4) but 5.14.2-21+deb7u2 is installed ; Depends: perlapi-5.20.0 but it is not installable ; Depends: libc6 (>= 2.14) but 2.13-38+deb7u6 is installed
    • Admin
      Admin about 9 years
      Try my answer..
    • Admin
      Admin about 9 years
      Hi Faheem Mitha, I've added it above.
    • Admin
      Admin about 9 years
      I hate to seem nitpicky,but that does not look like complete output. Hmm, or maybe it is - please confirm.
    • Admin
      Admin about 9 years
      Looks like it removed the packages which you tried to install manually.
    • Admin
      Admin about 9 years
      ah, I tried installing the toolkit again, followed by the apt-get -f install. This time I get a lot of entries like the following Cannot initiate the connection to ftp.uk.debian.org:80 (2001:1b40:5600:ff80:f8ee::1). - connect (101: Network is unreachable) [IP: 2001:1b40:5600:ff80:f8ee::1 80] Looks like it may be the internet connection.
    • Admin
      Admin about 9 years
      @IGGt we can do this in chat if you want. If you get in the room, you can ping me from there.
    • Admin
      Admin about 9 years
      I think you should try the my mentioned steps after this removal of manual installed packages and connecting to internet.
  • IGGt
    IGGt about 9 years
    cheers, but it doesn't like: dpkg: dependency problems prevent configuration of percona-toolkit: percona-toolkit depends on libio-socket-ssl-perl; however: Package libio-socket-ssl-perl is not configured yet.
  • Milind Dumbare
    Milind Dumbare about 9 years
    Did you try all three steps?
  • IGGt
    IGGt about 9 years
    ah, I missed the -f. Now I get Package libio-socket-ssl-perl is not installed. I tried to install that earlier bit it failed with Package libnet-ssleay-perl is not installed. I guess I need to download and install that separately?
  • Milind Dumbare
    Milind Dumbare about 9 years
    Are you connected to internet? apt-get install --fix-missing -f should fix this
  • IGGt
    IGGt about 9 years
    I will need to check my firewall rules (this is just a test server that was set up for me), but that could be the problem.
  • Alen Milakovic
    Alen Milakovic about 9 years
    @Miline apt-get -f install does not have magic powers. One needs to look at the situation and figure out what is wrong.
  • Milind Dumbare
    Milind Dumbare about 9 years
    Yeah I know. That is what we are trying to do. My answer works when you do not need magic. Atleast worked for me.
  • IGGt
    IGGt about 9 years
    Hi guys, I can confirm there was a Firewall issue. It is now installed using the above method. Thanks for your help.
  • IGGt
    IGGt about 9 years
    cheers for the description. Being new to Linux, it's good to see how people explain them, as it now makes more sense what was actually happening.