--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: systemd-shim: logind does not create a session, because systemd-shim does not create /init.scope like systemd does
- From: Tobias Hoffmann <deb-bug@thax.hardliners.org>
- Date: Thu, 22 Mar 2018 20:15:11 +0100
- Message-id: <20180322191511.7624.74941.reportbug@worker>
Package: systemd-shim
Version: 10-3
Severity: important
Preface:
Some software begins to depends on an existing logind-session.
These sessions are created + tracked via libpam-systemd, which makes
an dbus call to systemd-logind.
systemd-shim it here to support logind, which replaces consolekit
(AFAIUI) on systems where systemd is not the init process (i.e. pid 1).
Problem:
In auth.log:
login[6880]: pam_systemd(login:session): Failed to create session: No such device or address
The message belongs to -ENXIO, which is emitted here:
https://github.com/systemd/systemd/blob/master/src/basic/cgroup-util.c#L1458
Result:
$ loginctl
SESSION UID USER SEAT TTY
0 sessions listed.
Expected result:
$ loginctl
[... some sessions ...]
Root cause:
$ systemd-cgls
Control group /:
-.slice
├─ 1 init [2]
├─1630 /lib/systemd/systemd-udevd --daemon
├─3661 /sbin/rpcbind -w
[...]
$ cat /proc/1/cgroup # or some other pid
4:name=systemd:/
[...]
But since systemd 226 (AFAICT), all pids are moved (by systemd as init)
into the /init.scope cgroup.
In the systemd-shim case, systemd-logind still expects pid 1 and the pid
of the login process to be in a such named cgroup - but fails, because
everything is in the root slice (-.slice) and "nothing comes after the /".
Evidence:
$ mkdir /sys/fs/cgroup/systemd/init.scope
$ echo 1 > /sys/fs/cgroup/systemd/init.scope/tasks
# ... move login process (kdm/mingetty/...) there, too ...
# e.g. by respawning mingetty on a particular tty, e.g. tty4
$ systemd-cgls # or: cat /proc/$PID/cgroup
[... those two processes are indeed now in the new cgroup ...]
Now login on that tty4, so that the login process is
(resp. will be spawned in) the /init.scope cgroup.
$ loginctl
[...]
1 sessions listed.
Required action:
systemd-shim has to adjust the cgroups (using cgmanager?) accordingly
for systemd-logind (and thus pam-logind) to succeed.
Thank you.
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (x86_64)
Kernel: Linux 4.16.0-rc6 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages systemd-shim depends on:
ii cgmanager 0.41-2
ii libc6 2.27-2
ii libglib2.0-0 2.53.4-3
systemd-shim recommends no packages.
Versions of packages systemd-shim suggests:
ii pm-utils 1.4.1-9
-- no debconf information
--- End Message ---