As a fresh new install of Ubuntu 16.04
sudo apt-get install openssh-server
outputs

Also it is a fress install I could not understand why this happens.
dpkg -l openssh*
Output is

If canonical upgrades to 1:7.2p2-4 for openssh-server version I think problem will be solved.
Also there is a screen shot of synaptics package manager

If I mark for upgrade there is a window shows packages to be removed:

Any help will be appriciated.
asked Apr 22, 2016 at 7:45
![]()
akikaraakikara
7871 gold badge12 silver badges28 bronze badges
11
Try to perform a apt update before :
apt-get clean
apt-get update
apt-get install openssh-server
I was getting the same error and I didn’t need to change the server.
answered Jul 5, 2016 at 10:16
![]()
Nelson G.Nelson G.
1702 silver badges5 bronze badges
I was getting the exact same error.
In the Software & Updates changing the server from my local country to Main server, and also adding the Canonical Partners from the «Other Software» tab helped installing the openssh-server in my case.
I am not sure which of the two helped.
answered Apr 26, 2016 at 9:24
1
I had the same problem. I fixed it by uninstalling the openssh-client and then installing openssh-server.
sudo apt-get remove openssh-client
sudo apt-get autoclean
sudo apt-get install openssh-server
![]()
Benny
4,6722 gold badges17 silver badges33 bronze badges
answered Oct 3, 2016 at 11:43
user602256user602256
511 silver badge1 bronze badge
0
I had the same problem but nothing from the answers worked for me.
What worked for me is removing the openssh-client:
apt remove openssh-client
Then I succeeded to install the SSH:
apt install openssh-server
# verify
systemctl status ssh
answered Jan 27, 2021 at 11:49
![]()
E235E235
1532 silver badges10 bronze badges
I tried installing OpenSSH server on Ubuntu 16.04 like this:
sudo apt-get install openssh-server
However, it shows the message below:
dell@dell-Latitude-E6400:~$ sudo apt-get install openssh-server Reading package lists... Done Building dependency tree Reading state information... 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: openssh-client (= 1:7.2p2-4) but 1:7.2p2-4ubuntu2.8 is to be installed Depends: openssh-sftp-server but it is not going to be installed Recommends: ncurses-term but it is not going to be installed Recommends: ssh-import-id but it is not going to be installed E: Unable to correct problems, you have held broken packages.
![]()
finefoot
9,1477 gold badges51 silver badges86 bronze badges
asked Jun 1, 2019 at 18:20
2
Try this one this works for me.
sudo apt purge openssh-client
Actually openssh-client is installed on your system you have to first delete it and then install openssh-server with this command.
sudo apt install openssh-server
answered May 18, 2020 at 19:42
![]()
halcyoonahalcyoona
3192 silver badges6 bronze badges
0
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
![]()
asked Jul 1, 2014 at 7:36
9
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.
answered Jul 1, 2014 at 9:57
OliOli
15.5k10 gold badges41 silver badges51 bronze badges
1
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
answered Mar 25, 2015 at 3:13
![]()
2
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
answered Oct 6, 2015 at 23:22
![]()
cascas
72.1k7 gold badges112 silver badges178 bronze badges
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.
answered Aug 19, 2018 at 20:04
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
![]()
asked Jul 1, 2014 at 7:36
9
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.
answered Jul 1, 2014 at 9:57
OliOli
15.5k10 gold badges41 silver badges51 bronze badges
1
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
answered Mar 25, 2015 at 3:13
![]()
2
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
answered Oct 6, 2015 at 23:22
![]()
cascas
72.1k7 gold badges112 silver badges178 bronze badges
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.
answered Aug 19, 2018 at 20:04
У этого вопроса уже есть ответ: dpkg: неустранимая фатальная ошибка, прерывание: файл списка файлов для пакета ‘linux-generic’ отсутствует окончательная новая строка [duplicate] 2 ответа
Я не уверен, что ошибка, которую я получаю, связана с моей установкой apt-get, если я делаю следующее:
sudo apt-get update
...
sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ncurses-term openssh-client openssh-sftp-server ssh-import-id
Suggested packages:
ssh-askpass libpam-ssh keychain monkeysphere rssh molly-guard
The following NEW packages will be installed:
ncurses-term openssh-server openssh-sftp-server ssh-import-id
The following packages will be upgraded:
openssh-client
1 upgraded, 4 newly installed, 0 to remove and 432 not upgraded.
Need to get 0 B/1.222 kB of archives.
After this operation, 5.133 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
dpkg: warning: files list file for package 'i965-va-driver:amd64' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
files list file for package 'libcrystalhd3:amd64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
У вас есть идея, как это исправить?
задан
6 April 2018 в 11:53
поделиться
2 ответа
Чтобы решить эту проблему, откройте терминал и запустите следующие команды:
sudo apt-get install --fix-missing
sudo dpkg --configure -a
sudo apt-get install openssh-server
Вот и все.
ответ дан pa4080
17 July 2018 в 17:23
поделиться
Чтобы решить эту проблему, откройте терминал и запустите следующие команды:
sudo apt-get install --fix-missing
sudo dpkg --configure -a
sudo apt-get install openssh-server
Вот и все.
ответ дан pa4080
23 July 2018 в 18:12
поделиться
Другие вопросы по тегам:
Похожие вопросы:
root@abacus-desktop:~# apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
openssh-server: Depends: openssh-client (= 1:5.3p1-3ubuntu7) but 1:5.3p1-3ubuntu3 is to be installed
wireshark: Depends: libsmi2ldbl but it is not going to be installed
wireshark-common: Depends: libsmi2ldbl but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
![]()
Jeff Schaller♦
65.1k34 gold badges106 silver badges240 bronze badges
asked Aug 2, 2012 at 7:13
4
Your problem description is really vague.
Did you try to run apt-get -f install as suggested to fix the broken dependencies? Did you mix different versions in your sources.list?
answered Aug 2, 2012 at 7:19
scaiscai
10.2k2 gold badges23 silver badges41 bronze badges
6
I had a very similar problem with 13.04 (but it was instead complaining that the openssh-client to be installed is NEWER than the one required).
Turns out that the software sources was configured to download from a servers local to the country where I’m residing (Kuwait).
I solved it by opening Ubuntu Software Center application, then going to the «Edit > Software Sources», then in the Ubuntu Software tab I change the Donwload from drop down list to «Main Server».
I then ran sudo apt-get update followed by sudo apt-get upgrade and finally sudo apt-get install openssh-server and this time it installed without a hitch.
![]()
slm♦
356k112 gold badges752 silver badges859 bronze badges
answered Aug 8, 2013 at 22:26
0
It seems your repository dependencies are broken. Try to clean your /etc/apt/sources.list. Which is a text file that has all your repositories of packages. Probably you have edited it.
Then do an apt-get update. You should tell us your Ubuntu version, and why seems you have another dependencies broken like Wireshark.
answered Aug 2, 2012 at 7:33
logofflogoff
3811 gold badge4 silver badges14 bronze badges
6
Your missing packages are probably in repositories that are commented out in your sources.list (i.e. they are not enabled). Update your repositories first, then try to install again.
answered Aug 2, 2012 at 11:48
slafat01slafat01
2271 silver badge2 bronze badges
На чтение 5 мин. Просмотров 228 Опубликовано 25.05.2021
SSH обеспечивает безопасный способ доступа к серверам Linux и управления ими. Иногда при подключении к серверам SSH пользователи часто сталкиваются с ошибкой «Соединение отклонено» через порт 22. Это происходит из-за нескольких причин, например, по нескольким причинам, например, по нескольким причинам, например, по причине того, что служба SSH не работает, порт заблокирован межсетевым экраном или сервер использует другой порт. Это также может произойти из-за конфликта IP-адресов. В этой статье мы обсудим некоторые решения, которые вы должны попробовать, чтобы исправить ошибку.
Примечание. Обсуждаемые здесь команды были протестированы на Ubuntu 20.04 LTS. Те же команды действительны и для системы Debian.
Содержание
- Исправить ошибку при отказе в соединении
- Убедитесь, что OpenSSH установлен
- Проверить службу SSH
- Проверить порт прослушивания сервера SSH
- Разрешить SSH в брандмауэре
- Разрешить конфликт повторяющихся IP-адресов
Исправить ошибку при отказе в соединении
Это ошибка «Соединение отклонено», с которой вы можете столкнуться при подключении к удаленной системе через SSH.
Следуйте приведенным ниже решениям шаг за шагом в чтобы устранить ошибку «Соединение отклонено».
Убедитесь, что OpenSSH установлен
Одной из причин, по которой вы можете получить ошибку «Соединение отклонено», является то, что OpenSSH server не установлен на целевом сервере.
Во-первых, вам нужно убедиться, что сервер OpenSSH установлен в системе, к которой вы пытаетесь получить доступ через SSH. Чтобы проверить, установлен ли OpenSSH, введите следующую команду в Терминале целевого сервера:
$ sudo apt list —installed | grep openssh-server
Эта команда в основном фильтрует термин «openssh-server» из списка установленных пакетов. Если вы получите следующий аналогичный вывод, это означает, что сервер OpenSSH установлен. С другой стороны, если вы не получаете вывода, это означает, что OpenSSH отсутствует на целевом сервере.
Если он не установлен на целевом сервере, вы можете установить его, используя следующую команду как sudo:
$ sudo apt install openssh-server
Затем введите пароль sudo и при запросе подтверждения нажмите ‘y’. После установки подтвердите его с помощью той же команды
$ sudo apt list —installed | grep openssh-server
Проверить службу SSH
Служба OpenSSH работает в фоновом режиме и прослушивает входящие соединения. Остановленная служба OpenSSH может быть одной из причин, по которой вы получаете сообщение об ошибке «Соединение отклонено».
Следовательно, необходимо проверить, запущена ли служба OpenSSH или нет, используя следующую команду в Терминале :
$ sudo service ssh status
Если вы видите следующий вывод, это означает, что служба активна и работает в фон.
С другой стороны, если вы получите неактивен (мертв), это означает, что служба не запущена . Вы можете запустить службу OpenSSH, используя следующую команду как sudo в Терминале:
Чтобы перезапустить службу, используйте следующую команду:
$ sudo service ssh restart
Проверить порт прослушивания сервера SSH
Другая причина получения ошибки «Соединение отклонено» состоит в том, что вы пытаетесь подключиться не к тому порту. Например, если сервер настроен на прослушивание порта 2244, и вы пытаетесь подключиться к его порту по умолчанию 22, то в этом случае вы получите ошибку «Соединение отклонено».
Прежде чем пытаться подключиться, вам необходимо проверить порт прослушивания SSH-сервера. Если это порт по умолчанию (22), вы можете подключить его с помощью следующей команды:
$ ssh [имя пользователя] @ [IP или имя хоста удаленного сервера]
Если это какой-то порт, отличный от порта по умолчанию, вам нужно будет подключиться к серверу SSH, используя этот порт:
$ ssh — p [номер_порта] [имя_пользователя] @ [ip_address]
Чтобы проверить, какой порт на каком порту слушает сервер OpenSSH; используйте следующую команду в Терминале:
$ sudo netstat -ltnp | grep sshd
Вы получите следующий результат:
В третьем столбце вы можете увидеть, что порт прослушивания сервера — 2244. В этом случае вам нужно будет подключиться к SSH-серверу, используя этот порт.
$ ssh -p [2244] [имя пользователя] @ [ip_address]
Разрешить SSH в брандмауэре
Брандмауэр, блокирующий порт SSH, может быть еще одной важной причиной ошибки «Соединение отклонено». Если на SSH-сервере запущен брандмауэр, вам необходимо разрешить SSH-порт на нем, используя следующую команду. Замените порт номером порта, который прослушивает SSH-сервер:
$ sudo ufw allow port/tcp
Например, если SSH-сервер прослушивает порт 2244, вы можете разрешить его в брандмауэре следующим образом:
$ sudo ufw allow 2244/ tcp
Перезагрузите брандмауэр, используя следующие команда:
Чтобы убедиться, что правила были добавлены, проверьте состояние брандмауэра используя следующую команду в Терминале:
Следующий вывод показывает, что порт 2244 разрешен в брандмауэр.
Разрешить конфликт повторяющихся IP-адресов
Ошибка «Соединение отклонено» также может возникать из-за конфликта дублированных IP-адресов. Итак, убедитесь, что в системе нет повторяющегося IP-адреса.
Установите утилиту arping в вашу систему, используя следующую команду:
$ sudo apt install arping
Затем проверьте IP-адрес SSH-сервера.
Если в выводе вы видите ответ более чем с одного MAC-адреса, затем он показывает, что в системе работает дублирующийся IP-адрес. В этом случае измените IP-адрес SSH-сервера и попробуйте снова подключиться с новым IP-адресом.
Вот как исправить ошибку «Соединение отклонено» через порт 22 в системах Linux. . В этой статье мы описали несколько способов, которые наверняка помогут вам решить ошибку «В соединении отказано».
- Печать
Страницы: [1] Вниз
Тема: ошибки при установке ssh (Прочитано 1589 раз)
0 Пользователей и 1 Гость просматривают эту тему.

