Skip to content

Instantly share code, notes, and snippets.

@rslonik
Created August 27, 2019 23:33
Show Gist options
  • Save rslonik/6e28f5403834a78364081a9501c8a1b1 to your computer and use it in GitHub Desktop.
Save rslonik/6e28f5403834a78364081a9501c8a1b1 to your computer and use it in GitHub Desktop.
sshd fails to start because missing /var/run/sshd dir (ubuntu)
vim /usr/lib/tmpfiles.d/sshd.conf
# remove the "/var"
d /run/sshd 0755 root root
systemd-tmpfiles --create
now the dir will be created at boot and ssh will show up
-------
https://serverfault.com/questions/941855/why-am-i-missing-var-run-sshd-after-every-boot
-------
So /run (and /var/run symlinked to it) gets recreated every reboot. Except that systemd-tmpfiles isn't doing that for some files including (/var)/run/sshd.
Apparently, this is fixed by a OpenVZ kernel upgrade. But to actually fix it now you edit /usr/lib/tmpfiles.d/sshd.conf and remove /var from the line d /var/run/sshd 0755 root root to read instead:
d /run/sshd 0755 root root
And that's it..!
And when openssh-server gets upgraded, we hope that they will have fixed this bug (or is it really a bug in systemd? or openvz??) -- otherwise you could run into the same problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment