race condition on shutdown with more than one DM installed

Bug #854329 reported by Steve Langasek
48
This bug affects 9 people
Affects Status Importance Assigned to Milestone
gdm (Ubuntu)
Fix Released
High
Unassigned
Oneiric
Fix Released
High
Unassigned
kde-workspace (Ubuntu)
Fix Released
Low
Unassigned
Oneiric
Fix Released
Low
Unassigned
lightdm (Ubuntu)
Fix Released
High
Unassigned
Oneiric
Fix Released
High
Unassigned
lxdm (Ubuntu)
Fix Released
Low
Unassigned
Oneiric
Fix Released
Low
Unassigned
plymouth (Ubuntu)
Fix Released
High
Unassigned
Oneiric
Fix Released
High
Unassigned
upstart (Ubuntu)
Fix Released
Medium
Unassigned
Oneiric
Fix Released
Medium
Unassigned
uxlaunch (Ubuntu)
Triaged
Low
Unassigned
Oneiric
Won't Fix
Low
Unassigned
xdm (Ubuntu)
Triaged
Low
Unassigned
Oneiric
Won't Fix
Low
Unassigned

Bug Description

the migration from gdm to lightdm has revealed a race condition in /etc/init/plymouth.conf on shutdown. The job currently does:

 start on (... or (runlevel [016] and (stopped gdm or stopped kdm or stopped $otherdm)))

However, if more than one of these dm packages is installed, at least one of these 'stopped $dm' events will be emitted *on system startup* because whichever DM is not the default will have its job started and immediately stopped.

This means the second half of the AND is already satisfied, so as soon as the 'runlevel' event fires, plymouth starts up, racing the shutdown of the actually-running DM. And starting plymouth is bound to be faster than shutting down a running X session, which means plymouth and X are running at the same time and arguing about who controls the VT.

The result is that plymouth starts rendering, then X sets the VT into text mode on shutdown, causing plymouth's progress indicator (5 cycling dots) to be drawn over the text screen.

To fix this, we need the plymouth job to be able to distinguish between the *cause* of the DM job stopping. This probably means emitting a new event from the DM jobs, having plymouth look for this new event, and coordinating the transition with bidirectional Breaks: on the packages.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: plymouth 0.8.2-2ubuntu26
ProcVersionSignature: Ubuntu 3.0.0-9.15-generic 3.0.3
Uname: Linux 3.0.0-9-generic x86_64
ApportVersion: 1.23-0ubuntu1
Architecture: amd64
Date: Mon Sep 19 17:03:00 2011
DefaultPlymouth: /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
MachineType: LENOVO 3249CTO
ProcCmdLine: BOOT_IMAGE=/vmlinuz-3.0.0-9-generic root=/dev/mapper/hostname-root ro quiet splash vt.handoff=7
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.0.0-9-generic root=/dev/mapper/hostname-root ro quiet splash vt.handoff=7
SourcePackage: plymouth
TextPlymouth: /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth
UpgradeStatus: Upgraded to oneiric on 2011-06-27 (84 days ago)
dmi.bios.date: 08/23/2010
dmi.bios.vendor: LENOVO
dmi.bios.version: 6QET52WW (1.22 )
dmi.board.name: 3249CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6QET52WW(1.22):bd08/23/2010:svnLENOVO:pn3249CTO:pvrThinkPadX201:rvnLENOVO:rn3249CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 3249CTO
dmi.product.version: ThinkPad X201
dmi.sys.vendor: LENOVO

Revision history for this message
Steve Langasek (vorlon) wrote :
Changed in plymouth (Ubuntu):
status: New → Triaged
Changed in gdm (Ubuntu Oneiric):
status: New → Triaged
Changed in kde-workspace (Ubuntu Oneiric):
status: New → Triaged
Changed in plymouth (Ubuntu Oneiric):
importance: Undecided → High
Changed in gdm (Ubuntu Oneiric):
importance: Undecided → High
Steve Langasek (vorlon)
Changed in lightdm (Ubuntu Oneiric):
importance: Undecided → High
status: New → Triaged
Changed in kde-workspace (Ubuntu Oneiric):
importance: Undecided → Low
Changed in lxdm (Ubuntu Oneiric):
importance: Undecided → Low
Changed in xdm (Ubuntu Oneiric):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Steve Langasek (vorlon) wrote :