Whats_myname
shura1
Такое ощущение, что у вас команда python ссылается на команду python3. То есть какой-то питон установили. Или какой-то скрипт с именем python. Выполните команду — что она показывает?
which -a python

Whats_myname
показывает
/usr/bin/python
shura1
Ну давайте дальше смотреть (потому-что стопроцентно путаница между версиями питона)
ls -l /usr/bin/python

Whats_myname
lrwxrwxrwx 1 root root 18 дек. 15 17:22 /usr/bin/python -> /usr/bin/python2.7
я уже сегодня что-то пытался сделать….
18 дек — интересно
shura1
Мда… Запустите по очереди.
pyclean
/usr/bin/pyclean
python /usr/bin/pyclean
python3 /usr/bin/pyclean
Кстати, да. 18 декабря интересно, но как-бы не должно быть связано. Хотя. Ну запустите, посмотрим, потом подумаем.
« Последнее редактирование: 15 Декабря 2015, 18:08:02 от shura1 »

Whats_myname
$ pyclean
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
$ /usr/bin/pyclean
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
$ python /usr/bin/pyclean
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
$ python3 /usr/bin/pyclean
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
« Последнее редактирование: 15 Декабря 2015, 18:10:25 от Whats_myname »
shura1
Мистика… Как бы так только последняя, четвертая команда должна выполняться. А запустите
type pythonХотя, ничего не даст. Но у меня уже предположения кончились.
А еще
type pyclean
ls -l /usr/bin/python2.7
head -1 /usr/bin/pyclean
Ну где-то должна быть разгадка, почему команда, написанная для второго Питона, упорно пытается выполнить себя с третьим.

