Subject: bug#900: procps: w does not query elogind for sessions

From: Andrew Bower <[email-masked]>
Date: Sun, 27 Jul 2025 23:47:26 +0100

Package: procps
Version: 2:4.0.4-8devuan1
Severity: grave

Dear Maintainer,

Running 'w' returns only sessions that are lucky enough still to be recorded in
utmp, and not any sessions that only elogind knows about.

Unfortunately with so many components removing utmp support (prematurely, in my
opinion), this makes the tool next to useless in Excalibur. This includes
virtual console logins recorded by 'login'.

I have reported a related issue against Debian at
https://bugs.debian.org/1108549 which relates to elogind not being queried if
sd_booted() returns false, despite sd_get_sessions() being capable of returning
the results needed (coreutils 'who' does this) but have seen no interest in the
bug since I raised it a month ago.

Things may be different in the Devuan fork because I see it is not linked with
libsystemd - which means it would _never_ report such sessions successfully.

Thanks!

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 6 (excalibur/ceres)
Release:	6
Codename:	excalibur ceres
Architecture: x86_64

Kernel: Linux 6.12.37+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages procps depends on:
ii  init-system-helpers  1.68devuan1
ii  libc6                2.41-9
ii  libncursesw6         6.5+20250216-2
ii  libproc2-0           2:4.0.4-8devuan1
ii  libtinfo6            6.5+20250216-2

Versions of packages procps recommends:
ii  linux-sysctl-defaults  4.12
ii  psmisc                 23.7-2

procps suggests no packages.

-- no debconf information

---

From: Mark Hindley <[email-masked]>
Date: Mon, 28 Jul 2025 11:42:19 +0100

Andrew,

Thanks for this. You have been folowwing this area more closely than me. 

I believe the original impetus to remove libsystemd linkage from procps 
was to reduce libsystemd infiltration into 'core' utilities. 

Devuan systems without elogind are viable (I use sway/seatd as my daily 
driver) so just adding elogind support to procps isn't a universal 
solution.

Do you have a suggestion or idea as to a way forward?

Mark

---

From: Andrew Bower <[email-masked]>
Date: Mon, 28 Jul 2025 21:06:10 +0100

Hi Mark,

> Thanks for this. You have been folowwing this area more closely than me. 

Unfortunately I haven't been on top of the utmp or lastlog side of this
transition even though I did adopt wtmpdb with a view to mitigating user
experiences with that change.

> was to reduce libsystemd infiltration into 'core' utilities. 

I am all in favour of that ambition. I don't think the key
building-block packages should depend on libsystemd, hence my
disappointment when coreutils recently gained the dependency (should we
be forking that?)

> driver) so just adding elogind support to procps isn't a universal 

Does sway/seatd write to utmp? Does it do anything else?

> Do you have a suggestion or idea as to a way forward?

I see we have forked util-linux, so one thing we could do is to fix the
build of login(1) to restore writing to utmp, for virtual console
logins. That assumes that this is what has actually been broken - I
haven't checked yet.

I think that still leaves session manager entries missing (I seem to get
one for Debian/lightdm but not Devuan/slim). openssh seems to behave
well with regard to utmp.

If we are going to make continued use of utmp we should really try to
sort out any packages that don't realise struct utmp now has unsigned
seconds (converts the y1901/y2038 problem into a y1969/y2160 problem),
but that's not immediately practical. (IMO that would have been a better
use of Debian development time than excising "legacy" usage, which could
have waited another release cycle while the replacements proved and
improved themselves...)

Now, is there anything we can do with elogind-captured sessions without
linking with libsystemd0? Well, maybe... I'm thinking about options! But
to be honest, probably not in time for Excalibur.

Andrew

---

From: Mark Hindley <[email-masked]>
Date: Tue, 29 Jul 2025 11:10:45 +0100

Andrew,

