I’ve been running OpenSUSE for years and finally upgraded to 13.1 a few days ago. One issue I’ve been trying to chase down is the lack of a pidfile in 13.1 compared to any other OpenSUSE distribution, 12.3 and below.
In my researching the issue, I found two things:
sshd is now handled using systemd.
The default option in /usr/lib/systemd/system/sshd.service
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
which is essentially the same as in prior distributions, no longer results in a pidfile being created in /var/run/. Just try to run sshd using a command line
/usr/sbin/sshd -D
Removing -D results in the pidfile being created correctly.
However, removing -D from /usr/lib/systemd/system/sshd.service also ends up with trying to run sshd twice upon rcsshd restart, for example, at least according to the log message about the port being taken (even if I killall -9 -r sshd first).
So, why does -D no longer produce a pidfile in /var/run/? What changed? Without the pidfile, monit isn’t very happy to monitor sshd (switching it to the “check program” mode is buggy right now).
Any help from SUSE maintainers or anyone with an answer is much appreciated.
If you read man sshd, you’ll find /run/sshd.pid is used instead
/run/sshd.pid
Contains the process ID of the sshd listening for connections (if there are several daemons
running concurrently for different ports, this contains the process ID of the one started
last). The content of this file is not sensitive; it can be world-readable.
Some old discussions related to systemd and tmpfs changes:
Wed Aug 15 19:25:08 UTC 2012 - crrodriguez@opensuse.org
- When not daemonizing, such is used with systemd, no not
create a PID file
But it seems it just did not work correctly in 12.2 and 12.3 and got fixed for 13.1:
Tue Sep 10 21:15:59 UTC 2013 - crrodriguez@opensuse.org
- fix the logic in openssh-nodaemon-nopid.patch which is broken
and pid_file therefore still being created.
So according to that changelog entry, sshd only created a pid file on 12.2 and 12.3 by mistake.
If you think this is a bug and sshd should create a pid file, please file a report at http://bugzilla.novell.com/ (same password/username as here).
Well afaik not until 208 version, previous versions you still need it and it can be in /etc/tmpfiles.d but i can’t really be sure, well not theou PID file itself but it is defined in that directory/file. ;).
What im interested in this thread is where the $MAINPID is defined because you can see some kill -HUP $MAINPID in the init scripts and systemd startup scripts but i cant seem to find where it is defined, maybe systemd knows that already