I've recently switched from Raspbian Jessie (that has a full UI) and Jessie-Lite (which is lean and CLI only). I connect via ssh, and have been messing with configuration and restarting my Raspberry Pi a lot. With full Jessie, I could send sudo shutdown -r now and my ssh connection (from OSX Sierra) would get a signal that it was being disconnected and close on the client end.

Then I switched to Jessie-Lite and the same thing (sudo reboot does this also) will just make ssh hang, eventually after a long time give the me ability to Ctrl-C where it gives me a broken pipe message. I didn't even realize the behavior was due to something extra or a configuration! But now it's really annoying and if I don't want to wait I have to close out my terminal.

What's the magic sauce? What am I missing and how can I install or configure it to get the friendly disconnected behavior back?

(note - my transition also included moving from kernel 4.9 to 4.4)

  • 1
    Seems to be similar problem like the one, that has solution right here: serverfault.com/questions/706475/… – DevilaN Sep 22 '17 at 7:07
  • 1
    Glad to help you, and props for making fine answer from the suggestion I've made :) – DevilaN Sep 22 '17 at 17:59

Thank you @DevilaN for pointing me to this answer to a similar problem! That started me on the right track. Here's some more information for those landing here for help.

The 'missing sauce' was a SIGTERM signal, this keeps my ssh client from hanging, and instead indicates it should close. It does so with this message:

Connection to closed by remote host.
Connection to closed.

SIGTERM is a termination notice. In order to send it, a more flexible login manager needs to be installed over the vanilla system that Jessie Lite came with. This is installed with the systemd-logind package, which in turn can be managed with loginctl. systemd-logind is used to respond to sleep hardware switches, can let other applications interrupt the shutdown process, and helps with multi-user sessions including user connected services. It's not hard to see why a UI distribution of Linux like Raspbian Jessie would choose to use it.

Also needed is dbus which is used for message distribution, such as handling the SIGTERM message, and helps with session level logins for multiple users.

As stated in the other answer, a one liner to enable this friendly message on shutdown is:

sudo apt-get install libpam-systemd dbus

If anybody can to expand on (or correct!) any of this information, please do!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.