Failed to start openbsd secure shell server как исправить

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 c...

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.

  • Печать

Страницы: [1]   Вниз

Тема: Не запускается демон ssh  (Прочитано 12801 раз)

0 Пользователей и 2 Гостей просматривают эту тему.

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
мар 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
Делал всё по мануалу: https://help.ubuntu.ru/wiki/ssh
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, не заметив ;D Скопипастил пример конфигурации 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]   Вверх

I need a second openssh server source modified and running on debian.

The modifications I made on the source code are not really relevant, anyway they amplify the logs.

I compiled the modified openssh-7.4p1 with

./configure --prefix=/opt --enable-pam --with-pam
make ; make install 

Then I created /lib/systemd/system/ssh-mod.service :

[Unit]
Description=OpenBSD Secure Shell server modified to log    
After=network.target auditd.service sshd.service
#ConditionPathExists=!/opt/etc/sshd-mod_not_to_be_run
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/opt/etc/default/ssh
ExecStart=/opt/sbin/sshd -D -f /opt/etc/sshd_config $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify

[Install]
WantedBy=multi-user.target
Alias=sshd-mod.service

And /opt/etc/sshd_config is a standard ssh configuration file with the following lines:

Port 22
LogLevel INFO
ChallengeResponseAuthentication no
UsePAM yes
PrintMotd no
PidFile /var/run/sshd-mod.pid

Now I launched the service with:

$ sudo systemctl start ssh-mod

the command loops indefinetly, so I wait until the error message:

Job for ssh-mod.service failed because a timeout was exceeded.
See "systemctl status ssh-mod.service" and "journalctl -xe" for details.

then I check the status:

$ sudo systemctl status ssh-mod

● ssh-mod.service - OpenBSD Secure Shell server modified to log
    Loaded: loaded (/lib/systemd/system/ssh-mod.service; enabled; vendor preset: enabled)
    Active: activating (start) since Mon 2017-09-04 10:19:50 UTC; 12s ago
  Main PID: 15701 (sshd)
     Tasks: 1 (limit: 4915)
    CGroup: /system.slice/ssh-mod.service
            └─15701 /opt/sbin/sshd -D -f /opt/etc/sshd_config

Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Service hold-off time over, scheduling restart
Sep 04 10:19:50 mymachine systemd[1]: Stopped OpenBSD Secure Shell server modified to log.
Sep 04 10:19:50 mymachine systemd[1]: Starting OpenBSD Secure Shell server modified to log...
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on 0.0.0.0 port 22.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on :: port 22.


$ journalctl -xe

Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Start operation timed out. Terminating.
Sep 04 10:19:50 mymachine sshd[15549]: Received signal 15; terminating.
Sep 04 10:19:50 mymachine systemd[1]: Failed to start OpenBSD Secure Shell server modified to log.
-- Subject: Unit ssh-mod.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit ssh-mod.service has failed.
-- 
-- The result is failed.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Unit entered failed state.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Failed with result 'timeout'.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Service hold-off time over, scheduling restart
Sep 04 10:19:50 mymachine systemd[1]: Stopped OpenBSD Secure Shell server modified to log.
-- Subject: Unit ssh-mod.service has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit ssh-mod.service has finished shutting down.
Sep 04 10:19:50 mymachine systemd[1]: Starting OpenBSD Secure Shell server modified to log...
-- Subject: Unit ssh-mod.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit ssh-mod.service has begun starting up.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on 0.0.0.0 port 22.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on :: port 22.

Actually the service results as ‘activating’ but I can login on port 22 (the other server is listening to another port), so the shell seems working.

I have no clue what is causing this, the logs are not so explicit.

What am I missing? Why is the service hung?

Please tell me if you need more informations.

I followed the steps on the RedHat documentation.

Понравилась статья? Поделить с друзьями:
  • Failed to start hostname service astra linux как исправить
  • Failed to start gdb server error in initializing st link device
  • Failed to start game error 58 gameranger как исправить
  • Failed to start game cannot find essential information in the registry configuration error 0x0002
  • Failed to start error 00000057 gameguard