GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
When I use ssh and reboot remote a message displaying that remote is rebooted is displayed and ssh session is terminated. mosh needs to be terminated manually.
It would be nice to send the disconnection signal to client when server is being terminated.
Generally speaking, Mosh already does this (just tested with a Debian server).
if it's not working for you, please make sure that your server is sending the kill signal to all processes (including your mosh-servers) before cutting the network. (Also let us know the OS of your server.)
It did not worked for me on Gentoo (both server and client) with mosh 1.2.4 while it worked with ssh.
You'll have to take this up with Gentoo -- it needs to send a kill signal (like SIGTERM) to all processes before cutting networking. That's how mosh-server knows it needs to quit.
Sorry for late reply. I have been thought about it a bit and I guess problem should occur at least on all systemd+netctl systems and probably on systemd+NetworkManager (which are probably all Linux distributions but Debian/Ubuntu currently - and Debian's folks talking about moving to Upstart or systemd).
As far as I can tell the correct signal is SIGHUP:
SIGHUP 1 Term Hangup detected on controlling terminal or death of controlling process
Which is sent by systemd but is ignored by the mosh.
LSB (ISO/IEC 23360) requires that shutdown (and shutdown -r) send SIGTERM, not SIGHUP. We can patch mosh-server to work around this, but please take this up with systemd. And please submit a pull request -- we'd be eager to merge it if systemd is moving in this direction.
(Sorry - I realized I spoke too soon. sshd reacts to SIGHUP while mosh does not but it's not the issue).
After a thought - the ssh displays a message about shutting down while mosh does not. It looks like mosh is terminating uncleanly and too soon (I guess?). Yay for debugging shutdown issues.
I'll investigate further.
I just tested this on a fresh install of Debian 9 (aka Debian Stretch), which defaults to using systemd these days, as well as my gentoo machine. In both cases, the mosh-client exited cleanly, with no need to manually terminate anything. So now that this appears fixed, I'm going to close this issue.
I have made a couple of changes over time that should cause mosh-server to more robustly terminate the client on a server shutdown in some cases. If you are still having problems here, and your SSH sessions do terminate promptly and cleanly, please comment here.
(There are still occasionally systems that bring down their network connectivity before user sessions are closed. That is a different problem which should be addressed at the OS/configuration level.)