0

I had some trouble with my virtual machine's network interfaces today so had to make some alterations to my interfaces file. Since I have done this, when I boot into my Debian 8.6 VM I receive the error that OpenBSD Secure Shell server failed to start.

[FAILED] Failed to start OpenBSD Secure Shell server.
See `systemctl status ssh.service` for details.

Running sudo systemctl status ssh.service gives the following status output:

ssh.service - Open BSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled)
Active: failed (Result: start-limit) since Sat 2016-09-17 23:53:44 BST; 4min 37s ago
Process: 824 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Main PID: 824 (code=exited, status=255)

ssh.service: main process exited, code=exited, status=255/n/a
Unit ssh.service entered failed state
ssh.service start request repeated too quickly, refusing to start.
Failed to start OpenBSD Secure Shell server.
Unit ssh.service entered failed state.

Anyone have a clue what could be causing this?

Although I don't see anything wrong with it, my network/interfaces file is:

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
Kaii
  • 755
  • 1
  • 6
  • 17
Raiden616
  • 119
  • 3
  • 9
  • 3
    Have you checked your logs? – Michael Hampton Sep 17 '16 at 23:04
  • How do I do that? Forgive my ignorance – Raiden616 Sep 17 '16 at 23:04
  • if you don't have any special config that you could lost in the ssh server configuration files, just execute a `sudo apt-get purge ssh` and then a `sudo apt-get install ssh` and if the the problem persist –  Sep 17 '16 at 23:43
  • 1
    @Raiden616 If you're not getting anywhere, try starting sshd manually. Perhaps it will tell you something that you're not seeing through systemd and the logs. – Ryan Babchishin Sep 18 '16 at 00:46
  • What were the changes you did to the `interfaces` file? – Tero Kilkanen Sep 21 '16 at 09:28
  • as @Raiden616 said, if you didn't change a lot configuration files (or if you did it, just make a `.bak` copy of the modified files), reinstall the package. If you want to troubleshoot the service, first stop it with `service ssh stop`, then start it with `service ssh start` and find any logs with tis command : `journalctl -u shh` – Abel Sep 10 '18 at 07:32
  • Are you able to start the ssh service manually after system startup? If yes then you may hit a long-standing bug with sshd that prevents the service startup at boot when you have specific ListenAddress(es) defined in sshd_config. Is this the case? – VFrontDe Sep 10 '18 at 08:26

2 Answers2

3

Common causes for SSHD refusing to (re)start are configuration errors. Check with:

$ /usr/sbin/sshd -T
sphakka
  • 213
  • 2
  • 6
0

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.