# service sshd start Starting sshd (via systemctl): [ OK ] # service sshd status sshd.service - LSB: Start up the OpenSSH server daemon Loaded: loaded (/etc/rc.d/init.d/sshd) Active: active (running) since Mon, 14 Mar 2011 15:56:13 +0100; 2s ago Process: 7377 ExecStop=/etc/rc.d/init.d/sshd stop (code=exited, status=0/SUCCESS) Process: 7404 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS) Main PID: 7411 (sshd) CGroup: name=systemd:/system/sshd.service └ 7411 /usr/sbin/sshd # service sshd stop Stopping sshd (via systemctl): [ OK ] [ 7427.106976] systemd[1]: Accepted connection on private bus. [ 7427.110327] systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.StopUnit() on /org/freedesktop/systemd1 [ 7427.112074] systemd[1]: Trying to enqueue job sshd.service/stop/replace [ 7427.113234] systemd[1]: Installed new job sshd.service/stop as 935 [ 7427.114340] systemd[1]: Enqueued job sshd.service/stop as 935 [ 7427.119137] systemd[1]: About to execute: /etc/rc.d/init.d/sshd stop [ 7427.132695] systemd[1]: Forked /etc/rc.d/init.d/sshd as 7447 [ 7427.133760] systemd[1]: sshd.service changed running -> stop [ 7427.138136] systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.GetUnit() on /org/freedesktop/systemd1 [ 7427.140835] systemd[1]: Got D-Bus request: org.freedesktop.DBus.Properties.Get() on /org/freedesktop/systemd1/unit/sshd_2eservice Stopping sshd: [ 7427.179917] systemd[1]: Received SIGCHLD [ 7427.180997] systemd[1]: Got SIGCHLD for process 7411 (sshd) [ 7427.181999] systemd[1]: Child 7411 died (code=exited, status=255/n/a) [ 7427.183122] systemd[1]: Child 7411 belongs to sshd.service [ 7427.184102] systemd[1]: sshd.service: main process exited, code=exited, status=255 [ OK ] [ 7427.254310] systemd[1]: Received SIGCHLD [ 7427.256613] systemd[1]: Got SIGCHLD for process 7447 (sshd) [ 7427.257659] systemd[1]: Child 7447 died (code=exited, status=0/SUCCESS) [ 7427.258796] systemd[1]: Child 7447 belongs to sshd.service [ 7427.259872] systemd[1]: sshd.service: control process exited, code=exited status=0 [ 7427.265092] systemd[1]: sshd.service got final SIGCHLD for state stop [ 7427.266281] systemd[1]: sshd.service changed stop -> failed [ 7427.267414] systemd[1]: Job sshd.service/stop finished, result=done [ 7427.272333] systemd[1]: Unit sshd.service entered failed state. [ 7427.274689] systemd[1]: Accepted connection on private bus. [ 7427.275881] systemd[1]: Got D-Bus request: org.freedesktop.DBus.Local.Disconnected() on /org/freedesktop/DBus/Local [ 7427.278272] systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Agent.Released() on /org/freedesktop/systemd1/agent [ 7427.280134] systemd[1]: sshd.service: cgroup is empty [ 7427.281498] systemd[1]: Got D-Bus request: org.freedesktop.DBus.Local.Disconnected() on /org/freedesktop/DBus/Local # service sshd status sshd.service - LSB: Start up the OpenSSH server daemon Loaded: loaded (/etc/rc.d/init.d/sshd) Active: failed since Mon, 14 Mar 2011 15:56:38 +0100; 14s ago Process: 7447 ExecStop=/etc/rc.d/init.d/sshd stop (code=exited, status=0/SUCCESS) Process: 7404 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS) Main PID: 7411 (code=exited, status=255) CGroup: name=systemd:/system/sshd.service
systemd-20-1.fc15.x86_64 openssh-server-5.6p1-30.fc15.x86_64
What happens if you start the sshd from cli usr/sbin/sshd -f /etc/ssh/sshd_config Does it run then if not try starting it with the tests switch to see if it does not spew out something useful on why it's failing to start.. usr/sbin/sshd -t -f /etc/ssh/sshd_confi usr/sbin/sshd -T -f /etc/ssh/sshd_confi
It's not failing to start. It's not even failing to stop. It says that sshd.service is in failed state after successful stop.
Ahh so you expect to see "Active: stopped" instead of "Active: failed" when service has been stopped and systemctl status $foo.service is run. Makes sense.
more likely 'inactive (dead)', see httpd.service: # service httpd stop Stopping httpd (via systemctl): [ OK ] # service httpd status httpd.service - LSB: start and stop Apache HTTP Server Loaded: loaded (/etc/rc.d/init.d/httpd) Active: inactive (dead) since Mon, 14 Mar 2011 16:44:31 +0100; 2s ago
Makes more sense to me that it would say "Active: Stopped" or "Active: inactive (stopped)" if the service had been successfully stopped both failed and/or dead indicate that the service was not successfully stopped at least that's how I perceive it but yes it should be consistent.
Arguably sshd's main process should exit with code 0, not 255, when asked to stop peacefully.
Yes, it appears that sshd is returning exit code 255 here, which indicates failure and systemd just records that and shows that by putting the service in "failed" state. If sshd manages to shut down cleanly it should just exit with exit code 0.
repaired in rawhide