Public bug reported:

When using "service ssh," all of the actions cause the service process
to hang, with varying results on the sshd process.

root@localdev14:~# ps -ef | grep ssh
root     28264     1  0 15:39 ?        00:00:00 /usr/sbin/sshd -D
root     28353 28264  0 15:46 ?        00:00:00 sshd: user [priv]    
user      28402 28353  0 15:46 ?        00:00:00 sshd: user@pts/0     
root     28433 28418  0 15:47 pts/0    00:00:00 grep --color=auto ssh
root@localdev14:~# service ssh stop
(after a couple of minutes)
^C
root@localdev14:~# ps -ef | grep ssh
root     28264     1  0 15:39 ?        00:00:00 /usr/sbin/sshd -D
root     28353 28264  0 15:46 ?        00:00:00 sshd: user [priv]    
user      28402 28353  0 15:46 ?        00:00:00 sshd: user@pts/0     
root     28444 28418  0 15:48 pts/0    00:00:00 grep --color=auto ssh

A trace on /usr/sbin/service shows that it's hanging at /sbin/stop;

root@localdev14:~# bash -x /usr/sbin/service ssh stop 2>&1 | tee 
/tmp/ssh.restart
++ basename /usr/sbin/service
+ VERSION='service ver. 0.91-ubuntu1'
++ basename /usr/sbin/service
+ USAGE='Usage: service < option > | --status-all | [ service_name [ command | 
--full-restart ] ]'
+ SERVICE=
+ ACTION=
+ SERVICEDIR=/etc/init.d
+ OPTIONS=
+ '[' 2 -eq 0 ']'
+ cd /
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ '[' -z '' -a 2 -eq 1 -a ssh = --status-all ']'
+ '[' 2 -eq 2 -a stop = --full-restart ']'
+ '[' -z '' ']'
+ SERVICE=ssh
+ shift
+ '[' 1 -gt 0 ']'
+ case "${1}" in
+ '[' -z ssh -a 1 -eq 1 -a stop = --status-all ']'
+ '[' 1 -eq 2 -a '' = --full-restart ']'
+ '[' -z ssh ']'
+ '[' -z '' ']'
+ ACTION=stop
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -r /etc/init/ssh.conf ']'
+ which initctl
+ initctl version
+ grep -q upstart
+ case "${ACTION}" in
+ exec stop ssh
^C
root@localdev14:~# ps -ef | grep sshd
root     28264     1  0 15:39 ?        00:00:00 /usr/sbin/sshd -D
root     28353 28264  0 15:46 ?        00:00:00 sshd: user [priv]    
user      28402 28353  0 15:46 ?        00:00:00 sshd: user@pts/0     
root     28478 28418  0 15:54 pts/0    00:00:00 grep --color=auto sshd

Restarting the service gets a different error;

root@localdev14:~# bash -x /usr/sbin/service ssh restart 2>&1 | tee 
/tmp/ssh.restart
++ basename /usr/sbin/service
+ VERSION='service ver. 0.91-ubuntu1'
++ basename /usr/sbin/service
+ USAGE='Usage: service < option > | --status-all | [ service_name [ command | 
--full-restart ] ]'
+ SERVICE=
+ ACTION=
+ SERVICEDIR=/etc/init.d
+ OPTIONS=
+ '[' 2 -eq 0 ']'
+ cd /
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ '[' -z '' -a 2 -eq 1 -a ssh = --status-all ']'
+ '[' 2 -eq 2 -a restart = --full-restart ']'
+ '[' -z '' ']'
+ SERVICE=ssh
+ shift
+ '[' 1 -gt 0 ']'
+ case "${1}" in
+ '[' -z ssh -a 1 -eq 1 -a restart = --status-all ']'
+ '[' 1 -eq 2 -a '' = --full-restart ']'
+ '[' -z ssh ']'
+ '[' -z '' ']'
+ ACTION=restart
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -r /etc/init/ssh.conf ']'
+ which initctl
+ initctl version
+ grep -q upstart
+ case "${ACTION}" in
+ stop ssh
stop: Job has already been stopped: ssh
+ :
+ exec start ssh
^C
root@localdev14:~# ps -ef | grep sshd
root     28264     1  0 15:39 ?        00:00:00 /usr/sbin/sshd -D
root     28353 28264  0 15:46 ?        00:00:00 sshd: user [priv]    
user      28402 28353  0 15:46 ?        00:00:00 sshd: user@pts/0     
root     28495 28418  0 15:56 pts/0    00:00:00 grep --color=auto sshd

