Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

SSH not terminating the client when rebooting

Got problems with your B2 or B3? Share and get helped!
Post Reply
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

SSH not terminating the client when rebooting

Post by Cheeseboy »

Hi all,

I find the most annoying new "feature" of the b3 is sshd failing to tell the clients to terminate the connection.
If I issue the shutdown or reboot command on bubba2 (or any other linux host) the ssh client will be notified that the connection is lost. If I do the same on b3, the client will just hang until I kill it.

Any ideas on how to make it behave?

Thanks,

Cheeseboy
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

So, when you disconnect the cable to the bubba2 server and leave the B3 client hanging for a few min, and then plug the B2 back in again, do you get to keep your connection?
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: SSH not terminating the client when rebooting

Post by Cheeseboy »

Yes.
SSH has built-in cleverness that lets it resume a broken connection.
But this is beside the point, when the server knows it is going down, the sshd normally terminates the client.
This does not happen on the b3.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

I just tried it on mine and it works just like it should. I get:

Code: Select all

Connection to 192.168.0.40 closed by remote host.
Connection to 192.168.0.40 closed.
So whatever problem your having seems to be not systemic for the B3 config
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: SSH not terminating the client when rebooting

Post by Cheeseboy »

Did you actually reboot your b3?

bubba2 behaviour:

Code: Select all

niklas@bubba2:~$ sudo reboot
Password:

Broadcast message from root@bubba2 (pts/0) (Sat Dec  4 13:08:39 2010):

The system is going down for reboot NOW!
niklas@bubba2:~$ Connection to bubba2 closed by remote host.
Connection to bubba2 closed.
b3 behaviour:

Code: Select all

niklas@b3:~$ sudo reboot
[sudo] password for niklas: 

Broadcast message from root@b3 (pts/0) (Sat Dec  4 13:11:48 2010):

The system is going down for reboot NOW!
niklas@b3:~$ 
The client then hangs indefinitely.
It does not recover the connection when the b3 comes up again. I do not expect it to do so, I just want the client to be notified about the imminent reboot and disconnect.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

Cheeseboy wrote:Did you actually reboot your b3?
well.... no because the b3 was the client right? I rebooted the server B1. And then when the server B1 shuts down SSHD and closes the network interfaces, the B3 client gets a warning as I displayed in my previous post and it drops me back into the shell of the client. So it does not hang but behaves as it should.

Do you have any funny business in your /etc/ssh/ssh_config?
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: SSH not terminating the client when rebooting

Post by Cheeseboy »

OK, you misunderstood my problem then.
It is when I connect to the b3 from other hosts and reboot the b3 that it misbehaves...
Do you have any funny business in your /etc/ssh/ssh_config?
Nope, it is untouched by me and apt (I think... (it's timestamp is may 23 2010))

Comments removed:

Code: Select all

Host *
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
Also:

Code: Select all

niklas@b3:~/sshtest$ diff ssh_config_b3 ssh_config_bubba2 
27,30d26
< #   GSSAPIAuthentication no
< #   GSSAPIDelegateCredentials no
< #   GSSAPIKeyExchange no
< #   GSSAPITrustDNS no
42,43c38
< #   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
< #   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
---
> #   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
48,49d42
< #   VisualHostKey no
< #   ProxyCommand ssh -q -W %h:%p gateway.example.com
Only comments as far as I can see...
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

ah so the B3 is the server. In that case we should be looking at sshd_config, not ssh_config :). I'll go and check what my behaviour is
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

Yop I can replicate the problem. When B3 is the server and is rebooted then the connected client (either SSH from another Bubba, or PuTTY from windows) never gets the message that the connection is gone and hangs forever.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

THe sshd_config on the B1 and B3 are identical, suggesting the solution is not there.
Accoring to some other forums this is an issue of improper shutdown

https://bugs.archlinux.org/task/17389?string=when

Apparently the system does not shut down the network when it shuts down the machine. For some people that is useful behaviour (?). SOlution seems to be to explicitly drop connections in an rc.shutdown script.
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: SSH not terminating the client when rebooting

Post by Cheeseboy »

Thanks for the research Ubi, I couldn't find anything. Obviously my search engine skills needs improving.
I'm depressed with what you found though: a bug report for archlinux that was fixed in June.
The proposed workarounds do not appeal. I would prefer a fix from the distro maintainer rather than messing about with the boot scripts...

Oh well. We have at least reported the problem (kinda, I'm not at all convinced that Excito monitors these fora)

Pizzatime!
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SSH not terminating the client when rebooting

Post by Ubi »

yeah I second that, but I'd rather see that Excito focuses on the B3 sudden-death issues than on this bug...
Post Reply