display number selection algorithm does not work properly when several xlocal or vnc sessions start at once

Bug #851362 reported by Mikhail Kshevetskiy on 2011-09-15
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Light Display Manager
lightdm (Ubuntu)

Bug Description

when we start in multi-seat configuration


xserver-command=/usr/bin/X -novtswitch -sharevts

lightdm start two X-server with the same display, e.g.

[+0.00s] DEBUG: Loading seat Seat:0
[+0.00s] DEBUG: Starting seat
[+0.00s] DEBUG: Starting new display for greeter
[+0.00s] DEBUG: Starting local X display
[+0.01s] DEBUG: Could not run plymouth --ping: Failed to execute child process "plymouth" (No such file or directory)
[+0.01s] DEBUG: Using VT 7
[+0.01s] DEBUG: Activating VT 7
[+0.01s] DEBUG: Logging to /var/log/lightdm/:0.log
[+0.01s] DEBUG: Writing X server authority to /var/run/lightdm/root/:0
[+0.01s] DEBUG: Launching X Server
[+0.02s] DEBUG: Launching process 7327: /usr/bin/X :0 -config /etc/X11/xorg.conf -layout Seat-0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+0.02s] DEBUG: Waiting for ready signal from X server :0
[+0.02s] DEBUG: Loading seat Seat:1
[+0.02s] DEBUG: Starting seat
[+0.02s] DEBUG: Starting new display for greeter
[+0.02s] DEBUG: Starting local X display
[+0.02s] DEBUG: Using VT 8
[+0.02s] DEBUG: Activating VT 8
[+0.04s] DEBUG: Logging to /var/log/lightdm/:0.log
[+0.04s] DEBUG: Writing X server authority to /var/run/lightdm/root/:0
[+0.04s] DEBUG: Launching X Server
[+0.04s] DEBUG: Launching process 7332: /usr/bin/X -novtswitch -sharevts :0 -config /etc/X11/xorg.conf -layout Seat-1 -auth /var/run/lightdm/root/:1 -nolisten tcp vt8 -novtswitch
[+0.04s] DEBUG: Waiting for ready signal from X server :0

the source of the problem is a new implementation of get_free_display_number() in "xserver-local.c" and "xserver-xvnc.c".
We start both X-servers almost simultaneously, so the fist one (Seat-0) does not have enough time to create "/tmp/.X0-lock" file. Thus "lightdm" decide that display ":0" is free and use them for the second X-server.

There are several way to resolve a problem
1) start second seat after the first one started
2) make display number configurable for each seat, so the user can tweak it (solve the problem partially)
3) move old display selection scheme to global scope and use it from both xlocal and vnc seats

Mikhail Kshevetskiy (laska) wrote :

I fix a problem by a way (2) "make display number configurable for each seat" and unfortunately i forget to store original "lightdm.log"..., so i use a fixed "lightdm.log" and replace ":1" with ":0".
Some places were omitted, please treat all mentions of ":1" in the "lightdm.log" from post above as ":0"

Felix (signor-rossi) wrote :

How did you "make display number configurable for each seat"?
does not work.

Mikhail Kshevetskiy (laska) wrote :

I patch lightdm sources. This is actually a workaround and NOT a proper solution.
Apply the attached patch and put in your lightdm.conf something similar to


xserver-command=/usr/bin/X1 -novtswitch -sharevts

PS: i patch only xlocal seat configuration. if you need a VNC, you'll need similar patch for seat-xvnc.c, xserver-xvnc.c and xserver-xvnc.h files.

Robert Ancell (robert-ancell) wrote :

Fixed in 0.9.8

Changed in lightdm:
status: New → Triaged
importance: Undecided → High
status: Triaged → Fix Committed
Changed in lightdm (Ubuntu):
status: New → Fix Committed
importance: Undecided → High

The attachment "patch to make display number configurable (bug workaround)" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in lightdm:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 1.0.0-0ubuntu1

lightdm (1.0.0-0ubuntu1) oneiric; urgency=low

  [ Steve Langasek ]
  * don't start on graphics-device-added; reintroducing this reverted the fix
    for bug #615549 from maverick without explanation.
  * clean up the completely illegible start rule for debian/lightdm.upstart,
    killing off the unnecessary parentheses
  * debian/lightdm.upstart: when lightdm is shut down by a runlevel call,
    emit an upstart event that can be caught by plymouth so it can
    distinguish between the DM shutting down for a runlevel change vs. other
    causes. LP: #854329.

  [ Robert Ancell ]
  * New upstream release.
    [ 0.9.8 ]
    - GetSeatForCookie and GetSessionForCookie are now deprecated. They
      remain for now but use the XDG_SEAT_PATH and XDG_SESSION_PATH
      environment variables instead.
    - Change log filenames to be unique across different display types.
    - Fix up script hooks, add regression tests for them
    - Complete removal of X code from the core of LightDM, so it can better
      support various display types
    - Add ability to set the language of a user from the greeter (LP: #803858)
    - Set LANG variable based on the user language
    - Add language selector into GTK greeter (disabled by default)
    - Allow TCP/IP connections if xserver-allow-tcp is true
    - Allow lightdm --version to be run as non-root
    - Automatically respond to PAM messages without prompts (LP: #783598)
    - Create 'AddLocalXSeat' D-Bus method, and require root to use 'AddSeat'
    - Fix multi-seat configuration picking the same display number (LP: #851362)
    - Use correct D-Bus and power interface in liblightdm-qt (LP: #852803)
    - Run pam_setcred inside the session process so pam_group works
      (LP: #851347)
    - Make sure one session is always selected in the GTK greeter (LP: #819177)
    [ 1.0.0 ]
    - Explicitly grab keyboard focus in GTK greeter
    - Fix removed power and a11y menu items in GTK greeter
    - Put system binary directory into path when running in test mode
      (LP: #860003)
    - Call pam_getenvlist after pam_setcred

  [ Lionel Le Folgoc ]
  * Make the gtk greeter easily themable by derivatives: (LP: #845549)
    - rename lightdm-gtk-greeter.conf to lightdm-gtk-greeter-ubuntu.conf,
      and handle the move in maintainer scripts.
    - manage /etc/lightdm/lightdm-gtk-greeter.conf with update-alternatives,
      by default it uses /etc/lightdm/lightdm-gtk-greeter-ubuntu.conf with a
      very low priority.
  * debian/control: lightdm-gtk-greeter provides lightdm-gtk-greeter-config.
 -- Robert Ancell <email address hidden> Wed, 28 Sep 2011 16:00:20 +1000

Changed in lightdm (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers