-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
systemd version the issue has been seen with
252, 250
Used distribution
openSUSE Tumbleweed, Fedora 36
Linux kernel version used
6.1.12-1-default
CPU architectures issue was seen on
x86_64
Component
systemd-logind
Expected behaviour you didn't see
sd_session_get_tty (sessionid, &tty)
should return the TTY for a session like loginctl show-session <sessionid>
does for the same session id.
Unexpected behaviour you saw
If you login on console, sd_session_get_tty (sessionid, &tty)
returns the TTY (tty1 in this case).
If you login to the system via ssh (so TTY is pts/0), sd_session_get_tty (sessionid, &tty)
returns an error, since /run/systemd/sessions/ does not contain the TTY entry.
But loginctl show-sesssion <sessionid>
contains TTY=pts/0
in the output.
loginctl
and sd_session_get_tty (sessionid, &tty)
should always return the same device.
Steps to reproduce the problem
See above, once login on a console (tty = /dev/tty1), run loginctl show-session and write a short tool which calls sd_session_get_tty (sessionid, &tty)
. Both will return tty1.
Now login via ssh (tty = /dev/pts/0), run loginctl show-session and call the tool for this session again, loginctl will show the TTY=pts/0, but sd_session_get_tty (sessionid, &tty)
will fail.
Additional program output to the terminal or log subsystem illustrating the issue
sd_session_get_tty(22) failed: No data available
But:
loginctl show-session 22 |grep TTY
TTY=pts/0