[sf-lug] server reboot/shutdown & ssh disconnection - or not

Michael Paoli Michael.Paoli at cal.berkeley.edu
Sun Jan 1 11:11:53 PST 2017


> From: "Michael Paoli" <Michael.Paoli at cal.berkeley.edu>
> Subject: Re: server reboot/shutdown & ssh disconnection - or not
> Date: Sun, 01 Jan 2017 09:56:48 -0800

>> From: "Akkana Peck" <akkana at shallowsky.com>
>> Subject: Re: [sf-lug] server reboot
>> Date: Sun, 1 Jan 2017 09:10:48 -0700
>
>> Lots of interesting answers, but I'm curious about the original problem.
>>
>> Usually, when I ssh into a machine and reboot it remotely, it
>> disconnects and puts me back in my local shell. I have occasionally
>> seen the behavior described in the original post, where the remote
>> shell just hangs and ssh doesn't disconnect, and I've always
>> wondered what the difference is in those cases, and why ssh isn't
>> detecting the disconnect.
>>
>> When that happens, I type ~. which tells ssh to break the connection
>> and exit. So far that's always worked for me.
>
> Somewhere, within the last few months or less, I read something that
> somewhat specifically asked that ... and it was addressed.  But I don't
> recall where, and haven't been able to easily find it again.  May have
> been some specific distribution or release thereof - perhaps even
> considered a "bug" for that distribution/release?  But I don't
> specifically recall.


Still not sure where I saw it earlier, but some of these bits may be useful:

    * Add a session cleanup script and a systemd unit file to trigger it,
      which serves to terminate SSH sessions cleanly if systemd doesn't do
      that itself, often because libpam-systemd is not installed (thanks,
      Vivek Das Mohapatra, Tom Hutter, and others; closes: #751636).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751636#337
https://www.google.com/#q=shutdown+ssh+disconnect+%28linux+OR+ubuntu+OR+fedora+OR+debian+OR+centos+OR+redhat+OR+%22red+hat%22%29
http://unix.stackexchange.com/questions/216950/after-sending-shutdown-command-ssh-session-doesnt-terminate
http://unix.stackexchange.com/questions/58271/closing-connection-after-executing-reboot-using-ssh-command
http://serverfault.com/questions/706475/ssh-sessions-hang-on-shutdown-reboot

"For every complex problem, there is a solution that is simple, neat,  
and wrong." -- Mencken




More information about the sf-lug mailing list