Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] ssh connection hangs on system reboot/shutdown/halt
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
DNAspark99
Guru
Guru


Joined: 03 Sep 2004
Posts: 321

PostPosted: Fri Mar 08, 2013 10:08 pm    Post subject: Reply with quote

Sorry, didn't mean to come off indignant or anything - I absolutely appreciate your input on this, the issue needs attention, and you've provided nothing but valuable input!
I'm just updating the thread with feedback as I try out your suggestions. )

Indeed, the following works in all scenarios, and am now using your suggestion in /etc/init.d/sshd, it's quicker, it's cleaner, everything works, everyones happy. Thanks!!
I just hope this fix finds it's way into future gentoo :)

Code:

stop() {
        if [ "${RC_CMD}" = "restart" ] ; then
                checkconfig || return 1
        fi

        ebegin "Stopping ${SVCNAME}"
        start-stop-daemon --stop --exec "${SSHD_BINARY}" \
            --pidfile "${SSHD_PIDFILE}" --quiet
        eend $?

        if [ "${RC_RUNLEVEL}" = "shutdown" ]; then
                SSH_CLIENT_PIDS="$(pgrep -f 'sshd:')"
                if [[ -n ${SSH_CLIENT_PIDS} ]] ; then
                    kill -TERM ${SSH_CLIENT_PIDS}
                fi
        fi
}


[SOLVED], 3rd time's the charm! :)
Back to top
View user's profile Send private message
m27315
Apprentice
Apprentice


Joined: 10 Dec 2004
Posts: 234
Location: 2 workstations down

PostPosted: Thu May 09, 2013 7:24 pm    Post subject: Reply with quote

this last solution worked great for me!
Back to top
View user's profile Send private message
Whissi
n00b
n00b


Joined: 12 Jan 2011
Posts: 9

PostPosted: Thu Aug 22, 2013 3:55 pm    Post subject: Reply with quote

Hi,

this thread is marked as "fixed" but it seems like the issue still exists.

openrc-0.12 has landed in tree and should contain a fixed according to William but it looks like, that Gentoo still leaves out connections on shutdown.

From #openrc it seems like I am the only one who is able to reproduce the problem. It would be nice if some of you could test it again (don't forget to deactivate your manually fixes!) and report in https://bugs.gentoo.org/show_bug.cgi?id=259183 if you still see the issue or not.

Thanks!
_________________
Regards,
Whissi
Back to top
View user's profile Send private message
UncleVan
n00b
n00b


Joined: 08 Feb 2011
Posts: 47

PostPosted: Wed Sep 11, 2013 5:40 pm    Post subject: still nops... Reply with quote

I found the simplest and most compatible solution so far:

Code:
cat > /etc/local.d/10kill_ssh_session.stop

# To not let ssh/telnet connection(s) hanging on shutdown/reboot
killall ssh sshd telnet telnetd in.telnetd
CTRL-D

and then
Code:
chmod u+x /etc/local.d/10kill_ssh_session.stop

/etc/local.d/*.stop scripts are executed on reboot/shutdown.

Try it !
Back to top
View user's profile Send private message
yuyuyak
n00b
n00b


Joined: 23 Nov 2012
Posts: 31
Location: United States

PostPosted: Thu Sep 12, 2013 1:57 am    Post subject: Reply with quote

Been following this thread for awhile, all contributions, bravo! Used DNAspark99's solution for a month or two, works as advertised.
But I gotta give the gold star to UncleVan's solution, neat, clean, the Gentoo way and most important of all, it works too.
Thanks to all
Back to top
View user's profile Send private message
DNAspark99
Guru
Guru


Joined: 03 Sep 2004
Posts: 321

PostPosted: Thu Nov 07, 2013 9:15 pm    Post subject: Reply with quote

Fresh install.
It appears this is still an issue.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum