You are not logged in.

#1 2012-09-24 22:58:24

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Systemd + SSH: Client connections always hang on reboot/halt

Hi,

Does anyone know the solution for FS#31250 - [openssh] shutdown of systemd install doesn't notify/close client connections?

I tried both sshd.socket and sshd.service, first one does sometimes(!!) log the clients out, but most of the time they hang until timeout.
sshd.service does always produce hang.

Network ist configured via NetworkManager.

Please give a solution for this, this is really annoying. I like systemd, but i have this little bug on all my machines.
Or do I have to use the solution from wiki? I never needed that with old initscripts.

Thx smile

Last edited by Evilandi666 (2012-09-26 08:41:29)

Offline

#2 2012-09-25 00:11:20

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: Systemd + SSH: Client connections always hang on reboot/halt

I've always had to

sudo reboot && exit

on the remote or the connection would hang.


You're just jealous because the voices only talk to me.

Offline

#3 2012-09-26 08:37:12

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: Systemd + SSH: Client connections always hang on reboot/halt

Really no one knows a real solution?
Dave said that he "cannot reproduce any hang with the single daemon process." .. can you please tell us, how you achieve this?

Last edited by Evilandi666 (2012-09-26 08:38:28)

Offline

#4 2012-09-28 11:47:02

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: Systemd + SSH: Client connections always hang on reboot/halt

bump

Offline

#5 2012-09-28 16:31:21

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: Systemd + SSH: Client connections always hang on reboot/halt

Adding After=network.target should (theoretically) fix your problem as it should (theoretically) cause sshd to be stopped before networkmanager. If that doesn't work, you could try adding After=NetworkManager.service.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#6 2012-09-30 21:58:35

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: Systemd + SSH: Client connections always hang on reboot/halt

I tried it both (copied original file to /etc/systemd/system/ and added one of those lines), none of them helped.

So I am still looking for a solution ....

Offline

#7 2012-10-01 15:41:24

D4ve
Member
Registered: 2012-08-02
Posts: 209

Re: Systemd + SSH: Client connections always hang on reboot/halt

Evilandi666 wrote:

So I am still looking for a solution ....

Same here sad

Offline

#8 2012-10-07 22:10:52

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: Systemd + SSH: Client connections always hang on reboot/halt

Push

Offline

#9 2012-10-07 23:08:45

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Systemd + SSH: Client connections always hang on reboot/halt

Hi guys,

The solution is to make a copy of systemd-user-sessions.service in /etc/systemd/system and add "After=network.target" to it.

This way all user sessions are started after, and more importantly, shut down before the network connection comes up/is dropped.

The reason it is not correct to add this to the ssh service itself is that the user sessions are split off from the ssh service, so even if the daemon goes down they stay around.

I'll be looking at sorting this out properly upstream, but haven't gotten around to it yet.

HTH

Offline

#10 2012-10-08 03:42:50

Gnarl
Member
Registered: 2010-11-18
Posts: 63

Re: Systemd + SSH: Client connections always hang on reboot/halt

I've always just used the short cut keys ~.

Offline

#11 2012-11-21 10:00:55

DolphinTsar
Member
From: San Francisco, CA
Registered: 2011-05-22
Posts: 12

Re: Systemd + SSH: Client connections always hang on reboot/halt

Had the same issue; tomegun's solution works fine for me. Bit of a bother to hunt this down but at least I'm understanding systemd better through the process. Cheers.


arch + gnome on dell xps13

Offline

#12 2013-04-12 10:10:23

zombyrad
Member
Registered: 2010-07-09
Posts: 2

Re: Systemd + SSH: Client connections always hang on reboot/halt

Kinda an old topic, but I'm having the same issue as described. Any news on a fix, as I don't have a systemd-user-sessions.service file in /ets/systemd/system and therefore cannot use the proposed workaround. Thanks.

Last edited by zombyrad (2013-04-12 10:11:10)

Offline

#13 2013-05-10 21:10:13

Sinma
Member
Registered: 2012-03-26
Posts: 8

Re: Systemd + SSH: Client connections always hang on reboot/halt

Maybe it’s a bit later, but actually the solution is a bit simpler.

Just do:

# nano /usr/lib/systemd/system/systemd-user-sessions.service

Comment the «After» line, and replace it by «After=network.target». Now, the file must be like that:

[…]

[Unit]
Description=Permit User Sessions
Documentation=man:systemd-user-sessions.service(8)
#After=remote-fs.target
After=network.target

[Service]
[…]

Now, just reboot (the modification takes effect immediately because each time systemd need to do something it reads files) and enjoy no more hangs:

Connection to xxx.xx closed by remote host.
Connection to xxx.xx closed.

Maybe I’ll put it on the wiki if someone can confirm that it’s not crappy.

Last edited by Sinma (2013-05-10 21:12:29)

Offline

#14 2013-05-16 19:21:05

ptk
Member
Registered: 2013-05-16
Posts: 3

Re: Systemd + SSH: Client connections always hang on reboot/halt

Hi,

your solution is working for me.
But I needed a reboot to apply the change.

Thanks for you help.

Offline

#15 2013-05-16 19:29:13

progandy
Member
Registered: 2012-05-17
Posts: 5,262

Re: Systemd + SSH: Client connections always hang on reboot/halt

ptk wrote:

Hi,

your solution is working for me.
But I needed a reboot to apply the change.

Thanks for you help.

You could have done a systemctl daemon-reload instead.
PS: Don't remove After=remote-fs.target, just add network.target, too, I think.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#16 2013-05-16 20:30:33

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Systemd + SSH: Client connections always hang on reboot/halt

You should all be aware that the files in /usr/lib/systemd/system are not meant to be modified.  They will be overwritten by an update.

Offline

#17 2013-05-31 10:35:57

ptk
Member
Registered: 2013-05-16
Posts: 3

Re: Systemd + SSH: Client connections always hang on reboot/halt

I've seen this after my last update :-(
Is there any other/better way to fix this.

Unfortunately the bug (https://bugs.archlinux.org/task/31250) is closed with "Won't fix".

Offline

Board footer

Powered by FluxBB