Marking this bug as affecting all the DMs listed in /etc/init/plymouth.conf. The bug is severity: high for plymouth/lightdm/gdm because this is a common upgrade scenario that needs to be addressed; I've marked it severity: low for the others. I'm certainly happy to help coordinate a conversion of any of the others for oneiric as well, however, if the maintainers of those packages are interested.

Changed in uxlaunch (Ubuntu Oneiric):
importance: Undecided → Low
status: New → Triaged
Steve Langasek (vorlon)
Changed in gdm (Ubuntu Oneiric):
milestone: none → ubuntu-11.10
Changed in lightdm (Ubuntu Oneiric):
milestone: none → ubuntu-11.10
Changed in plymouth (Ubuntu Oneiric):
milestone: none → ubuntu-11.10
Revision history for this message
Steve Langasek (vorlon) wrote :

Prospective patch for this issue in gdm/lightdm upstart jobs:

post-stop script
        case $UPSTART_EVENTS in
                *runlevel*)
                        initctl emit desktop-shutdown
                        ;;
        esac
end script

And after more thought, I see we only need a one-way breaks: from plymouth to the old versions of the DM packages, when plymouth drops the check for the 'stopped $dm' events. So anyone who wants to implement this post-stop script in their own package can go ahead and do so, and we can fix up plymouth afterwards.

Revision history for this message
Steve Langasek (vorlon) wrote :

Yeah, don't use that script. $UPSTART_EVENTS is the variable containing the list of events that triggered the *start* of the job; so anything that's 'start on [...] runlevel [...]' will always match and then we have the same race condition all over again.

Here's an alternative that DTRT.
post-stop script
        if [ "$UPSTART_STOP_EVENTS" = runlevel ]; then
                initctl emit desktop-shutdown
        fi
end script

Tested out here with gdm and lightdm installed; the dots-over-text error goes away with this change.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lxdm (Ubuntu):
status: New → Confirmed
Steve Langasek (vorlon)
Changed in gdm (Ubuntu Oneiric):
status: Triaged → Fix Committed
Changed in lightdm (Ubuntu Oneiric):
status: Triaged → Fix Committed
Changed in plymouth (Ubuntu Oneiric):
status: Triaged → Fix Committed
Changed in lxdm (Ubuntu Oneiric):
status: Confirmed → Triaged
bugbot (bugbot)
tags: added: kubuntu
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gdm - 3.0.4-0ubuntu11

---------------
gdm (3.0.4-0ubuntu11) oneiric; urgency=low

  * 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/gdm.upstart,
    killing off the unnecessary parentheses
  * debian/gdm.upstart: when gdm 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.
 -- Steve Langasek <email address hidden> Fri, 23 Sep 2011 14:26:18 -0700

