While attempting to install openssh-server on Ubuntu 14.04 64-bit, I get the following error:

Package openssh-server 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 'openssh-server' has no installation candidate

I see the same error when trying to install any package.

This is the sources.list file:

deb http://archive.canonical.com/ubuntu hardy partner
deb-src http://archive.canonical.com/ubuntu hardy partner
  • Have you run apt-get update? Also, have you checked if sources.list has the relevant entries? – psimon Jul 1 '14 at 8:06
  • Please post the output of apt-cache policy. – Faheem Mitha Jul 1 '14 at 8:22
  • 4
    Please don't post screenshots of text output: post the text so that it can actually be read... – jasonwryan Jul 1 '14 at 8:30
  • salman@salman-Inspiron:~$ sudo apt-cache policy [sudo] password for salman: Package files: 100 /var/lib/dpkg/status release a=now Pinned packages: salman@salman-Inspiron:~$ – salman 299402 Jul 1 '14 at 9:02
  • 1
    I suggested an edit that should make this answerable, it just needs approving. – Oli Jul 1 '14 at 10:05

If that's really the whole of your /etc/apt/sources.list file, that explains your current situation. And I've got no explanation for why you have a Hardy repo installed. I suspect you've followed an old tutorial and it has broken things.

Your first step is getting your repos back on track. I would suggest using a tool like RepoGen to get the basics in but failing that, here are the most essential:

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 

Stick those in the right place with sudoedit /etc/apt/sources.list (you might as well ditch those lines about hardy). When that's saved, run sudo apt-get update and then you should be able to install things again.

This error message indicates a 'virtual package' that exists only in the Provides: line of another package, or is referred to in the Depends:, Recommends: or Suggests: lines of other package(s).

To list the packages that have 'Provides: openssh-server', you'd run:

aptitude search "?provides(openssh-server)"

I suspect you have other problems on your ubuntu system, probably in your sources.list file(s) - on debian, at least, openssh-server is an actual package, not a virtual package. I'd be surprised if it was any different on ubuntu.

$ aptitude search "?provides(openssh-server)"
i   openssh-server                  - secure shell (SSH) server, for secure acce
p   openssh-server:i386             - secure shell (SSH) server, for secure acce

I had same problem, I tried all the above solution along with checking over Ubuntu software center.I couldn't crack to solve it.I have tried another way which worked for me. Here is my solution

Firstly we need to be connected to the internet for update process to happen.

$sudo apt-get remove openssh-client

$sudo apt-get update

If the update cant happen because of /var/lib/apt/lists/lock you may remove that file, which will help to download the update process. Then run the following command which should work

$sudo apt-get install openssh-server
  • Don't try this, it didn't work for me and now I have less than before – WhatAMesh Jul 7 '17 at 20:42

I had the same issue and removed and added the sources list over and over. In the end it turned out I had a foreign architecture armhf also installed and that caused problems. So first a purged all ARM packages and then the architecture.

apt-get purge ".*:<arch>"
dpkg --remove-architecture <arch>

After that apt-get update ran without issues and I could finally update packages again.

protected by derobert Oct 6 '15 at 22:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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