write timestamp to console on halt/reboot/shutdown

Bug #1018554 reported by Scott Moser on 2012-06-27
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Low
Scott Moser
cloud-init (Ubuntu)
Wishlist
Unassigned
Precise
Low
Unassigned

Bug Description

=== Begin SRU Information ===
[Impact]
 * When launching a cloud instance, the console log is extremely valuable
   in debugging issues, and is often times all the data you have.
   In Ubuntu automated tests [1], having timestamps on the console for
   'reboot' or 'halt' allows us to correlate logs from the instance
   console and test harness.

   This change simply writes a message to /dev/console when a reboot or
   shutdown occurs.

   [1] https://jenkins.qa.ubuntu.com/view/Quantal/view/All%20Quantal/job/quantal-server-ec2/

[Test Case]
 * To demonstrate the usefulness, launch an instance, and then power it
   off. After that, get the console log. You'll notice no timestamp
   other than the kernel uptime timestamps that could help you to
   determine when the instance was terminated.

[Regression Potential]
 * There is very little regression potential here. If this upstart job was
   somehow buggy, it would just result in failure to write the message.

=== End SRU Information ===

In EC2 and other cloud platforms, the console data is programmatically available.

Our tests in EC2 collect this console output on shutdown / reboot /terminate. The data is very useful.

in cloud-init i've added timestamps to output so that information is available in the console log.
One thing missing (which cloud-init has no hooks for) is 'shutdown' or 'reboot'.

I'd like for upstart to write a message to /dev/console saying:
 rebooting Wed, 27 Jun 2012 15:52:45 -0400

or something like that.
I'd be happy if the 'nih_info' messages in util/reboot.c
had at timestamp on them, and got written to /dev/console by default (they do not seem to).

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: upstart 1.5-0ubuntu7
ProcVersionSignature: User Name 3.5.0-2.2-generic 3.5.0-rc4
Uname: Linux 3.5.0-2-generic x86_64
ApportVersion: 2.2.5-0ubuntu1
Architecture: amd64
Date: Wed Jun 27 19:45:52 2012
ProcEnviron:
 TERM=screen
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: upstart
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Scott Moser (smoser) wrote :
Launchpad Janitor (janitor) wrote :

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

Changed in upstart (Ubuntu):
status: New → Confirmed
James Hunt (jamesodhunt) wrote :

Hi Scott,

This doesn't require a change to Upstart - just create a job called "log-reboot" or similar containing something like this:

-------------------------------------
start on runlevel PREVLEVEL=2

task

exec echo "rebooting `date`" > /dev/console

-------------------------------------

Changed in upstart (Ubuntu):
importance: Undecided → Wishlist
Scott Moser (smoser) wrote :

I chatted a bit with james, and he also said:
<smoser> woudl it be possible to have a single job that fired on halt, poweroff, reboot?
<jodh> that job will fire on halt/poweroff/reboot already.
<jodh> console output prolly makes more sense, yeah, so just drop the redirection.
<smoser> so if it runs on halt/poweroff/reboot, is there a way that i can determine which?
<jodh> yes - the RUNLEVEL variable in that job will be set to 0, 1, or 6. See "man 7 runlevel" for details
<jodh> bear in mind that the job needs to be quick as if things take too long on shutdown, they get killed of course.

So, i suggest we just add this to cloud-init ubuntu packaging.

affects: upstart (Ubuntu) → cloud-init (Ubuntu)
Scott Moser (smoser) wrote :

fixed in trunk revno 609.

Changed in cloud-init:
assignee: nobody → Scott Moser (smoser)
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.0~bzr614-0ubuntu1

---------------
cloud-init (0.7.0~bzr614-0ubuntu1) quantal; urgency=low

  * New upstream snapshot.
    * disable searching for 'ubuntu-mirror' in local dns to find a
      local mirror (LP: #974509)
    * emit the cloud-config event (LP: #1028674)
    * write timestamps to console on reboot and shutdown (LP: #1018554)
 -- Scott Moser <email address hidden> Fri, 03 Aug 2012 14:55:37 -0400

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Scott Moser (smoser) on 2012-08-16
Changed in cloud-init:
importance: Undecided → Low
Scott Moser (smoser) on 2012-10-01
Changed in cloud-init:
status: Fix Committed → Fix Released
Scott Moser (smoser) on 2012-10-05
Changed in cloud-init (Ubuntu Precise):
status: New → Triaged
importance: Undecided → Low
Scott Moser (smoser) on 2012-11-08
description: updated
Scott Moser (smoser) on 2012-11-08
description: updated
Steve Langasek (vorlon) wrote :

FWIW, this would be more precise if it had a start condition of:

  start on runlevel [06]

though it's unlikely that cloud users are going to make much use of runlevels other than runlevel 2.

Hello Scott, or anyone else affected,

Accepted cloud-init into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in cloud-init (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Scott Moser (smoser) wrote :

booted an image, installed new cloud-init, ran '/sbin/poweroff' saw this on the serial console:
Wed Dec 12 21:05:24 UTC 2012: shutting down for poweroff [up 184s].

tags: added: verification-done
removed: verification-needed
Clint Byrum (clint-fewbar) wrote :

Hello Scott, or anyone else affected,

Accepted cloud-init into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: removed: verification-done
tags: added: verification-needed
Scott Moser (smoser) on 2013-01-08
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.3-0ubuntu1.3

---------------
cloud-init (0.6.3-0ubuntu1.3) precise-proposed; urgency=low

  * debian/patches/lp-1070345-landscape-restart-after-change.patch,
    debian/patches/lp-1066115-landscape-install-fix-perms.patch:
    fix missing or incorrect imports (LP: #1070345, LP: #1066115).

cloud-init (0.6.3-0ubuntu1.2) precise-proposed; urgency=low

  * debian/patches/lp-978127-maas-oauth-fix-bad-clock.patch: fix usage of
    oauth in maas data source if local system has a bad clock (LP: #978127)
  * debian/cloud-init.preinst: fix bug where user data scripts re-ran on
    upgrade from 10.04 versions (LP: #1049146)
  * debian/patches/lp-974509-detect-dns-server-redirection.patch: detect dns
    server redirection and disable searching dns for a mirror named
    'ubuntu-mirror' (LP: #974509)
  * debian/patches/lp-1018554-shutdown-message-to-console.patch: write a
    message to the console on system shutdown. (LP: #1018554)
  * debian/patches/lp-1066115-landscape-install-fix-perms.patch: install
    landscape package if needed which will ensure proper permissions on config
    file (LP: #1066115).
  * debian/patches/lp-1070345-landscape-restart-after-change.patch: restart
    landscape after modifying config (LP: #1070345)
  * debian/patches/lp-1073077-zsh-workaround-for-locale_warn.patch: avoid
    warning when user's shell is zsh (LP: #1073077)
  * debian/patches/rework-mirror-selection.patch: improve mirror selection by:
    * allowing region/availability-zone to be part of mirror (LP: #1037727)
    * making mirror selection arch aware (LP: #1028501)
    * allow specification of a security mirror (LP: #1006963)
 -- Scott Moser <email address hidden> Thu, 13 Dec 2012 12:16:56 -0500

Changed in cloud-init (Ubuntu Precise):
status: Fix Committed → Fix Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers