Pádraig Brady wrote:
> Sorry I was inaccurate here. There is no seat info in utmp on Fedora 44 at
> least.
>
> $ src/who # no systemd
> padraig tty2 2026-07-07 12:12 (local)
> padraig pts/6 2026-07-14 12:26
>
> $ /bin/who # uses systemd
> padraig seat0 2026-07-07 12:12
> padraig tty2 2026-07-07 12:12
>
> $ src/who -a # no systemd
> system boot 2026-07-07 11:53
> padraig - tty2 2026-07-07 12:12 old 10855 (local)
> pts/5 2026-07-10 10:26 225737 id=ts/5 term=0
> exit=0
> padraig - pts/6 2026-07-14 12:26 old 640542
> pts/15 2026-07-16 12:20 702275 id=s/15 term=0
> exit=0
> pts/12 2026-07-18 12:58 801364 id=s/12 term=0
> exit=0
> pts/18 2026-07-22 20:50 1263794 id=s/18 term=0
> exit=0
> pts/10 2026-07-24 13:41 1493524 id=s/10 term=0
> exit=0
>
> $ /bin/who -a # uses systemd
> system boot 2026-07-07 11:53
> padraig ? seat0 2026-07-07 12:12 ? 10720
> padraig - tty2 2026-07-07 12:12 old 10720
Yeah, that's basically how things look like, in a distro which still has
/var/run/utmp or /var/run/utmpx.
Whereas in Ubuntu 26.04, which no longer has this file:
$ 9.11/bin/who -a # no systemd
system boot 2026-07-04 19:32
$ 9.11-systemd/bin/who -a # uses systemd
system boot 2026-07-04 19:32
bruno ? seat0 2026-07-04 19:32 ? 1764
bruno - tty1 2026-07-04 19:32 old 1764
> >> That probably makes sense. I'm quite surprised with the systemd runtime
> >> overhead:
> >>
> >> $ strace -c /bin/who 2>&1 | grep total
> >> 100.00 0.003110 6 459 15 total
> >>
> >> $ strace -c git/coreutils/src/who 2>&1 | grep total
> >> 100.00 0.000000 0 140 8 total
>
> My main point here is that the systemd variant had over 3x the number of
> syscalls.
Indeed, libsystemd appears to read the per-session files multiple times,
and there are also many redundant fstat() calls:
$ strace 9.11-systemd/bin/who
...
openat(AT_FDCWD, "/run/systemd/sessions/",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=80, ...}) = 0
getdents64(3, 0x2646a7b0 /* 4 entries */, 32768) = 96
getdents64(3, 0x2646a7b0 /* 0 entries */, 32768) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/1", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=417, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 417
read(3, "", 4096) = 0
close(3) = 0
kill(1764, 0) = -1 EPERM (Operation not permitted)
kill(1764, 0) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/run/systemd/sessions/2", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 283
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/2", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 283
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/2", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 283
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/run/systemd/sessions/2", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
read(3, "# This is private data. Do not p"..., 4096) = 283
read(3, "", 4096) = 0
close(3) = 0
...
Bruno