Bug 1032109 - reboot/shutdown does not close the clients connection
reboot/shutdown does not close the clients connection
Status: CLOSED DUPLICATE of bug 1047614
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
Unspecified Unspecified
high Severity urgent
: rc
: ---
Assigned To: systemd-maint
Depends On:
Blocks: 1050219
  Show dependency treegraph
Reported: 2013-11-19 10:02 EST by Petr Lautrbach
Modified: 2014-02-25 11:13 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-02-25 11:13:46 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Petr Lautrbach 2013-11-19 10:02:22 EST
+++ This bug was initially created as a clone of Bug #1023788 +++

i assume it has something to do with systemd, however, on my F20 test-VM reboot/shutdown let hang the client for a long time with no way to kill the session with STRG+C and the only way to release the terminal is to have a different one for "kill -s SIGKILL" the ssh-client

--- Additional comment from Nathan Crubel on 2013-11-18 16:26:31 CET ---

I am seeing the same issue.



--- Additional comment from Petr Lautrbach on 2013-11-19 15:35:39 CET ---

I can reproduce this issue using network.service instead of NetworkManager.service. And it incidentally works with nm.service because nm doesn't shut a network interface down on stop. The problem with ssh session is that should be killed only on shutdown/reboot and they shouldn't be killed at sshd stop, network stop and so.

Following unit works for me as a workaround:

# cat /etc/systemd/system/sshd-shutdown.service 
Description=kill all sshd sessions

ExecStart=/usr/bin/killall sshd

WantedBy=shutdown.target reboot.target poweroff.target

--- Additional comment from Harald Reindl on 2013-11-19 15:41:32 CET ---

i know that they should not be killed and sshd restart/stop and network restart but that doe snot change the fact that it is a regression because on F18/F19 there is no problem

--- Additional comment from Petr Lautrbach on 2013-11-19 15:58:57 CET ---

sshd.service are same on f18 and f19. So, as you wrote, it's probably related to something else than openssh itself and I'm still looking for it. I started with the sshd-shutdown.service unit as it might be one of solutions how to workaround random future changes in the systemd or network services.
Comment 1 Frank Danapfel 2014-02-21 11:41:25 EST
On RHEL6 this issue was apparently fixed by adding the following to the stop() function of /etc/init.d/sshd:

        # if we are in halt or reboot runlevel kill all running sessions
        # so the TCP connections are closed cleanly
        if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
            trap '' TERM
            killall $prog 2>/dev/null
            trap TERM

Maybe this helps to fix this for RHEL7 as well.
Comment 2 Lukáš Nykrýn 2014-02-25 11:13:46 EST

*** This bug has been marked as a duplicate of bug 1047614 ***

Note You need to log in before you can comment on or make changes to this bug.