Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write timestamp to console on halt/reboot/shutdown #2268

Closed
ubuntu-server-builder opened this issue May 9, 2023 · 12 comments
Closed

write timestamp to console on halt/reboot/shutdown #2268

ubuntu-server-builder opened this issue May 9, 2023 · 12 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1018554

Launchpad details
affected_projects = ['cloud-init (Ubuntu)', 'cloud-init (Ubuntu Precise)']
assignee = smoser
assignee_name = Scott Moser
date_closed = 2012-10-01T18:27:23.325246+00:00
date_created = 2012-06-27T19:53:51.545879+00:00
date_fix_committed = 2012-07-26T14:30:09.131031+00:00
date_fix_released = 2012-10-01T18:27:23.325246+00:00
id = 1018554
importance = low
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1018554
milestone = None
owner = smoser
owner_name = Scott Moser
private = False
status = fix_released
submitter = smoser
submitter_name = Scott Moser
tags = ['amd64', 'apport-bug', 'quantal', 'uec-images', 'verification-done']
duplicates = []

Launchpad user Scott Moser(smoser) wrote on 2012-06-27T19:53:51.545879+00:00

=== 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)

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 9, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2012-06-27T19:53:51.545879+00:00

Launchpad attachments: Dependencies.txt

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Launchpad Janitor(janitor) wrote on 2012-06-27T20:15:21.479037+00:00

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

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user James Hunt(jamesodhunt) wrote on 2012-06-28T10:02:32.608763+00:00

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


@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2012-06-28T19:58:02.011261+00:00

I chatted a bit with james, and he also said:
woudl it be possible to have a single job that fired on halt, poweroff, reboot?
that job will fire on halt/poweroff/reboot already.
console output prolly makes more sense, yeah, so just drop the redirection.
so if it runs on halt/poweroff/reboot, is there a way that i can determine which?
yes - the RUNLEVEL variable in that job will be set to 0, 1, or 6. See "man 7 runlevel" for details
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.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2012-07-26T14:30:08.082185+00:00

fixed in trunk revno 609.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Launchpad Janitor(janitor) wrote on 2012-08-03T19:00:13.087024+00:00

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 smoser@ubuntu.com Fri, 03 Aug 2012 14:55:37 -0400

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Steve Langasek(vorlon) wrote on 2012-12-10T19:30:45.060152+00:00

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.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Steve Langasek(vorlon) wrote on 2012-12-10T23:04:07.847461+00:00

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!

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2012-12-12T21:06:22.968052+00:00

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].

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Clint Byrum(clint-fewbar) wrote on 2013-01-08T19:15:23.873025+00:00

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!

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Launchpad Janitor(janitor) wrote on 2013-01-16T14:20:17.525104+00:00

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 smoser@ubuntu.com Thu, 13 Dec 2012 12:16:56 -0500

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Colin Watson(cjwatson) wrote on 2013-01-16T14:20:21.061621+00:00

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant