Bug 835534 - sshd restart closes all sessions
sshd restart closes all sessions
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
rawhide
Unspecified Unspecified
urgent Severity urgent
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
: 843925 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-26 08:17 EDT by Petr Lautrbach
Modified: 2012-09-14 10:13 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-14 10:13:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Petr Lautrbach 2012-06-26 08:17:30 EDT
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 08:22:15 EDT
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 08:49:08 EDT
It might be same. I use default .service file for sshd service without any change.
Comment 3 Petr Lautrbach 2012-06-26 08:57:37 EDT
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 09:11:58 EDT
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 10:27:32 EDT
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 10:38:41 EDT
(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 04:13:23 EDT
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 03:31:30 EDT
*** Bug 843925 has been marked as a duplicate of this bug. ***
Comment 9 Richard W.M. Jones 2012-07-30 03:32:16 EDT
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 08:05:34 EDT
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 07:20:30 EDT
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 10:13:30 EDT
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.