> disappointment when coreutils recently gained the dependency (should we

Hmmm, yes, conceivably.

> Does sway/seatd write to utmp? Does it do anything else?

I think not: I run it from the console, so it relies on login(1).

> logins. That assumes that this is what has actually been broken - I

That seems sane. I'll see if I can find the commit.

Thanks

Mark

---

From: Andrew Bower <[email-masked]>
Date: Tue, 29 Jul 2025 21:26:52 +0100

> I think not: I run it from the console, so it relies on login(1).

I take it from this that you currently don't get any login entries,
then?

> That seems sane. I'll see if I can find the commit.

Looking at the following, utmp writing had already been turned off in
src:shadow before util-linux took the command over.

https://salsa.debian.org/debian/util-linux/-/commit/0fa51ed784e19e58f8e04e43aabc3f324d4135f7#4c5d3c697d7b8f925a7d3b18f168f4c51cbdb43f

I haven't found the point in the old package where it was turned off,
unless it was implicit with the --enable-logind flag:

https://salsa.debian.org/debian/shadow/-/commit/1526e6cde87c48e0691c9e8cd2ca9755adcfd4b6

I haven't investigated very thoroughly.

---

From: Mark Hindley <[email-masked]>
Date: Thu, 31 Jul 2025 17:27:57 +0100

> I take it from this that you currently don't get any login entries,

I haven't upgraded to excalibur yet.

I have just updated procps in ceres to 2%4.0.4-9devuan1 which includes your fix
for Debian#1108549.

Once that is in the mirrors, perhaps you can see what does and doesn't work?

Thanks

Mark

---

From: Andrew Bower <[email-masked]>
Date: Thu, 31 Jul 2025 23:38:20 +0100

> I have just updated procps in ceres to 2%4.0.4-9devuan1 which includes your fix

Thanks for merging that!

> Once that is in the mirrors, perhaps you can see what does and doesn't work?

Unfortunately it doesn't make any difference on Devuan because the fixes
are in bits that are compiled out without libsystemd!

I think the locus of the work for Devuan (if we want to avoid libsystemd
in core tools, which is reasonable but has consequences) is that we need
to restore utmp-writing in other packages. That won't be fun or
comprehensive.

But it feels like we have lost some basic functionality expected by
Linux users the way things are.

Sorry I don't have a testbed or capacity to check a seatd environment
right now!

---

From: Andrew Bower <[email-masked]>
Date: Sun, 3 Aug 2025 19:27:13 +0100

> Linux users the way things are.

Assuming we don't have time to do anything about this, I wonder if it's
a candidate for release notes or known issues? Is there a WIP set of
release notes for Excalibur?

(P.S. Sorry about the red herring on insserv earlier on the Debian BTS!)

---

From: Andrew Bower <[email-masked]>
Date: Fri, 8 Aug 2025 22:56:34 +0100

Hi Mark,

> to restore utmp-writing in other packages. That won't be fun or

Here is a patch that restores utmp writing to uses of login(1), which
fixes the reporting of virtual console sessions in 'w' on Devuan.

https://git.devuan.org/abower/util-linux/pulls/1

ajb85@arden:~/git/util-linux$ w
 22:50:08 up  1:09,  2 users,  load average: 0.36, 0.85, 1.19
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
ajb85    tty2     -                22:45    4:46   0.06s  0.06s -bash
ajb85@arden:~/git/util-linux$ finger
Login     Name           Tty      Idle  Login Time   Office     Office Phone
ajb85     Andrew Bower  *:0.0           Aug  8 21:40 (:0.0)
ajb85     Andrew Bower  *tty2        4  Aug  8 22:45

Andrew

---

From: Andrew Bower <[email-masked]>
Date: Fri, 8 Aug 2025 23:06:30 +0100

Hi Mark,

> https://git.devuan.org/abower/util-linux/pulls/1

Sorry, I'm not familiar with gitea and ended up raising the PR on my
own fork! Here's a proper one:

https://git.devuan.org/devuan/util-linux/pulls/1

I am not cognisant of the workflow for contributing to Devuan packages
so let me know if there's anything else I can do to help!

Thanks,

Andrew

---

From: Mark Hindley <[email-masked]>
Date: Sat, 9 Aug 2025 16:44:19 +0100

Thanks

Isn't

-	log_utmp(&cxt);
+	log_utmp(&cxt);

no-op?

Do we need to restore the lastlog and btmp entries as well?

Perhaps we just drop the whole patch?

Mark

---

From: Andrew Bower <[email-masked]>
Date: Sat, 9 Aug 2025 20:46:28 +0100

Hi Mark,

> > https://git.devuan.org/devuan/util-linux/pulls/1

Yes! My patch is a crude edit of Chris's patch to neutralise this
removal but it is valid and works.

I think in retrospect that it might be clearer to have another quilt
patch layered on top of his patch.

> Perhaps we just drop the whole patch?

Lastlog was already written by pam_lastlog.so before trixie and the
replacement is pam_lastlog2. The tooling to read btmp was removed by
util-linux.

So I'm not sure there would be any benefit from reversing the rest of
the patch to be worth the increased delta from Debian. Bear in mind that
the patch wasn't just about dropping utmp, it was also about taking over
login from another source package.

An alternative approach I considered was to include code to read the
systemd-style login records directly in 'w' but that seemed like too
much for a patch and it would certainly take more time!

Andrew

---

From: Andrew Bower <[email-masked]>
Date: Sat, 9 Aug 2025 22:22:32 +0100

> patch layered on top of his patch.

I've reworked https://git.devuan.org/devuan/util-linux/pulls/1 to create
a patch that explicitly restores the utmp writing rather than editing a
debian patch. I think this is clearer now what has happened, if you read
the series:

debian/login-turn-off-btmp-utmp-lastlog-writing.patch
..
devuan/restore-utmp-writing.patch

---

From: "Devuan bug Tracking System" <[email-masked]>
Date: Sun, 10 Aug 2025 10:18:09 +0000

This is an automatic notification regarding your bug report
which was filed against the procps package:

#900: procps: w does not query elogind for sessions

It has been closed by [email-masked].

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact [email-masked] by
replying to this email.

-- 
900: https://bugs.devuan.org/cgi/bugreport.cgi?bug=900
Devuan Bug Tracking System
Contact [email-masked] with problems

Subject: #900: fixed in src:util-linux version 2.41-5devuan2
From: [email-masked]
To: [email-masked]
Date: Sun, 10 Aug 2025 10:15:04 +0000

Version: 2.41-5devuan2

Source package util-linux (2.41-5devuan2) added to Devuan suite unstable.

This closes bug report 900.

Thanks

DAK managing the Devuan archive

Format: 1.8
Date: Sun, 10 Aug 2025 09:55:59 +0100
Source: util-linux
Architecture: source
Version: 2.41-5devuan2
Distribution: unstable
Urgency: medium
Maintainer: Devuan Developers <[email-masked]>
Changed-By: Mark Hindley <[email-masked]>
Closes: 900
Changes:
 util-linux (2.41-5devuan2) unstable; urgency=medium
 .
   [ Andrew Bower ]
   * Patch to restore login writing to utmp. (Closes: #900)
Checksums-Sha1:
 3da89a847b257bd03e34c6cd79ad138c7895000c 4661 util-linux_2.41-5devuan2.dsc
 ae3ed10120cd2bbda606ac74c7024ae32aa7c6dd 129908 util-linux_2.41-5devuan2.debian.tar.xz
 a985d2eaf3f3470afa694580d4379ab2bf531574 5620 util-linux_2.41-5devuan2_source.buildinfo
Checksums-Sha256:
 fe854366ba440ae19b02c93e3673262f827510cebf53f3dcb87c5830d7201b1d 4661 util-linux_2.41-5devuan2.dsc
 71b5c0c74cb45705a61c6245a3ce29c7350324dfe27f7dc226f85b1ad7654f54 129908 util-linux_2.41-5devuan2.debian.tar.xz
 c0a6552bffa3bedf97741a81e83f175513f2e0b0ec20b8ced3bb21b1253d5569 5620 util-linux_2.41-5devuan2_source.buildinfo
Files:
 3baf52e7c0cf7421342dd4cff943d32f 4661 utils required util-linux_2.41-5devuan2.dsc
 69418f1a917d62f12d3bfbcb1e20b0ee 129908 utils required util-linux_2.41-5devuan2.debian.tar.xz
 5f37ca9e997ac3e5afd14a99a6aabf6d 5620 utils required util-linux_2.41-5devuan2_source.buildinfo

Subject: procps: w does not query elogind for sessions
From: Andrew Bower <[email-masked]>
To: Devuan Bug Tracking System <[email-masked]>
Date: Sun, 27 Jul 2025 23:47:26 +0100

Package: procps

Dear Maintainer,

Thanks!

-- System Information:
Distributor ID:	Devuan