/lib/init/upstart-job does not handle lucid->precise upgrade scenario

Bug #985755 reported by James Hunt on 2012-04-19
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
High
James Hunt
Precise
High
James Hunt
Quantal
Undecided
Unassigned

Bug Description

[Impact]
If an upgrade from lucid to precise pulls in a new upstart job that should be started on package install, the job will silently fail to be started. If other packages expect the job to be running, this may cause cascading installation failures.

[Development Fix]
Package will be copied to quantal when the archive opens.

[Test Case]
1. Install Ubuntu 10.04 desktop
2. upgrade to 12.04 without rebooting.
3. run /etc/init.d/cron stop; /etc/init.d/cron start
4. verify that an error message is output and cron is not restarted.
5. install the upstart package from precise-proposed.
6. again run /etc/init.d/cron start
7. verify that no error is output and cron is restarted successfully.

[Regression Potential]
None foreseen.

/lib/init/upstart-job was recently changed (bug 974147) such that it now calls 'initctl show-config -e $JOB'. This works fine for precise systems and for oneiric->precise upgrades, but does not work for lucid->precise upgrades since 'show-config' is not a legitimate initctl command on the version of init running on lucid at the time of the precise upgrade (0.6.5-8) since the 'show-config' command was added in Upstart 1.3.

/lib/init/upstart-job needs to be changed to handle the lucid upgrade path scenario by either checking the running version of init or more intelligently parsing the output of 'initctl show-config -e $JOB' since currently, an upgrade from lucid to precise will cause all upgraded packages containing upstart jobs to *not* restart the services.

Related branches

James Hunt (jamesodhunt) wrote :

This upgrade scenario handling issue is probably also the cause of bug 984474.

Steve Langasek (vorlon) on 2012-04-19
Changed in upstart (Ubuntu):
status: New → Triaged
importance: Undecided → High
tags: added: rls-p-tracking
Changed in upstart (Ubuntu):
milestone: none → ubuntu-12.04.1
James Hunt (jamesodhunt) on 2012-04-19
Changed in upstart (Ubuntu):
assignee: nobody → James Hunt (jamesodhunt)
James Hunt (jamesodhunt) on 2012-04-20
Changed in upstart (Ubuntu):
status: Triaged → In Progress
James Hunt (jamesodhunt) wrote :

= Impact =

If this fix is not applied to Precise, users upgrading from lucid will see errors relating to bug 984474 ("initctl crashed with SIGABRT in nih_error_clear()") as the installer proceeds to upgrade packages containing Upstart services. These services will not be restarted as they should be once the new package version is installed. However, the services will be restarted on reboot.

Users on Oneiric should not experience this issue (since 'initctl show-config' is available on oneiric).

= Development Fix =

The bug has been addressed by modifying /lib/init/upstart-job to only consider a service disabled if both of the following are true:

1) The version of Upstart currently running supports querying of a jobs 'start on' condition (via the 'initctl show-config' command).

2) Upstart reports that no 'start on' condition exists for the job.

Links to the script /lib/init/upstart-job are installed in /etc/init.d/ such that administrators are able to manipulate Upstart jobs as if they were SystemV services (using for example "/etc/init.d/foo restart" or even "service restart").

= Stable Fix =

A patch to /lib/init/upstart-job is attached.

Note that this patch also includes a fix to correct restart handling in lucid: it now stops and then starts the Upstart job rather than just calling "restart" which does *not* reload the job configuration.

= Test Case =

To observe the bug on a lucid system:

1) Check that your Upstart jobs are running (a good example is 'cron'):
   ('/etc/init.d/cron' status, or 'status cron')
2) Upgrade lucid to precise using update-manager(8) or do-release-upgrade(8).
3) Observe errors relating to the initctl(8) command either on-screen or in the installer logs under /var/log/installer/.
4) After the upgrade has completed, observe that your services are no longer running
   ('/etc/init.d/cron' status, or 'status cron').

To be convinced the bug is fixed on a lucid system, a new version of /lib/init/upstart-job is required. Once installed:

1) Check that your Upstart jobs are running (a good example is 'cron'):
   ('/etc/init.d/cron' status, or 'status cron')
2) Upgrade lucid to precise using update-manager(8) or do-release-upgrade(8).
3) There should be no errors relating to the initctl(8) command either on-screen or in the installer logs under /var/log/installer/.
4) After the upgrade has completed, observe that your services are still running as expected
   ('/etc/init.d/cron' status, or 'status cron').

= Regression Potential =

No regression potential.

The attachment "patch to /lib/init/upstart-job for a lucid system to bring it up-to-date with the precise version." 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-reviewers team 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
James Hunt (jamesodhunt) on 2012-04-25
Changed in upstart (Ubuntu):
status: In Progress → Fix Committed
Steve Langasek (vorlon) on 2012-04-26
description: updated

Hello James, or anyone else affected,

Accepted upstart into precise-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Launchpad Janitor (janitor) wrote :

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

Changed in upstart (Ubuntu Quantal):
status: New → Confirmed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upstart - 1.5-0ubuntu7

---------------
upstart (1.5-0ubuntu7) precise-proposed; urgency=low

  * Correct a build failure from the previous upload.

upstart (1.5-0ubuntu6) precise-proposed; urgency=low

  * debian/upstart.logrotate: don't create empty files after rotation;
    upstart will automatically create new log files for jobs as needed.
  * init/main.c: restore the fix for bug #540256; we know the console setup
    is taken care of by plymouth in Ubuntu, so upstart changing the console
    settings just makes trouble (such as turning echo back on when it
    shouldn't be). LP: #876626.

  [ James Hunt ]
  * debian/upstart-job: Only attempt to handle disabled jobs if the running
    version of Upstart supports such a query (LP: #985755, #984474).
  * debian/manpages/upstart-events.7: Fixed typo and corrected reference to
    'kill signal' stanza.
 -- Steve Langasek <email address hidden> Thu, 26 Apr 2012 07:48:17 -0700

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

Duplicates of this bug

Other bug subscribers