Bug 835534 - sshd restart closes all sessions
Summary: sshd restart closes all sessions
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: rawhide
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 843925 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-26 12:17 UTC by Petr Lautrbach
Modified: 2012-09-14 14:13 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-14 14:13:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Petr Lautrbach 2012-06-26 12:17:30 UTC
Description of problem:
restart of sshd.service closes connected sessions.

Version-Release number of selected component (if applicable):
# rpm -q openssh systemd
openssh-5.9p1-23.fc18.x86_64
systemd-185-7.gite7aee75.fc18.x86_64

How reproducible:
always

Steps to Reproduce:
# ps xawf -eo pid,user,cgroup,args
...
 1244 root     3:cpuacct,cpu:/system/sshd. /usr/sbin/sshd -D
 1245 root     3:cpuacct,cpu:/system/sshd.  \_ sshd: root@pts/0
 1249 root     3:cpuacct,cpu:/system/sshd.      \_ -bash
 1266 root     3:cpuacct,cpu:/system/sshd.          \_ ps xawf -eo pid,user,cgroup,args

# systemctl status sshd.service
sshd.service - OpenSSH server daemon
          Loaded: loaded (/etc/systemd/system/sshd.service; enabled)
          Active: active (running) since Tue, 26 Jun 2012 08:05:21 -0400; 1min 23s ago
        Main PID: 1244 (sshd)
          CGroup: name=systemd:/system/sshd.service
                  └ 1244 /usr/sbin/sshd -D

# grep systemd /etc/pam.d/{password,system}-auth
/etc/pam.d/password-auth:-session     optional      pam_systemd.so
/etc/pam.d/system-auth:-session     optional      pam_systemd.so

# systemctl restart sshd.service
Connection to rawhide-openssh closed by remote host.
Connection to rawhide-openssh closed.

  
Same openssh and pam configuration work on f17

Comment 1 Michal Schmidt 2012-06-26 12:22:15 UTC
Is this the same as the RHEL bug 833379? Are you using any non-default ControlGroup= settings in sshd.service?

Comment 2 Petr Lautrbach 2012-06-26 12:49:08 UTC
It might be same. I use default .service file for sshd service without any change.

Comment 3 Petr Lautrbach 2012-06-26 12:57:37 UTC
I've removed debug sshd.service from /etc.

# systemctl status sshd.service
sshd.service - OpenSSH server daemon
          Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
          Active: active (running) since Tue, 26 Jun 2012 08:56:35 -0400; 7s ago
         Process: 956 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
        Main PID: 960 (sshd)
          CGroup: name=systemd:/system/sshd.service
                  └ 960 /usr/sbin/sshd -D

# cat /usr/lib/systemd/system/sshd.service
[Unit]
Description=OpenSSH server daemon
After=syslog.target network.target auditd.service

[Service]
EnvironmentFile=/etc/sysconfig/sshd
ExecStartPre=/usr/sbin/sshd-keygen
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Comment 4 Michal Schmidt 2012-06-26 13:11:58 UTC
I logged in to your VM (thanks!) and saw this:

# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/system/sshd.service
2:cpuset:/
1:name=systemd:/user/root/9

So my login shell is sharing the group with sshd.service in the cpuacct,cpu hierarchy.
It appears to be a bug in systemd that it kills processes in all the cgroup bondings when stopping sshd.service. I believe that for the killing only the "name=systemd" hierarchy should be used.

Comment 5 Lukáš Nykrýn 2012-06-26 14:27:32 UTC
I am not quite sure if problem is completely in systemd. I had quite 'old' rawhide but with latest systemd and the result was:
[root@systemd ~]# uname -a
Linux systemd 3.5.0-0.rc1.git0.1.fc18.x86_64 #1 SMP Sun Jun 3 14:07:54 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@systemd ~]# rpm -qv systemd
systemd-185-7.gite7aee75.fc18.x86_64
[root@systemd ~]# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/user/root/2

But after yum update:
[root@systemd ~]# uname -a
Linux systemd 3.5.0-0.rc3.git0.2.fc18.x86_64 #1 SMP Mon Jun 18 14:17:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@systemd ~]# rpm -qv systemd
systemd-185-7.gite7aee75.fc18.x86_64
[root@systemd ~]# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/system/sshd.service
2:cpuset:/
1:name=systemd:/user/root/2

Comment 6 Michal Schmidt 2012-06-26 14:38:41 UTC
(In reply to comment #5)
> 3:cpuacct,cpu:/

> 3:cpuacct,cpu:/system/sshd.service

It would be interesting to find out what causes this difference.

Comment 7 Lukáš Nykrýn 2012-06-27 08:13:23 UTC
I have a clone of this old rawhide (but a little bit broken), so I tried to update openssh, systemd and kernel separately to find which one caused this. But it seems that at the end it was none of them:
[root@systemd ~]# uname -a
Linux systemd 3.5.0-0.rc4.git0.1.fc18.x86_64 #1 SMP Mon Jun 25 17:53:50 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@systemd ~]# rpm -qv systemd
systemd-185-7.gite7aee75.fc18.x86_64
[root@systemd ~]# rpm -qv openssh
openssh-5.9p1-23.fc18.x86_64
[root@systemd ~]# rpm -qv kernel
kernel-3.3.7-1.fc17.x86_64
kernel-3.5.0-0.rc1.git0.1.fc18.x86_64
kernel-3.5.0-0.rc4.git0.1.fc18.x86_64
[root@systemd ~]# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/user/root/4

Comment 8 Richard W.M. Jones 2012-07-30 07:31:30 UTC
*** Bug 843925 has been marked as a duplicate of this bug. ***

Comment 9 Richard W.M. Jones 2012-07-30 07:32:16 UTC
Note this gravely affects the ability to do plain 'yum update'.
For details see bug 843925.

Comment 10 Richard W.M. Jones 2012-08-01 12:05:34 UTC
I just had this happen again with the update from
openssh-server-5.9p1-24.fc18.x86_64 to
openssh-server-5.9p1-25.fc18.x86_64

The workaround is to do:

rpm -e --noscripts openssh-server-5.9p1-24.fc18.x86_64
package-cleanup --cleandupes

Comment 11 Lukáš Nykrýn 2012-08-06 11:20:30 UTC
This is probably caused by kernel or at least it is involved.
[root@systemd ~]# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/user/root/2
[root@systemd ~]# uname -a
Linux systemd 3.5.0-0.rc1.git0.1.fc18.x86_64 #1 SMP Sun Jun 3 14:07:54 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

and when I use the same machine only with rc3 kernel:

[root@systemd ~]# cat /proc/$$/cgroup
9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/system/sshd.service
2:cpuset:/
1:name=systemd:/user/root/2
[root@systemd ~]# uname -a
Linux systemd 3.5.0-0.rc3.git0.2.fc18.x86_64 #1 SMP Mon Jun 18 14:17:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Comment 12 Lennart Poettering 2012-09-14 14:13:30 UTC
Is this still an issue? This seems to work on F18 right now. So closing. Feel free to reopen if this continues to be an issue.


Note You need to log in before you can comment on or make changes to this bug.