Package: dpkg
Version: 1.18.25
AFAICS a line
start-stop-daemon -x /usr/sbin/sshd -T
returns 0 (success), if it finds the sshd running in a container,
even if the local service has been stopped. Sample session (running
2 LXCs with their own private sshd each):
root@srvl011a:~# ps -ef | grep sshd
root 1748 1475 0 May15 ? 00:00:00 /usr/sbin/sshd -D
root 414999 414500 0 May16 ? 00:00:05 /usr/sbin/sshd -D
root 2683140 1 0 11:35 ? 00:00:00 sshd: root@notty
root 2685330 1 0 11:42 ? 00:00:00 /usr/sbin/sshd -D
root 2685332 2683159 0 11:42 pts/1 00:00:00 grep sshd
root@srvl011a:~# start-stop-daemon -x /usr/sbin/sshd -T
root@srvl011a:~# echo $?
0
root@srvl011a:~# service sshd stop
root@srvl011a:~# ps -ef | grep sshd
root 1748 1475 0 May15 ? 00:00:00 /usr/sbin/sshd -D
root 414999 414500 0 May16 ? 00:00:05 /usr/sbin/sshd -D
root 2683140 1 0 11:35 ? 00:00:00 sshd: root@notty
root 2685704 2683159 0 11:42 pts/1 00:00:00 grep sshd
root@srvl011a:~# start-stop-daemon -x /usr/sbin/sshd -T
root@srvl011a:~# echo $?
0
If I try this on a host without containers, then there is just a single
instance of sshd and start-stop-daemon works as expected:
root@dpcl082:~# ps -ef | grep sshd
root 13153 1 0 11:48 ? 00:00:00 /usr/sbin/sshd -D
root 13159 10771 0 11:48 pts/12 00:00:00 grep sshd
root@dpcl082:~# start-stop-daemon -x /usr/sbin/sshd -T
root@dpcl082:~# echo $?
0
root@dpcl082:~# service sshd stop
root@dpcl082:~# ps -ef | grep sshd
root 13358 10771 0 11:48 pts/12 00:00:00 grep sshd
root@dpcl082:~# start-stop-daemon -x /usr/sbin/sshd -T
root@dpcl082:~# echo $?
3
This might be serious.
Regards
Harri