[arch-general] xdm, who and X sessions

Norbert Zeh nzeh at cs.dal.ca
Tue Oct 11 10:42:02 EDT 2011


Hi folks,

wanting to go lightweight, I just switched back from kdm to xdm, but I ran into
a little snag, which I reported as bug FS#26395 on the bug tracker.  I'm no
longer sure this is actually a bug, at least not of "who".

The problem:  After loggin in via xdm, "who" does not show any logged in users.
"who /var/run/utmp" on the other hand does show the logged in user.  Using kdm,
"who" and "who /var/run/utmp" both reported the same result.

The reason: There's a small difference between running "who" with or without
argument.  When run without argument, "who" checks whether the process
associated with a session in /var/run/utmp is dead or alive.  If it is dead, the
entry is not listed in the output.  Now, when using xdm, sessreg is run from
Xstartup and registers the shell running Xstartup as the PID associated with the
session.  The shell running Xstartup exits and then xdm fires up Xsetup to start
the user's session.  Since the shell running Xstartup has exited, there is no
longer any process with the PID associated with the session in /var/run/utmp.
Hence, who does not report this session.

While this explains the source of the problem, I have no idea how to fix it.  It
seems that what would be needed is to run sessreg as root from a process that
stays alive while the user is actually logged into the X session.  kdm, for
example, does in fact stay alive while the user is logged in.  So does xdm, but
the PID recorded in /var/run/utmp is not the one of xdm but of the shell it
spawns to run Xsetup.

Any suggestions would be greatly appreciated.

Cheers,
Norbert


More information about the arch-general mailing list