As you can see from the PID, the sshd service was in fact not stopped.

If you kill the sshd manually, and try to use the service command to
start the process, that hangs as well, although the process is actually
started;

root@localdev14:~# bash -x /usr/sbin/service ssh start 2>&1 | tee /tmp/ssh.start
++ basename /usr/sbin/service
+ VERSION='service ver. 0.91-ubuntu1'
++ basename /usr/sbin/service
+ USAGE='Usage: service < option > | --status-all | [ service_name [ command | 
--full-restart ] ]'
+ SERVICE=
+ ACTION=
+ SERVICEDIR=/etc/init.d
+ OPTIONS=
+ '[' 2 -eq 0 ']'
+ cd /
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ '[' -z '' -a 2 -eq 1 -a ssh = --status-all ']'
+ '[' 2 -eq 2 -a start = --full-restart ']'
+ '[' -z '' ']'
+ SERVICE=ssh
+ shift
+ '[' 1 -gt 0 ']'
+ case "${1}" in
+ '[' -z ssh -a 1 -eq 1 -a start = --status-all ']'
+ '[' 1 -eq 2 -a '' = --full-restart ']'
+ '[' -z ssh ']'
+ '[' -z '' ']'
+ ACTION=start
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -r /etc/init/ssh.conf ']'
+ which initctl
+ initctl version
+ grep -q upstart
+ case "${ACTION}" in
+ exec start ssh
^C
root@localdev14:~# ps -ef | grep sshd
root     28353     1  0 15:46 ?        00:00:00 sshd: user [priv]    
user      28402 28353  0 15:46 ?        00:00:00 sshd: user@pts/0     
root     28510     1  0 15:58 ?        00:00:00 /usr/sbin/sshd -D
root     28515 28418  0 15:59 pts/0    00:00:00 grep --color=auto sshd


I've been able to reproduce this problem both after a reboot, and from the 
console, with no user sshd process running.  

On a side note, the sshd_config file appears to be sane.  At least no
errors are being presented, so I don't believe this is OpenSSH related.

root@localdev14:~# sshd -T
port 22
protocol 2
addressfamily any  
listenaddress 0.0.0.0:22
listenaddress [::]:22
usepam 1
serverkeybits 1024 
logingracetime 120 
keyregenerationinterval 3600
x11displayoffset 10
maxauthtries 6
maxsessions 10
clientaliveinterval 0
clientalivecountmax 3
permitrootlogin no 
ignorerhosts yes   
ignoreuserknownhosts no
rhostsrsaauthentication no
hostbasedauthentication no
hostbasedusesnamefrompacketonly no
rsaauthentication yes
pubkeyauthentication yes
passwordauthentication yes
kbdinteractiveauthentication yes
challengeresponseauthentication no
printmotd no
printlastlog yes   
x11forwarding yes  
x11uselocalhost yes
strictmodes yes
tcpkeepalive yes   
permitemptypasswords no
permituserenvironment no
uselogin no
compression delayed
gatewayports no
usedns yes
allowtcpforwarding yes
useprivilegeseparation yes
pidfile /var/run/sshd.pid
xauthlocation /usr/bin/xauth
authorizedkeysfile %h/.ssh/authorized_keys
authorizedkeysfile2 %h/.ssh/authorized_keys
loglevel INFO
syslogfacility AUTH
hostkey /etc/ssh/ssh_host_rsa_key
hostkey /etc/ssh/ssh_host_dsa_key
hostkey /etc/ssh/ssh_host_ecdsa_key
acceptenv LANG
acceptenv LC_*
subsystem sftp /usr/lib/openssh/sftp-server
maxstartups 10:100:10
permittunnel no
ipqos 0x10 0x08
permitopen any
root@localdev14:~# 


System Specs:

root@localdev14:~# lsb_release -rd
Description:    Ubuntu 14.04 LTS
Release:        14.04

root@localdev14:~# apt-cache policy upstart
upstart:
  Installed: 1.12.1-0ubuntu4
  Candidate: 1.12.1-0ubuntu4
  Version table:
 *** 1.12.1-0ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

** Affects: openssh (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openssh in Ubuntu.
https://bugs.launchpad.net/bugs/1329939

Title:
  Service ssh stop/start/restart hangs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1329939/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to