Can't get anything to install, dependency errors

32,641

Solution 1

Output of sudo apt-get update which you have provided here has two problem

  1. “Hash sum mismatch” error and
  2. "GPG ERROR"

These two problem is already discussed here( for "Hash sum mismatch") and here (for "GPG ERROR").

Resolving these two error will solve your problem as you are not able to fetch the latest version of software available be in the respective repo.

Solution 2

To fix that need to do next actions:

  1. sudo apt-get update
  2. sudo apt-get install -f
  3. sudo rm -rf /var/lib/apt/lists/*
  4. sudo apt-get update
Share:
32,641

Related videos on Youtube

JacobTheDev
Author by

JacobTheDev

Updated on September 18, 2022

Comments

  • JacobTheDev
    JacobTheDev over 1 year

    I'm extremely new to Linux/command line stuff, so please forgive my ignorance.

    Every time I try to install anything using sudo apt-get install ... I get dependency errors. I'm trying to get OpenSSH Server and GitLab installed on my machine, and whenever I type in the commands, I seem to get a dependency error like so:

    sudo apt-get install openssh-server
    reading package lists... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     openssh-server : Depends: libwrap0 (>= 7.6-4~) but it is not installable
                      Recommends: ssh-import-id but it is not installable
    E: Unable to correct problems, you have held broken packages.
    

    I get similar errors seemingly no matter what I try to install. For example, with sudo apt-get install git, the error changes to:

    The following packages have unmet dependencies:
     git : Depends: liberror-perl but it is not installable
    E: Unable to correct problems, you have held broken packages
    

    I'm running Ubuntu Server 12.04 LTS x86. I've tried doing sudo apt-get clean, sudo apt-get autoclean, sudo apt-get update, and sevveral other similar things. I've tried rebooting, hell, I even wiped out the server and started from scratch with the same issue. I'm sure I'm doing something obviously wrong, but I just can't seem to track it down. If anyone could help, that'd be fantastic.


    Update: I did get OpenSSH working by clean installing the server and selecting OpenSSH during set up.

    I found this wiki on apt-get so I tried doing sudo apt-get build-dep git and got the error:

    E: Build-Depends-Indep dependency for git cannot be satisfied because package asciidoc has no candidate version

    I don't know if that helps determine what's happening.

    • g_p
      g_p over 9 years
    • JacobTheDev
      JacobTheDev over 9 years
      I haven't, thanks, that looks way more informative than the results I've been getting. I'll give it a shot in the morning.
    • david6
      david6 over 9 years
      Is the setup fully updated? sudo apt-get update && sudo apt-get upgrade and sudo apt-get dist-upgrade You should not be getting these errors. Did you verify the Ubuntu install (.iso file)?
    • JacobTheDev
      JacobTheDev over 9 years
      @g_p looks like that works just fine? pastebin.com/jVMRbYJ8
    • JacobTheDev
      JacobTheDev over 9 years
    • JacobTheDev
      JacobTheDev over 9 years
      I'd be happy to give you SSH access if you think you can figure it out; it's a clean install so I've got nothing to lose, haha.
    • g_p
      g_p over 9 years
      Sorry for my late reply. Can you post the complete output of sudo apt-get update?
    • JacobTheDev
      JacobTheDev over 9 years
    • JacobTheDev
      JacobTheDev over 9 years
      Tried do the has sum mismatch one and I get the error sudo: add-apt-repository: command not found. for teh GPG ERROR one I get rm: cannot remove /var/lib/apt/lists/partial': Is a directory` Tried the fix linked for the add-apt-repository error but got the same error when running again: linuxg.net/…
    • JacobTheDev
      JacobTheDev over 9 years
      Actually I was able to fix the add-apt-repository issue but I get the error (Y PPA Manager:4580): Gtk-WARNING **: cannot open display: when trying to run y-ppa-manager
    • JacobTheDev
      JacobTheDev over 9 years
      And I was able to remvove the partial thing using rmdir (I'm learning!) so now what? I'm still stuck with the "cannot open display" issue.
    • JacobTheDev
      JacobTheDev over 9 years
      Oh dang, I just tried installing git-core and it looks like it's working!
    • Fabby
      Fabby over 9 years
      @g_p: as it seems to be working now, shouldn't you convert this to an answer to get some reward out of this? Rev: As you're a reputation 1 user: If this all works, don't forget to click the grey check-mark under the "0" at the left of the answer by g_p, which means "yes, this answer is valid"! ;-)
    • g_p
      g_p over 9 years
      @Fabby, posted it.
  • fooquency
    fooquency over 6 years
    This worked for me, but could you add a clarification as to why the removal of the apt lists directory contents solves this problem?