Poking Around in Upstart

The hack I added to the lightdm startup script occasionally causes it to hang, which suggests a timing problem. The result leaves the default text-mode login screen active on VT1, after which I can log in and issue sudo lightdm start to produce the usual GUI screen. Using startx doesn’t (seem to) start the display manager, resulting in all manner of weird behavior.

The definitive Upstart info seems to be in the Upstart Intro, Cookbook, and Best Practises document.

The stanza I modified looks like this:

start on ((filesystem
           and runlevel [!06]
           and started dbus
           and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
                or stopped udev-fallback-graphics)
           and mounted MOUNTPOINT=/mnt/bulkdata)
          or runlevel PREVLEVEL=S)

According to the timing diagram in section 10.1.8, the filesystem event should happen after all the remote filesystems have been mounted, which seems like that stanza might produce a race condition. So just waiting for the filesystem event should suffice, but it doesn’t; that’s why I had to add the mounted event.

According to the example in section 11.14, that stanza should probably look like:

start on ((filesystem
           and (runlevel [!06]
           and (started dbus
           and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
                or stopped udev-fallback-graphics))))
          or runlevel PREVLEVEL=S)

The additional parentheses around successive conditions seem to serialize them, so that they need not all occur at the same time.

At least I think that’s how it should work…

Unfortunately, it doesn’t.  The good news is that it’s converted the intermittent failure into a hard fault, which is generally a step in the right direction.

Changing the stanza to:

#start on ((filesystem
start on ((mounted MOUNTPOINT=/mnt/bulkdata
           and runlevel [!06]
           and started dbus
           and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
                or stopped udev-fallback-graphics))
#           and mounted MOUNTPOINT=/mnt/bulkdata))
          or runlevel PREVLEVEL=S)

… also fails hard.

At this point, I have no idea what to do, so I’ve restored the original stanza.

About these ads
  1. #1 by przemek on 7-March-2013 - 15:17

    just wanted to mention that upstart is being upstaged by systemd, at least in Fedora. I don’t know what is Ubuntu’s roadmap but Fedora switched to systemd a couple of releases ago and the general sentiment is that is for the better.

    • #2 by Ed on 7-March-2013 - 15:26

      upstart is being upstaged by systemd

      I’m not in the least surprised to discover that, by the time I (almost) figure how something works, it’s obsolete… [sigh]

      Thanks for the heads-up; now I know where to look the next time things go awry.

  1. Upstart vs. NFS Mounts vs. Display Manager: Resolved! | The Smell of Molten Projects in the Morning