Public bug reported:
`loginctl list-sessions` on 26.04 does not populate the TTY column for
users who connect via SSH e.g.
~/ loginctl list-sessions
SESSION UID USER SEAT LEADER CLASS TTY IDLE SINCE
1 5042 higels - 2957 user - no -
11 5042 higels - 9433 user - no -
12 5042 higels - 10313 user - no -
2 5042 higels - 2962 manager - no -
3 5042 higels - 5352 user - no -
4 5042 higels - 5598 user - no -
7 1000 local - 1890 user ttyS0 yes 39min ago
8 1000 local - 8565 manager - no -
contrasted with 24.04 (which seems to work most of the time?):
SESSION UID USER SEAT TTY STATE IDLE SINCE
13 5042 higels - pts/1 active yes 55min ago
21 5042 higels - pts/3 active no -
22 5042 higels - - active no -
6 5042 higels - pts/2 active no -
strace suggests that systemd-logind on both versions queries
/var/run/utmp to derive the TTY, but utmp seems to be disabled in 26.04.
sshd seems to have set utmp entries itself in earlier releases.
If I enable debug logging for pam_systemd.so in /etc/pam.d/common-
session, I see the following while I log in using ssh:
Sep 25 10:05:15 <hostname> sshd-session[10313]:
pam_systemd(sshd:session): Asking logind to create session: uid=5042
pid=10313 service=sshd type=tty class=user desktop= seat= vtnr=0 tty=
display= remote=yes remote_user= remote_host=<remote ip>
If I login via console, I see:
Sep 25 10:44:48 <hostname>login[15704]: pam_systemd(login:session):
Asking logind to create session: uid=1000 pid=15704 service=login
type=tty class=user desktop= seat= vtnr=0 tty=ttyS0 display= remote=no
remote_user= remote_host=
(note tty= is populated in the latter, but not the former)
We noticed this when unattended-upgrades rebooted a system and the usual
broadcast messages that warn of this happening did not reach users who
were connected via ssh. I see the following in auth-pam.c, so maybe this
is not possible to fix since ssh doesn't have the information needed
when it logs the user in:
#ifdef PAM_TTY_KLUDGE
/*
* Some silly PAM modules (e.g. pam_time) require a TTY to operate.
* sshd doesn't set the tty until too late in the auth process and
* may not even set one (for tty-less connections)
*/
debug("PAM: setting PAM_TTY to \"ssh\"");
sshpam_err = pam_set_item(sshpam_handle, PAM_TTY, "ssh");
if (sshpam_err != PAM_SUCCESS) {
pam_end(sshpam_handle, sshpam_err);
sshpam_handle = NULL;
return (-1);
}
#endif
... so this might not even be trivial to fix, but the loss of the
broadcast messages is an unfortunate side effect.
I did not include my sshd_config, but here's a diff from the packaged
version:
KbdInteractiveAuthentication no
+PasswordAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
-AcceptEnv LANG LC_* COLORTERM NO_COLOR
+AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: openssh-server 1:10.2p1-2ubuntu3.6
ProcVersionSignature: Ubuntu 7.0.0-34.34-generic 7.0.14
Uname: Linux 7.0.0-34-generic x86_64
NonfreeKernelModules: zfs
ApportVersion: 2.34.1-0ubuntu0.1
Architecture: amd64
CasperMD5CheckResult: pass
Date: Fri Sep 25 15:08:06 2026
InstallationDate: Installed on 2025-10-02 (358 days ago)
InstallationMedia: Ubuntu-Server 24.04.2 LTS "Noble Numbat" - Release amd64
(20250216.2)
SourcePackage: openssh
UpgradeStatus: No upgrade log present (probably fresh install)
** Affects: openssh (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug resolute
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2168583
Title:
openssh-server in 26.04 does not report allocated tty at login to pam,
resulting in things like wall not working
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/2168583/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs