On Wed, Aug 07, 2013 at 01:15:28PM +0200, Tom Gundersen wrote:
It is correct that systemtl poweroff is synchronous, but using telinit or --no-block will avoid that.
Are you sure about telinit ? It was the first thing I tried, assuming it would asynchronous. But the man page says nothing about it using --no-block.
but a dead-lock: systemd waits for the ssh session to finish to go on with the poweroff, and the ssh session waits for the poweroff to finish until it returns. And those are precisely the situations where "--no-block" is useful.
Actually, you don't get this deadlock. ssh will shutdown just fine even if you have some command (such as systemctl) running.
The reason for the problem you are seeing here is that the network is torn down before ssh is shutdown. This isn't actually a big problem, as the remote machine is shutting down just fine. The only problem is that the ssh client ends up hanging, which is annoying, but not really critical (kill it/ignore it/whatever).
The shutdowns are called from a script which is supposed to continue... Ciao, -- FA A world of exhaustive, reliable metadata would be an utopia. It's also a pipe-dream, founded on self-delusion, nerd hubris and hysterically inflated market opportunities. (Cory Doctorow)