← Back to team overview

touch-packages team mailing list archive

[Bug 1329939] Re: Service ssh stop/start/restart hangs

 

Hi,

I have quite the same problem.
Only after a reboot the sshd is running, working and accepting connections.

Whatever I try:
 stop ssh, 
 restart ssh, 
 start ssh
or with service like:
 service ssh stop/start/restart
or with /etc/init.d/ssh, which isn't doing anything.


the daemon ist (maybe) started, but NOT accepting connections.

the command: start ssh 
does NOT return. and ssh ist not started/running.
I have to press ^C, then the the service is started!  wtf?!?!
and shows up with:    /usr/sbin/sshd -D

but in this state it is not accepting connections.
I tries all combinations and methods. 
nothing is working.

funny thing:
when i start it with:   start ssh &
the command returns, nothing is really started  (ps -ef shows nothing)

BUT when i say:   service ssh status

this happens:
ssh start/running, process 11633
ssh start/running, process 11633
[1]+  Done                    start ssh

now sshd ist started AND accepting connections!!!!!
this really is a bug!
its the only way to start/restart the daemon without reboot :(


best regards
 axel

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

Title:
  Service ssh stop/start/restart hangs

Status in “openssh” package in Ubuntu:
  Confirmed

Bug description:
  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

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