4

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.

JacobTheDev
  • 1,059
  • 2
  • 11
  • 16
  • 1
    Have you tried this?http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa – g_p Jan 20 '15 at 05:47
  • 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. – JacobTheDev Jan 20 '15 at 05:52
  • 1
    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)? – david6 Jan 20 '15 at 06:17
  • Doing sudo apt-get update && sudo apt-get upgrade resulted in 8 W: Failed to fetch http://... Hash Sum mismatch errors. I'm not seeing any errors with sudo apt-get dist-upgrade, but after trying to do an apt-get install it still doesn't work. Using SSH so I can't verify the iso at the moment, but I will when I get home tonight. Should also mentioned this is on a clean install, I got SSH working by selecting it during install. – JacobTheDev Jan 20 '15 at 14:08
  • @g_p I tried the stuff in your link but nothing seems to have made a difference. – JacobTheDev Jan 20 '15 at 14:16
  • @g_p looks like that works just fine? http://pastebin.com/jVMRbYJ8 – JacobTheDev Jan 20 '15 at 15:02
  • http://pastebin.com/HkJj4Vpz – JacobTheDev Jan 20 '15 at 15:07
  • 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. – JacobTheDev Jan 20 '15 at 15:54
  • Sorry for my late reply. Can you post the complete output of sudo apt-get update? – g_p Jan 20 '15 at 16:15
  • Sure: http://pastebin.com/A2rd0Eaf – JacobTheDev Jan 20 '15 at 16:18
  • 1
    Remove “Hash sum mismatch” error using this and "GPG ERROR" using this. Also it not good idea to give SSH access to anyone. – g_p Jan 20 '15 at 16:37
  • 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 directoryTried the fix linked for theadd-apt-repository` error but got the same error when running again: http://linuxg.net/how-to-fix-error-sudo-add-apt-repository-command-not-found/ – JacobTheDev Jan 20 '15 at 16:42
  • 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 Jan 20 '15 at 16:56
  • 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 Jan 20 '15 at 17:01
  • Oh dang, I just tried installing git-core and it looks like it's working! – JacobTheDev Jan 20 '15 at 17:30
  • @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"! ;-) – Fabby Jan 22 '15 at 11:25
  • 1
    @Fabby, posted it. – g_p Jan 22 '15 at 11:37

2 Answers2

9

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
Alex
  • 91
  • This worked for me, but could you add a clarification as to why the removal of the apt lists directory contents solves this problem? – fooquency Dec 28 '17 at 21:52
3

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.

g_p
  • 18,504