lightdm writes XDISPLAY instead of tty device name to utmp record
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Light Display Manager |
Medium
|
Unassigned | ||
| 1.10 |
Undecided
|
Unassigned | ||
| 1.14 |
Undecided
|
Unassigned | ||
| 1.16 |
Undecided
|
Unassigned | ||
| lightdm (Ubuntu) |
Medium
|
Unassigned | ||
| unity-control-center (Ubuntu) |
High
|
Unassigned |
Bug Description
Until now, I've been using good old gdm-2.20.11 and wanted to switch to lightdm-1.12.1. If you list users logged in via the 'w' or 'who' command, it shows you who is logged in and what they are doing. Especially, on which tty. Example:
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
user tty9 03Oct14 16days 1:52m 0.01s /bin/sh /etc/xdg/
Also, 'who' gives this information:
user tty9 Oct 3 22:34 (:20)
However, lightdm does not follow that tradition. Instead, it prints :0 instead of the actual tty, and something weird for other values (like ?xdm? instead of the idle value etc.)
'w':
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
user :0 19:50 ?xdm? 23.82s 0.01s /bin/sh /etc/xdg/
Note: :0 is not tty, it is DISPLAY env.
'who':
user :0 2014-10-12 19:50 (:0)
The same for this one. I wonder, is this a bug (to me it seems so, because for every other program the correct values are reported)?
It is a problem for me, because I have written scripts for automation etc. that parse w and who output to determine which tty is in use by which DISPLAY.
Related branches
- Robert Ancell: Approve on 2016-09-06
-
Diff: 15 lines (+4/-2)1 file modifiedpanels/user-accounts/um-history-dialog.c (+4/-2)
Harald Judt (hjudt) wrote : | #1 |
summary: |
- lightdm and wrong 'w' and 'who' output + lightdm writes XDISPLAY instead of tty device name to utmp record |
Harald Judt (hjudt) wrote : | #2 |
The patch applies to lightdm-1.15.0.
Lectrode (electrodexsnet) wrote : | #3 |
problem still persists in lightdm 1.16.7
Is there any news on this bug?
Changed in lightdm: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
Changed in lightdm: | |
milestone: | none → 1.17.6 |
Changed in lightdm (Ubuntu): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
The attachment "0001-Fix-
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]
tags: | added: patch |
Launchpad Janitor (janitor) wrote : | #5 |
This bug was fixed in the package lightdm - 1.17.6-0ubuntu1
---------------
lightdm (1.17.6-0ubuntu1) xenial; urgency=medium
* New upstream release:
- Don't write $DISPLAY into tty line in utmp/btmp. (LP: #1380364)
* debian/
* debian/
* debian/rules:
- Don't overwrite .profile file from skeleton session, append it instead
-- Robert Ancell <email address hidden> Tue, 15 Mar 2016 15:47:08 +1300
Changed in lightdm (Ubuntu): | |
status: | Fix Committed → Fix Released |
Changed in lightdm: | |
status: | Fix Committed → Fix Released |
Sebastien Bacher (seb128) wrote : | #6 |
That change made the unity-control-
See https:/
We either need to revert that change or to update u-c-c, note that the issue should be sorted out before an eventual SRU of the lightdm change
Robert Ancell (robert-ancell) wrote : | #7 |
I'm really struggling to find the correct behaviour here. What I know:
- man utmp shows:
char ut_line[
- GDM 2.20 only put the tty into this field
- GDM git does:
/*
* Set ut_line to the device name associated with this display
* but remove the "/dev/" prefix. If no device, then use the
* $DISPLAY value.
*/
if (display_device != NULL
&& g_str_has_prefix (display_device, "/dev/")) {
} else if (x11_display_name != NULL) {
}
- 'w' (the version in procps anyway) does:
if (*u->ut_line == ':')
- xdm (1.1.11) doesn't set ut_line at all.
- AccountsService only stores ut_line and ut_tv (the timestamp) as a login record.
- gnome-control-
So while this clearly wasn't intended when utmp/wtmp was designed it seems everyone is using ut_line with ttyN for text logins and :n for X logins. That suggests we should revert the patch in LightDM.
I haven't been able to get GDM to work on my machine, can someone confirm the output of w in a modern GDM?
Martin Pitt (pitti) wrote : | #8 |
I cannot get gdm to work in a VM either; it starts, but I just see a black screen.
I tried under LXDM in Debian sid, but that doesn't seem to register any session at all ("w" is empty except for the table header).
I also tried gdm3 on sid with the default (Cirrus), -vga virtio, and -vga vmware, and in none of these cases it starts. Maybe it needs some configuration after apt-get install gdm. So perhaps someone could try this under Ubuntu GNOME?
Jeremy Bicha (jbicha) wrote : | #9 |
Ubuntu GNOME 16.10 with GNOME 3.20 (from the xenial GNOME3 Staging PPA)
$ w
09:47:04 up 1 day, 6:26, 3 users, load average: 0.27, 0.39, 0.49
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
jeremy tty2 :0 Sun03 30:26m 4:19m 1.33s /usr/lib/
jeremy pts/6 tmux(27978).%1 Sun21 3:20 16.63s 16.57s weechat
jeremy pts/8 tmux(27978).%2 01:39 7:59m 0.18s 0.18s /bin/bash
Robert Ancell (robert-ancell) wrote : | #10 |
Thanks Martin, Jeremy.
The GDM log suggests the currently LightDM behaviour is the same. In that case we should revert the u-c-c change (and lose the ability to hide non graphical logins). We could filter out non-graphical logins by checking if the tty is less than 7 (yes, it's a total hack) or look at making AccountsService change the value it provides for X cases (probably the better option).
Changed in unity-control-center (Ubuntu): | |
importance: | Undecided → High |
status: | New → In Progress |
Jeremy Bicha (jbicha) wrote : | #11 |
> We could filter out non-graphical logins by checking if the tty is less than 7
gdm3 in Ubuntu GNOME 16.10 (and backported to 16.04 via the Staging PPA because why not?) starts on vt1 and the first login is vt2, etc. That change was made in Debian's gdm3 packaging.
Launchpad Janitor (janitor) wrote : | #12 |
This bug was fixed in the package unity-control-
---------------
unity-control-
[ Robert Ancell ]
* Don't check if we're running under Unity - we only support Unity
(LP: #1554878, #1629668)
* Ubuntu only supports usernames with lowercase letters. (LP:
#1600638)
[ Sebastien Bacher ]
* Revert the change from r12750 to include only graphical sessions.
(LP: #1380364)
[ <email address hidden> ]
* Removed "when battery is critical" functionality from the power
panel as this is now handled by Upower and these settings now do
nothing. Fixes LP: #1599264 (LP: #1599264)
-- <email address hidden> (<email address hidden>) Mon, 03 Oct 2016 11:19:09 +0000
Changed in unity-control-center (Ubuntu): | |
status: | In Progress → Fix Released |
This is a bug in lightdm which should be fixed. tty line and idle time are not shown correctly. XDISPLAY should not be written to ut_line.