I am on Ubuntu 16.04 LTS.
I had ssh server running and it worked properly for many months, until one time when something cause it to fail.
Now, I can’t do regular Ubuntu updates from Canonical. I can’t run apt-get
updates. E.g.
$ sudo apt-get upgrade python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.5.1-3).
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
containerd libllvm5.0 libpaps0 paps python3-rlp runc swarm
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up openssh-server (1:7.2p2-4ubuntu2.6) ...
insserv: warning: script 'S02ssh-start.sh' missing LSB tags and overrides
insserv: warning: script 'ssh-start.sh' missing LSB tags and overrides
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.
invoke-rc.d: initscript ssh, action "restart" failed.
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-28 14:10:23 EST; 6ms ago
Process: 79047 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Process: 79038 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 79047 (code=exited, status=255)
Jan 28 14:10:23 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Jan 28 14:10:23 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
dpkg: error processing package openssh-server (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
When I check the status of my ssh server,
sudo service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-28 14:10:23 EST; 2min 37s ago
Process: 79047 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Process: 79038 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 79047 (code=exited, status=255)
Jan 28 14:10:23 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Jan 28 14:10:23 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
Thank you for help.
— edit 1/28/19 —
I don’t know if this helps, but I have in /etc/init.d
the following 2 scripts…
ssh.sh
which appears to be the Ubuntu provided shell script
and
ssh-start.sh
which contains
sudo service ssh start
in addition to all that, I also have /etc/systemd/system/sshd.service
, which is a link to /lib/systemd/system/ssh.service
which contains:
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
———— edit February 18, 2019 ———————–
Still having issues. They are now causing things like apt install to fail.
Thanks, Andrew Dunn, but I researched that answer and solution didn’t work work me.
Here is output of journalctl -xe
joe@joeslinux:~$ journalctl -xe
Feb 18 21:42:34 joeslinux start-mining-monero-minergate-cpu.sh[1640]: [2019-02-18 21:42:34] Diff: 8782 CPU/GPU: 953.8 H/s
Feb 18 21:42:35 joeslinux start-mining-monero-minergate-cpu.sh[1640]: [2019-02-18 21:42:35] Diff: 8782 CPU/GPU: 964.0 H/s
Feb 18 21:42:36 joeslinux sudo[5685]: joe : TTY=pts/6 ; PWD=/home/joe ; USER=root ; COMMAND=/usr/sbin/service ssh restart
Feb 18 21:42:36 joeslinux sudo[5685]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 18 21:42:36 joeslinux systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Feb 18 21:42:36 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Feb 18 21:42:36 joeslinux sshd[5703]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Feb 18 21:42:36 joeslinux sshd[5703]: error: Bind to port 22 on :: failed: Address already in use.
Feb 18 21:42:36 joeslinux sshd[5703]: fatal: Cannot bind any address.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Feb 18 21:42:36 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.
--
-- The result is failed.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
Feb 18 21:42:36 joeslinux sudo[5685]: pam_unix(sudo:session): session closed for user root
Note the: error: Bind to port 22… lines.
There is another reason for the sshd
OpenSSH Server being stuck in the “activating” state.
Namely, the cause could be “entropy exhaustion” which prevents the related OpenSSL module from getting initialized.
To verify that “entropy exhaustion” is really the problem, first stop the OpenSSH service, so it is no longer stuck in the “activating” state, by issuing the following command:
systemctl stop ssh
…after the sshd
has stopped, try to minimize all I/O activity by stoping all other file and network operations, etc.. and then issue the following command to start sshd
again:
/usr/sbin/sshd -ddd
…and observe the debug output for the following message:
BTW: The -ddd
option enables a verbose debug output during startup of the OpenSSH service.
random: N urandom warning(s) missed due to ratelimiting
If this message appears after issuing the /usr/sbin/sshd -ddd
command, then it means, that the SSL module of the OpenSSH service cannot initialize because the entropy pool has been exhausted.
To remedy this problem, issue the command:
apt-get install haveged
..which will install a faster entropy source. You can read more about haveged
here.
This makes it a permanent fix.
- Печать
Страницы: [1] Вниз
Тема: Не запускается демон ssh (Прочитано 13435 раз)
0 Пользователей и 1 Гость просматривают эту тему.
GrandLamer
Всем привет! При вводе команды в терминале
sudo service ssh start
в ответ получаю это:
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: failed (Result: exit-code) since Пт 2017-03-03 21:49:44 +07; 50s ago
Process: 1857 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
Process: 5498 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Main PID: 5498 (code=exited, status=255)
мар 03 21:49:44 PC systemd[1]: Starting OpenBSD Secure Shell server...
мар 03 21:49:44 PC systemd[1]: ssh.service: Main process exited, code=exited, st
мар 03 21:49:44 PC systemd[1]: Failed to start OpenBSD Secure Shell server.
мар 03 21:49:44 PC systemd[1]: ssh.service: Unit entered failed state.
мар 03 21:49:44 PC systemd[1]: ssh.service: Failed with result 'exit-code'.
alex@PC:~$ journalctl -xe
Делал всё по мануалу: https://help.ubuntu.ru/wiki/ssh
мар 03 21:49:43 PC sudo[5466]: pam_ecryptfs: pam_sm_authenticate: /home/alex is
мар 03 21:49:43 PC sudo[5466]: alex : TTY=pts/5 ; PWD=/home/alex ; USER=root
мар 03 21:49:43 PC sudo[5466]: pam_unix(sudo:session): session opened for user r
мар 03 21:49:44 PC systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Начинается запуск юнита ssh.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Начат процесс запуска юнита ssh.service.
мар 03 21:49:44 PC sshd[5498]: error: Bind to port 443 on 192.168.100.3 failed:
мар 03 21:49:44 PC sshd[5498]: fatal: Cannot bind any address.
мар 03 21:49:44 PC systemd[1]: ssh.service: Main process exited, code=exited, st
мар 03 21:49:44 PC systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Ошибка юнита ssh.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита ssh.service.
--
-- Результат: failed.
мар 03 21:49:44 PC systemd[1]: ssh.service: Unit entered failed state.
мар 03 21:49:44 PC systemd[1]: ssh.service: Failed with result 'exit-code'.
мар 03 21:49:44 PC sudo[5466]: pam_unix(sudo:session): session closed for user r
Port 443, ListenAddress 192.168.100.3:443
Что означает fatal: Cannot bind any address и как мне запустить ssh? (P.S.-Пока учусь, просьба тапками не бросаться)
« Последнее редактирование: 03 Марта 2017, 17:52:29 от GrandLamer »
SABeShnik
2x2Gb DDRIII, C2D8400, Seagate 2x2Tb 5900, Samsung 1Tb 7200,
Seagate 250 7200, X633, AeroCool 700W
Heider
bezbo
error: Bind to port 443 on 192.168.100.3 failed
https?
Heider
bezbo, кстати, да. GrandLamer, а вебсервер на этой машине не крутится случайно? Может быть, у Вас конфликт портов.
Punko
GrandLamer, этож зачем перевешывать на другой стандартный порт? Оо
Вешай от 1024 до 30000.
Или вообще оставь дефолт -22, но убери доступ по паролю и доступ для рута.
GrandLamer
Heider, выхлоп аналогичен
bezbo, Heider, сам никаких вебсерверов не запускал. Менял порт, толку 0
Punko, и на стандартном порту, и на поту от 1024 до 30000, всё также, только в логе меняется этот самый порт
Может быть, поломал ssh, не заметив Скопипастил пример конфигурации open-ssh сервера с русскими комментариями, выключил заход под рутом, включил IPv4, отключил пароль, включил ключи. Может быть пакет purge`ом покалечил
« Последнее редактирование: 04 Марта 2017, 08:43:19 от GrandLamer »
Heider
GrandLamer, ну так снеси пакет вместе с конфигами и установи по новой. А вообще, заведи привычку перед правкой конфига делать:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.origin
И чужие конфиги лучше не копировать, а править в своем, при этом делать комментарий, что за правка и зачем она, через полгода забудешь все.
GrandLamer
Помогла переустановка пакетов openssh и ssh. Всем спасибо за помощь!
Видимо, проблема была в ListenAddress. Наверное, я не так понял назначение этой строчки. Это ip, которое надо буде вводить в клиенте?
« Последнее редактирование: 04 Марта 2017, 10:43:00 от GrandLamer »
ConnaiSSant
Помогла переустановка пакетов openssh и ssh. Всем спасибо за помощь!
Видимо, проблема была в ListenAddress. Наверное, я не так понял назначение этой строчки. Это ip, которое надо буде вводить в клиенте?
В ListenAddress указывается IP адрес того интерфейса, который будет прослушиваться демоном. Если хотите, чтобы прослушивать все интерфейсы (если их 2 и более) то оставьте строку за комментарием. Например:
grep “Listen” /etc/ssh/sshd_config
#ListenAddress 0.0.0.0 ///IPv4
#ListenAddress :: ///IPv6
- Печать
Страницы: [1] Вверх
0
1
При загрузке системы сервис sshd не запускается. Через минуту срабатывает таймаут systemd-юнита, он перезапускает sshd и всё грузится дальше. Отключил всё лишнее, в логах всё равно ничего не вижу. Где можно покопать ещё? Конфиг sshd не менял кроме выставления LogLevel VERBOSE. Из нестандартного – на сервере мало памяти (256 MB), хотя после загрузки потребление 44MB, не думаю, что в этом может быть проблема.
journalctl -u ssh.service
Jul 30 13:13:18 nether systemd[1]: Starting OpenBSD Secure Shell server...
Jul 30 13:14:46 nether systemd[1]: ssh.service: Start-pre operation timed out. Terminating.
Jul 30 13:14:46 nether systemd[1]: ssh.service: Control process exited, code=killed, status=15/TERM
Jul 30 13:14:46 nether systemd[1]: ssh.service: Failed with result 'timeout'.
Jul 30 13:14:46 nether systemd[1]: Failed to start OpenBSD Secure Shell server.
Jul 30 13:14:46 nether systemd[1]: ssh.service: Service RestartSec=100ms expired, scheduling restart.
Jul 30 13:14:46 nether systemd[1]: ssh.service: Scheduled restart job, restart counter is at 1.
Jul 30 13:14:46 nether systemd[1]: Stopped OpenBSD Secure Shell server.
Jul 30 13:14:46 nether systemd[1]: Starting OpenBSD Secure Shell server...
Jul 30 13:15:10 nether sshd[365]: Server listening on 0.0.0.0 port 22.
Jul 30 13:15:10 nether sshd[365]: Server listening on :: port 22.
Jul 30 13:15:10 nether systemd[1]: Started OpenBSD Secure Shell server.
...
Сеть настроена статически:
cat /etc/network/interfaces
root@nether:~# cat /etc/network/interfaces
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface ens3 inet static
address 5.8.72.4/24
gateway 5.8.72.1
dns-nameservers 185.31.172.240 89.188.29.4
Фаервол отключен.
Также не запускаются с первого раза другие серверы вроде apache2 и тд.
Я на Ubuntu 16.4 LTS. У меня был запущен ssh-сервер, и он работал должным образом в течение многих месяцев, пока один раз не произошел сбой.
Теперь я не могу делать регулярные обновления Ubuntu от Canonical. Я не могу запустить обновления apt-get. Например
sudo apt-get upgrade python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.5.1-3).
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
containerd libllvm5.0 libpaps0 paps python3-rlp runc swarm
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up openssh-server (1:7.2p2-4ubuntu2.6) ...
insserv: warning: script 'S02ssh-start.sh' missing LSB tags and overrides
insserv: warning: script 'ssh-start.sh' missing LSB tags and overrides
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.
invoke-rc.d: initscript ssh, action "restart" failed.
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-28 14:10:23 EST; 6ms ago
Process: 79047 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Process: 79038 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 79047 (code=exited, status=255)
Jan 28 14:10:23 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Jan 28 14:10:23 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
dpkg: error processing package openssh-server (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Когда я проверяю состояние моего SSH-сервера,
sudo service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-28 14:10:23 EST; 2min 37s ago
Process: 79047 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Process: 79038 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 79047 (code=exited, status=255)
Jan 28 14:10:23 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Jan 28 14:10:23 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Jan 28 14:10:23 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
Спасибо за помощь.
– изменить 1/28/19 –
Я не знаю, помогает ли это, но у меня в /etc/init.d буксировка следующих 2 скриптов…
ssh.sh
который выглядит как сценарий оболочки, предоставленный Ubuntu
а также
ssh-start.sh
которые содержат
sudo service ssh start
в дополнение ко всему, у меня также есть /etc/systemd/system/sshd.service, который является ссылкой на /lib/systemd/system/ssh.service
который содержит:
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
———— редактировать 18 февраля 2019 г. ———————–
Все еще возникают проблемы. Теперь они вызывают сбой таких вещей, как apt install.
Спасибо, Эндрю Данн, но я нашел ответ, и решение не сработало.
Вот выход из журналакт-хе
[email protected]:~$ journalctl -xe
Feb 18 21:42:34 joeslinux start-mining-monero-minergate-cpu.sh[1640]: [2019-02-18 21:42:34] Diff: 8782 CPU/GPU: 953.8 H/s
Feb 18 21:42:35 joeslinux start-mining-monero-minergate-cpu.sh[1640]: [2019-02-18 21:42:35] Diff: 8782 CPU/GPU: 964.0 H/s
Feb 18 21:42:36 joeslinux sudo[5685]: joe : TTY=pts/6 ; PWD=/home/joe ; USER=root ; COMMAND=/usr/sbin/service ssh restart
Feb 18 21:42:36 joeslinux sudo[5685]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 18 21:42:36 joeslinux systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Feb 18 21:42:36 joeslinux systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Feb 18 21:42:36 joeslinux sshd[5703]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Feb 18 21:42:36 joeslinux sshd[5703]: error: Bind to port 22 on :: failed: Address already in use.
Feb 18 21:42:36 joeslinux sshd[5703]: fatal: Cannot bind any address.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Feb 18 21:42:36 joeslinux systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.
--
-- The result is failed.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Unit entered failed state.
Feb 18 21:42:36 joeslinux systemd[1]: ssh.service: Failed with result 'exit-code'.
Feb 18 21:42:36 joeslinux sudo[5685]: pam_unix(sudo:session): session closed for user root
Обратите внимание: ошибка: привязка к порту 22… линии.