Halt command on remote box causes ssh client to hang
If I give the halt command on a remote box while connected through a ssh client the ssh client hangs. How do I prevent this? Cheers Ross Drummond
Re: Halt command on remote box causes ssh client to hang
If I give the halt command on a remote box while connected through a ssh client the ssh client hangs. This smells like an improper shutdown of the remote, which should reset the tcp connection when the ssh daemon gets killed. I'm guessing at some possibilities: The tcp stack gets shut down before the reset packet goes out. The remote is overloaded, and there isn't enough cpu time for the ssh daemon to generate a connection reset from the sigterm before it gets a sigkill. Try diddling the system init scripts and increase that delay. Only an issue on rather slow machines. Either remote or local ssh softwares are buggy. As a workaround, like you can interrupt a telnet client with ^], you can interrupt an ssh client with ~.return (but it only works after a return, or at the beginning of a line). HTH, Volker -- Volker Kuhlmann is list0570 with the domain in header http://volker.dnsalias.net/ Please do not CC list postings to me.
Re: Halt command on remote box causes ssh client to hang
Hi, I think the scenario you are describing is: logged into box A. ssh to box B do various things. halt (on box B) === This just sits there - the ssh does not break and return control to you on box A. This is identical behaviour to if you had unplugged the ethernet cable from box B. the ssh client on box A is waiting for packets from B - and will wait for ages. you can modify your tcp sockets on box A to have keep alives etc. This is a bit excessive. I suggest that you do ssh to box B do whateever sudo su - (become root, which I suspect you have done to issue the halt command) halt exit and control will immediately return you to box A. Derek. On Thu, 15 Oct 2009, Ross Drummond wrote: If I give the halt command on a remote box while connected through a ssh client the ssh client hangs. How do I prevent this? Cheers Ross Drummond -- Derek Smithies Ph.D. IndraNet Technologies Ltd. ph +64 3 365 6485 Web: http://www.indranet-technologies.com/ The only thing IE should be used for is to download Fire Fox My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment. --Larry Wall
Re: Halt command on remote box causes ssh client to hang
Hi, ssh (in recent versions) supports an 'in band' (encrypted) server alive messages: ServerAliveCountMax Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any messages back from the server. If this threshold is reached while server alive messages are being sent, ssh will disconnect from the server, terminating the session. It is important to note that the use of server alive messages is very different from TCPKeepAlive (below). The server alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The server alive mechanism is valuable when the client or server depend on knowing when a con- nection has become inactive. The default value is 3. If, for example, ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds. This option applies to protocol version 2 only. ServerAliveInterval Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. This option applies to protocol version 2 only. So adding something along the lines of -oServerAliveInterval=15 to your command line when invoking ssh should work. It does work for me ;) -- Delio On 15/10/2009, at 10:53 AM, Derek Smithies wrote: Hi, I think the scenario you are describing is: logged into box A. ssh to box B do various things. halt (on box B) === This just sits there - the ssh does not break and return control to you on box A. This is identical behaviour to if you had unplugged the ethernet cable from box B. the ssh client on box A is waiting for packets from B - and will wait for ages. you can modify your tcp sockets on box A to have keep alives etc. This is a bit excessive. I suggest that you do ssh to box B do whateever sudo su - (become root, which I suspect you have done to issue the halt command) halt exit and control will immediately return you to box A. Derek. On Thu, 15 Oct 2009, Ross Drummond wrote: If I give the halt command on a remote box while connected through a ssh client the ssh client hangs. How do I prevent this? Cheers Ross Drummond -- Derek Smithies Ph.D. IndraNet Technologies Ltd. ph +64 3 365 6485 Web: http://www.indranet-technologies.com/ The only thing IE should be used for is to download Fire Fox My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment. --Larry Wall
Re: Halt command on remote box causes ssh client to hang
On Thu, Oct 15, 2009 at 10:53 AM, Derek Smithies de...@indranet.co.nz wrote: Hi, I think the scenario you are describing is: logged into box A. ssh to box B do various things. halt (on box B) === This just sits there - the ssh does not break and return control to you on box A. This is identical behaviour to if you had unplugged the ethernet cable from box B. the ssh client on box A is waiting for packets from B - and will wait for ages. you can modify your tcp sockets on box A to have keep alives etc. This is a bit excessive. I generally find that if I do reboot or halt via ssh then if I log out quickly (ctrl-d is of course the quickest) then it logs out fine. However if you leave it too long you get the described behaviour, ie the terminal hung until some timeout ie reached. But is it really a problem? If I need a new terminal on A then I just ctrl-shif-t (on the terminal that comes with ubuntu|gnome) and get a new tab. So I end up with a lot of tabs? yes, and at times it is confusing, but X is just a method to havineg more terminals, and at this it succeeds admirably.
Re: Halt command on remote box causes ssh client to hang
On Thu, Oct 15, 2009 at 11:25 AM, Nick Rout nick.r...@gmail.com wrote: Of course you can always use shutdown instead of halt or reboot, and define the time you want the shutdown to occur. Set it to shutdown one minute from now and then log out gracefully :) eg shutdown -h +1 ctrl-d
Re: Halt command on remote box causes ssh client to hang
alpine.deb.2.00.0910151047250.6...@kauri.acheron.indranet.co.nz 52bd4a780910141525j5fdf7707jf07aa211bd57c...@mail.gmail.com 52bd4a780910141530l69dfdfe4j8fea5bea7e5d9...@mail.gmail.com Message-ID: e0f9d279a0ce727f95352918fe44a...@snap.net.nz X-Sender: r...@ashburton.co.nz X-Username: ro...@snap.net.nz Received: from 5.63.255.123.dynamic.snap.net.nz [123.255.63.5] with HTTP/1.1 (POST); Thu, 15 Oct 2009 12:18:28 +1300 User-Agent: RoundCube Webmail/0.1-rc2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Thu, 15 Oct 2009 11:30:28 +1300, Nick Rout nick.r...@gmail.com wrote: On Thu, Oct 15, 2009 at 11:25 AM, Nick Rout nick.r...@gmail.com wrote: Of course you can always use shutdown instead of halt or reboot, and define the time you want the shutdown to occur. Set it to shutdown one minute from now and then log out gracefully :) eg shutdown -h +1 ctrl-d Thanks to all who replied, halt logout works for me. Steve Holdaway wrote: but don't you end up in a bad place if you shut down a remote box? How do you restart it? No, it is under my desk. Cheers Ross Drummond