Whats_myname
type python
python является /usr/bin/python
$ ls -l /usr/bin/python2.7
lrwxrwxrwx 1 root root 16 сент. 26 12:34 /usr/bin/python2.7 -> /usr/bin/python3
$ head -1 /usr/bin/pyclean
#! /usr/bin/python
shura1
Ну вот вам и ответ. Я не знаю почему, кто это сделал, зачем, но python2.7 должен быть командой, а не ссылкой на python3. Mint-a под рукой нет, поэтому конкретно не могу сказать, что делать. Удалить и потом python переустановить попробовать, может?

Haron Prime
Правила форума
2. На форуме ЗАПРЕЩЕНО
2.17. Обсуждение вопросов, напрямую не связанных с использованием дистрибутивов, входящих в официальное семейство Ubuntu. Другие дистрибутивы GNU/Linux и прочие операционные системы следует обсуждать на иных, специализированных ресурсах. Исключением является раздел Разговоры обо всем.
ЗАКРЫТО!
—HP
- Печать
Страницы: [1] Вверх

This issue was reported by users trying to use the Ubuntu 14.04.1 LTS Desktop LiveCD to run Linux-Bench. Specifically they were trying to setup openssh-server so they could connect to the servers remotely. I was able to recreate the issue, and it is a significant difference from 14.04 LTS. One gets the “openssh-server : Depends: openssh-client” error when trying to install, which is easy to fix but can be a minor annoyance.
The Issue
Upon freshly booting Ubuntu 14.04.1 LTS Desktop LiveCD one can do a sudo su – to elevate to root or just use sudo before running apt-get. When the command “apt-get install openssh-server” is run an error is displayed saying “Some packages could not be installed.”

“The following packages have unmet dependencies” error suggests a need for openssh-client is required as a dependency. One will find that an apt-get install openssh-client leads to an error since openssh-client is already installed.
The Fix
The fix is extraordinarily simple: before attempting to install simply run apt-get update (using either sudo or as root). That will install openssh-server as it would immediately with 14.04 LTS.
Once this is done, you can connect to the server via ssh as one would expect.

Linux-Bench runs well remotely on the 14.04.1 LTS LiveCD. Quick steps are:
Boot into the LiveCD as normal
Open the terminal
Use sudo apt-get update
sudo apt-get install openssh-server curl
Then you can connect to the machine via SSH and run the necessary command found on the Linux-Bench Howto
Hopefully this helps others running into the “openssh-server : Depends: openssh-client” error in their quest to fix the problem.