Changed in gdm (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

Uploaded to kde-workspace bzr.

Changed in kde-workspace (Ubuntu Oneiric):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxdm - 0.4.1-0ubuntu2

---------------
lxdm (0.4.1-0ubuntu2) oneiric; urgency=low

  * debian/lxdm.upstart: when lxdm 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.
    Thanks Steve Langasek for the fix. LP: #854329.
 -- Julien Lavergne <email address hidden> Sun, 25 Sep 2011 02:28:53 +0200

Changed in lxdm (Ubuntu Oneiric):
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kde-workspace - 4:4.7.1-0ubuntu3

---------------
kde-workspace (4:4.7.1-0ubuntu3) oneiric; urgency=low

  * Update debian/kdm.upstart to match latest gdm.upstart improvements:
    - Also export LC_MESSAGES with the rest of locale information
    - When kdm 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)
  * Update patches for post-4.7.1 changes. Add to debian/patches:
      0001-SVN_SILENT-made-messages-.desktop-file.patch
      0003-SVN_SILENT-made-messages-.desktop-file.patch
      0004-SVN_SILENT-made-messages-.desktop-file.patch
      0005-SVN_SILENT-made-messages-.desktop-file.patch
      0006-preferred-app-launchers-need-to-use-the-type-of-the-.patch
      0007-SVN_SILENT-made-messages-.desktop-file.patch
      0009-SVN_SILENT-made-messages-.desktop-file.patch
      0010-add-some-missing-connects-for-the-ruleswidget.patch
      0011-fix-yet-another-fun-with-pointers-tabbing-segfault.patch
      0013-catch-changeMaximize-recursion-from-setNoBorder.patch
      0014-Clear-thumbnails-for-deleted-windows.patch
      0015-Fix-pointer-accesses-in-tiling-code.patch
      0016-SVN_SILENT-made-messages-.desktop-file.patch
      0017-SVN_SILENT-made-messages-.desktop-file.patch
      0018-SVN_SILENT-made-messages-.desktop-file.patch
      0019-Test-for-widget-creation-before-deleting-property-at.patch
      0020-SVN_SILENT-made-messages-.desktop-file.patch
      0023-fix-kiosk-restrictions-for-user-switching-and-logout.patch
      0024-Fix-typo-use-the-right-signal-signature.patch
      0025-Repaint-old-area-of-the-thumbnail.patch
      0026-Use-Client-layoutMetric-to-access-shadowSize-instead.patch
      0027-ShowCalendarPopup-false-suppresses-calendar-popup-an.patch
      0028-show-the-keyboard-on-immediately-entering-a-text-are.patch
      0029-Repaint-the-whole-window-in-the-taskbar-thumbnail.patch
      0030-SVN_SILENT-made-messages-.desktop-file.patch
      0031-Fix-wrong-inital-tab-in-keyboard-kcm.patch
 -- Scott Kitterman <email address hidden> Sun, 25 Sep 2011 00:42:41 -0400

Changed in kde-workspace (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 0.9.7-0ubuntu2

---------------
lightdm (0.9.7-0ubuntu2) oneiric; urgency=low

  * 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.
 -- Steve Langasek <email address hidden> Sun, 25 Sep 2011 22:22:38 -0700

Changed in lightdm (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package plymouth - 0.8.2-2ubuntu27

---------------
plymouth (0.8.2-2ubuntu27) oneiric; urgency=low

  * debian/plymouth.upstart: don't start up on 'stopped gdm' or 'stopped
    lightdm' since on upgrade one of these two will always be stopped at
    system boot. Instead look for a 'desktop-shutdown' event, and declare
    appropriate Breaks: against earlier versions of gdm, lightdm, kdm and
    lxdm that don't implement this event. LP: #854329.
 -- Steve Langasek <email address hidden> Sun, 25 Sep 2011 22:58:30 -0700

Changed in plymouth (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

According to James, we need to add this new 'desktop-shutdown' event to upstart-events(7).

Changed in upstart (Ubuntu Oneiric):
importance: Undecided → Medium
status: New → Triaged
Steve Langasek (vorlon)
Changed in upstart (Ubuntu Oneiric):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upstart - 1.3-0ubuntu10

---------------
upstart (1.3-0ubuntu10) oneiric; urgency=low

  [ Clint Byrum ]
  * debian/conf/failsafe.conf: do delay as script, not pre-start, so
    that the messages/delays are stopped on runlevel immediately. emit
    as an event, failsafe-boot, to provide finer grained control.
    (LP: #863864)
  * conf/rc-sysinit.conf: change from 'started failsafe' to 'failsafe-boot'
    to accomodate changes to failsafe.conf.

  [ Steve Langasek ]
  * Document device-not-ready in upstart-events(7). LP: #805510.
  * Document desktop-shutdown in upstart-events(7). LP: #854329.
  * Mention lightdm in the list of example DMs in upstart-events(7), since
    it's now the default...
 -- Steve Langasek <email address hidden> Mon, 03 Oct 2011 18:37:04 -0700

Changed in upstart (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote :

oneiric has seen the end of its life and is no longer receiving any updates. Marking the oneiric task for this ticket as "Won't Fix".

Changed in xdm (Ubuntu Oneiric):
status: Triaged → Won't Fix
Changed in uxlaunch (Ubuntu Oneiric):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.