[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#949830: autologin does not work if X server succeeds on the second attempt



Package: lightdm
Version: 1.26.0-4

* lightdm.conf

-#autologin-user=
+autologin-user=debianuser


* Expected behavior

Autologin works.


* Observed behavior

In maybe 5% of the cases, autologin does not work and the login screen is shown.


* Analysis

(The analysis is based on /var/log/lightdm/lightdm.log, which is attached.)

On my system, lightdm is run even if /dev/dri/card0 is not available
yet. Of course, the X server cannot be launched successfully in this
situation. By itself, this is not a problem: if lightdm fails, it is
simply retried after some time.

The problem is that lightdm tries to launch the X server twice: if
that fails the first time and succeeds the second time (because
/dev/dri/card0 has become available in the meantime), then autologin
fails.

Excerpt from lightdm.log:

[+0.02s] DEBUG: Launching process 515: /usr/bin/X :0 -seat seat0 -auth
/var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
...
[+0.04s] DEBUG: Process 515 exited with return value 1
...
[+0.04s] DEBUG: Launching process 516: /usr/bin/X :0 -seat seat0 -auth
/var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
...
[+1.11s] DEBUG: Got signal 10 from process 516

Hypothesized code flow (lightdm-debian-1.26.0-4/src/seat.c):

static gboolean
seat_real_start (Seat *seat)
{
[...]
    if (autologin_timeout == 0 || autologin_in_background)
    {
[...]
        if (session)
        {
[...]
            DisplayServer *display_server = create_display_server
(seat, session);
[enter function]

static DisplayServer *
create_display_server (Seat *seat, Session *session)
{
[...]
    if (!g_list_find (seat->priv->display_servers, display_server))
    {
        [...]
        g_signal_connect (display_server,
DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (display_server_stopped_cb),
seat);
[later, the X server fails, and the callback is invoked]

static void
display_server_stopped_cb (DisplayServer *display_server, Seat *seat)
{
[...]
    if (!seat->priv->stopping)
    {
[...]
        if (!active_session || session_get_display_server
(active_session) == display_server)
        {
            l_debug (seat, "Active display server stopped, starting greeter");
            if (!seat_switch_to_greeter (seat))
[enter function]

gboolean
seat_switch_to_greeter (Seat *seat)
{
[...]
    greeter_session = create_greeter_session (seat);
[a new session is created -- without autologin]
[...]
    DisplayServer *display_server = create_display_server (seat,
SESSION (greeter_session));
[the X server is launched the second time, which succeeds]


* Workaround

I have a systemd service that prevents lightdm from running as long as
/dev/dri/card0 is not available.


Cheers,

Christoph


PS: This might be related to Debian bug #876029.
[+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log
[+0.00s] DEBUG: Starting Light Display Manager 1.26.0, UID=0 PID=510
[+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/01_debian.conf
[+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /etc/lightdm/lightdm.conf
[+0.00s] DEBUG: Registered seat module local
[+0.00s] DEBUG: Registered seat module xremote
[+0.00s] DEBUG: Registered seat module unity
[+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager
[+0.02s] DEBUG: Monitoring logind for seats
[+0.02s] DEBUG: New seat added from logind: seat0
[+0.02s] DEBUG: Seat seat0: Loading properties from config section Seat:*
[+0.02s] DEBUG: Seat seat0: Starting
[+0.02s] DEBUG: Seat seat0: Creating user session
[+0.02s] WARNING: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files
[+0.02s] DEBUG: Loading user config from /etc/lightdm/users.conf
[+0.02s] DEBUG: User debianuser added
[+0.02s] DEBUG: Seat seat0: Creating display server of type x
[+0.02s] DEBUG: posix_spawn avoided (fd close requested) 
[+0.02s] DEBUG: Could not run plymouth --ping: Failed to execute child process “plymouth” (No such file or directory)
[+0.02s] DEBUG: Using VT 7
[+0.02s] DEBUG: Seat seat0: Starting local X display on VT 7
[+0.02s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
[+0.02s] DEBUG: XServer 0: Writing X server authority to /var/run/lightdm/root/:0
[+0.02s] DEBUG: XServer 0: Launching X Server
[+0.02s] DEBUG: Launching process 515: /usr/bin/X :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+0.02s] DEBUG: XServer 0: Waiting for ready signal from X server :0
[+0.02s] DEBUG: Acquired bus name org.freedesktop.DisplayManager
[+0.02s] DEBUG: Registering seat with bus path /org/freedesktop/DisplayManager/Seat0
[+0.04s] DEBUG: Process 515 exited with return value 1
[+0.04s] DEBUG: XServer 0: X server stopped
[+0.04s] DEBUG: Releasing VT 7
[+0.04s] DEBUG: XServer 0: Removing X server authority /var/run/lightdm/root/:0
[+0.04s] DEBUG: Seat seat0: Display server stopped
[+0.04s] DEBUG: Seat seat0: Stopping session
[+0.04s] DEBUG: Seat seat0: Session stopped
[+0.04s] DEBUG: Seat seat0: Stopping display server, no sessions require it
[+0.04s] DEBUG: Seat seat0: Active display server stopped, starting greeter
[+0.04s] DEBUG: Seat seat0: Creating greeter session
[+0.04s] DEBUG: Seat seat0: Creating display server of type x
[+0.04s] DEBUG: Using VT 7
[+0.04s] DEBUG: Seat seat0: Starting local X display on VT 7
[+0.04s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
[+0.04s] DEBUG: XServer 0: Writing X server authority to /var/run/lightdm/root/:0
[+0.04s] DEBUG: XServer 0: Launching X Server
[+0.04s] DEBUG: Launching process 516: /usr/bin/X :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+0.04s] DEBUG: XServer 0: Waiting for ready signal from X server :0
[+1.11s] DEBUG: Got signal 10 from process 516
[+1.11s] DEBUG: XServer 0: Got signal from X server :0
[+1.11s] DEBUG: XServer 0: Connecting to XServer :0
[+1.44s] DEBUG: posix_spawn avoided (fd close requested) (child_setup specified) 
[+1.44s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+1.44s] DEBUG: Session pid=565: Started with service 'lightdm-greeter', username 'lightdm'
[+1.47s] DEBUG: Session pid=565: Authentication complete with return value 0: Success
[+1.47s] DEBUG: Seat seat0: Session authenticated, running command
[+1.47s] DEBUG: Session pid=565: Running command /usr/sbin/lightdm-gtk-greeter
[+1.47s] DEBUG: Creating shared data directory /var/lib/lightdm/data/lightdm
[+1.47s] DEBUG: Session pid=565: Logging to /var/log/lightdm/seat0-greeter.log
[+1.62s] DEBUG: Activating VT 7
[+1.62s] DEBUG: Activating login1 session c1
[+1.62s] DEBUG: Seat seat0 changes active session to c1
[+1.62s] DEBUG: Session c1 is already active
[+1.88s] DEBUG: Greeter connected version=1.26.0 api=1 resettable=false
[+2.10s] DEBUG: Greeter start authentication
[+2.10s] DEBUG: Session pid=595: Started with service 'lightdm', username '(null)'
[+2.11s] DEBUG: Session pid=595: Got 1 message(s) from PAM
[+2.11s] DEBUG: Prompt greeter with 1 message(s)
[+7.49s] DEBUG: Seat seat0 changes active session to 
[+11.49s] DEBUG: Seat seat0 changes active session to 2

Reply to: