conf: DEFAULT_RUNLEVEL should not be assigned if nothing found from /etc/inittab

Bug #405847 reported by Steven Shiau
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
upstart
Fix Released
Low
Scott James Remnant (Canonical)
0.6
Won't Fix
Low
Scott James Remnant (Canonical)
upstart (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Description: Ubuntu karmic (development branch)
Release: 9.10

upstart:
  Installed: 0.6.2-1
  Candidate: 0.6.2-1
  Version table:
 *** 0.6.2-1 0
        500 http://free.nchc.org.tw karmic/main Packages
        100 /var/lib/dpkg/status

In the file /etc/init/rc-sysinit.conf, if /etc/inittab exists, but for some reason, e.g. it's an empty file, the current assumption in rc-sysinit.conf will break init. i.e. DEFAULT_RUNLEVEL should not be assigned if nothing found from /etc/inittab. A patch file was attached.
My 2 cents.

Steven.

Revision history for this message
Steven Shiau (stevenshiau) wrote :
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I believe Johan had a neater patch for this?

Changed in upstart (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Johan Kiviniemi (ion) wrote :

Patch attached. I didn’t test it on a live system, though. (I did test the sed expression with various inputs under dash.)

Changed in upstart:
importance: Undecided → Low
milestone: none → 0.6.4
status: New → Triaged
summary: - DEFAULT_RUNLEVEL should not be assigned if nothing found from
+ conf: DEFAULT_RUNLEVEL should not be assigned if nothing found from
/etc/inittab
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :
Changed in upstart:
milestone: 0.6.4 → 0.7.0
status: Triaged → Fix Committed
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :
Revision history for this message
Steven Shiau (stevenshiau) wrote :

Thanks for the bug fixed. However, the code in the http://bazaar.launchpad.net/~scott/upstart/0.6/revision/1206 will _REPLACE_ the DEFAULT_RUNLEVEL even if /etc/inittab is something like:
#id:3:initdefault:
i.e. a commented line beginning with "#".
Maybe it's better to make it like:
eval "$(sed -nre 's/^[^#][^:]+:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' inittab || true)"

I believe you have better way to write it.
My 2 cents.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: [Bug 405847] Re: conf: DEFAULT_RUNLEVEL should not be assigned if nothing found from /etc/inittab

On Sun, 2009-08-30 at 03:05 +0000, steven_shiau wrote:

> Thanks for the bug fixed. However, the code in the http://bazaar.launchpad.net/~scott/upstart/0.6/revision/1206 will _REPLACE_ the DEFAULT_RUNLEVEL even if /etc/inittab is something like:
> #id:3:initdefault:
> i.e. a commented line beginning with "#".
> Maybe it's better to make it like:
> eval "$(sed -nre 's/^[^#][^:]+:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' inittab || true)"
>
> I believe you have better way to write it.
> My 2 cents.
>
Could you open a new bug about that?

It probably needs to be

 ^[^#][^:]*:

Since I think 1-character ids are acceptable to sysvinit

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Oh, sorry, my bad - this doesn't need a new bug as this one's still open! :)

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Have updated the regex in trunk

Changed in upstart:
milestone: 0.7.0 → none
assignee: nobody → Scott James Remnant (scott)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upstart - 0.6.3-8

---------------
upstart (0.6.3-8) karmic; urgency=low

  * Rather than calling "telinit u" after upgrade, which will lose state,
    have the umountroot initscript take care of it for us by setting a
    flag. LP: #441796.
  * Don't lose the original default runlevel if /etc/inittab exists without
    an initdefault line. LP: #405847.
  * Fix "unhandled error" in shutdown when unable to change runlevel,
    e.g. due to previous Ubiquity bug. LP: #426332.
  * Merge change from trunk that makes it possible to build Upstart using
    a previously built copy of nih-dbus-tool, especially useful when
    cross-compiling. LP: #426740.
  * Merge change from libnih to store our assertion messages in the
    glibc __abort_msg symbol so apport can pick them up. LP: #429411.
  * Merge change from libnih to fix compilation issue with eglibc due
    to changed alphasort() prototype.

 -- Scott James Remnant <email address hidden> Wed, 14 Oct 2009 05:34:13 +0100

Changed in upstart (Ubuntu):
status: Triaged → Fix Released
Changed in upstart:
milestone: none → 0.6.5
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

0.6.5 2010-02-04 "Our last, best hope for victory"

 * Since libnih has been separated out into its own project, Upstart
   no longer includes its source and now uses the installed version by
   default.

 * The external nih-dbus-tool means that cross-compilation is trivial,
   the path to it may be overriden with NIH_DBUS_TOOL=... as an
   argument to configure. (Bug: #426740)

 * Developers may still build against a local libnih source tree by
   passing --with-local-libnih=/path/to/libnih to configure.

 * There is a new initctl "reload" command, with matching
   /sbin/reload symlink. This sends the SIGHUP signal to the running
   main process of the named job instance.

 * Event operator matches in jobs now support "!=" in addition to the
   usual "=", e.g.:

  start on net-device-added INTERFACE!=eth*

   (Bug: #513035)

 * Moved D-Bus system bus reconnection trigger from SIGHUP to SIGUSR1,
   since SIGHUP is already used for a forced configuration reload and
   causes Upstart to "forget" state.

 * Fixed bug where the default runlevel would be lost when an
   /etc/inittab file exists without an initdefault line. (Bug: #405847)

 * Fixed "Unhandled error" message from shutdown. (Bug: #426332)

 * Fixed "Unhandled error" assertion crash from Upstart child
   processes when failing to spawn a job. (Bug: #451917)

 * No longer holds /dev/console open, so the SAK SysRq key will not
   kill Upstart. (Bug: #486005)

 * Restored sync() call before reboot().

 * Added missing OPTIONS section to init(8) manpage. (Bug: #449883)

Changed in upstart:
status: Fix Committed → Fix Released
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.