Bug 1032109 - reboot/shutdown does not close the clients connection
Summary: reboot/shutdown does not close the clients connection
Keywords:
Status: CLOSED DUPLICATE of bug 1047614
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 1050219
TreeView+ depends on / blocked
 
Reported: 2013-11-19 15:02 UTC by Petr Lautrbach
Modified: 2014-02-25 16:13 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-25 16:13:46 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Petr Lautrbach 2013-11-19 15:02:22 UTC
+++ 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.

Thanks

nathan

--- 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 
[Unit]
Description=kill all sshd sessions
Requires=mutil-user.target

[Service]
ExecStart=/usr/bin/killall sshd
Type=oneshot

[Install]
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 16:41:25 UTC
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 16:13:46 UTC

*** 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.