Ubuntu Debian Mint Linux SSHD OpenSSH Server Not Starting After Reboot Solution

If you get error messages like this it is usually because /var/run/sshd does not exist.

root@userbox:/# service sshd status
‚óŹ ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   Active: failed (Result: start-limit-hit) since Wed 2019-04-10 02:24:44 EDT; 1
  Process: 511 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)

Warning: Journal has been rotated since unit was started. Log output is incomple
root@userbox:/# service sshd start
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.



May 16 11:45:16userbox systemd[1]: ssh.service: Control process exited, code=exited status=255
May 16 11:45:16userbox systemd[1]: Failed to start OpenBSD Secure Shell server.
May 16 11:45:16userbox systemd[1]: ssh.service: Unit entered failed state.
May 16 11:45:16userbox systemd[1]: ssh.service: Failed with result 'exit-code'.
May 16 11:45:16userbox systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
May 16 11:45:16userbox systemd[1]: Stopped OpenBSD Secure Shell server.
May 16 11:45:16userbox systemd[1]: ssh.service: Start request repeated too quickly.
May 16 11:45:16userbox systemd[1]: Failed to start OpenBSD Secure Shell server.
May 16 11:45:16userbox systemd[1]: ssh.service: Unit entered failed state.
May 16 11:45:16userbox systemd[1]: ssh.service: Failed with result 'start-limit-hit'.

 

This is a hack but is the simplest fix to this bug:

echo "mkdir -p /var/run/sshd" >> /etc/rc.local

*Double check rc.local to make sure the "exit 0" is at the end, otherwise the above won't work since it would not be executed.
 

*Also make sure that you have enabled the "rc-local service":

If the rc-local service is not enabled then the command above will not be executed since rc.local would not be used on startup without it being enabled with the command below.

systemctl enable rc-local

Basically we just need to create /var/run/sshd and restart SSHD and it will be good and SSH will start once again.


Tags:

ubuntu, debian, mint, linux, sshd, openssh, server, reboot, solutionif, var, userbox, ssh, openbsd, shell, lib, systemd, enabled, vendor, preset, enab, active, wed, edt, execstartpre, usr, sbin, exited, rotated, output, incomple, quot, systemctl, journalctl, xe, scheduling, restart, repeated, hack, simplest, echo, mkdir, etc, rc,

Latest Articles

  • Linux Ubuntu Cannot Print Large Images
  • Cannot Print PDF Solution and Howto Resize
  • Linux Console Login Screen TTY Change Message
  • Apache Cannot Start Listening Already on 0.0.0.0
  • MySQL Bash Query to pipe input directly without using heredoc trick
  • CentOS 6 and 7 / RHEL Persistent DHCP Solution
  • Debian Ubuntu Mint rc-local service startup error solution rc-local.service: Failed at step EXEC spawning /etc/rc.local: Exec format error
  • MySQL Cheatsheet Guide and Tutorial
  • bash script kill whois or other command that is running for too long
  • Linux tftp listens on all interfaces and IPs by DEFAULT Security Risk Hole Solution
  • python import docx error
  • Cisco Unified Communications Manager Express Cheatsheet CUCME CME
  • Linux Ubuntu Debian Missing privilege separation directory: /var/run/sshd
  • bash how to count the number of columns or words in a line
  • bash if statement how to test program output without assigning to variable
  • RTNETLINK answers: Network is unreachable
  • Centos 7 how to save iptables rules like Centos 6
  • nfs tuning maximum amount of connections
  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled