util: runlevel should return "unknown" before telinit run

Bug #400248 reported by Scott James Remnant (Canonical)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart
Fix Released
Low
Scott James Remnant (Canonical)

Bug Description

I was thinking about this, we currently set RUNLEVEL and PREVLEVEL to "" when in rc-sysinit, which means that the "current runlevel" ends up being N.

runlevel will report
  N N

telinit and shutdown will use PREVLEVEL=N in the new runlevel.

I don't think this is right, I think that there should be "no current runlevel"; we should search /var/run/utmp which will either not exist or be empty, and thus runlevel should report "unknown"

telinit and shutdown (which use sysv.c) already check for an error getting the runlevel and substitute N anyway.

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

As the comment says, these env vars are there to override bad information in /var/run/utmp; so runlevel should check for 'N' and never print it

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :
summary: - conf: should be no RUNLEVEL or PREVLEVEL when in rc-sysinit
+ util: runlevel should return "unknown" before telinit run
Changed in upstart:
status: Triaged → Fix Committed
Changed in upstart:
assignee: nobody → Scott James Remnant (scott)
milestone: none → 0.6.1
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Fixed in Upstart 0.6.1:

0.6.1 2009-07-16 "Born in the wagon of a travelling show"

        * D-Bus 1.2.16 is now required.

        * Updated ptrace() code to handle receiving the trapped stopped
          child _before_ we receive the trapped fork() syscall, which
          seems to be the most common way the race goes when running
          as init. This seems to make "expect fork/daemon" largely work.
          (Bug: #264711)

        * runlevel will now output "unknown" and exit with an error when
          called before the first telinit call. (Bug: #400248)

        * runlevel will prefix error messages with the utmp filename being
          used. (Bug: #400241)

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.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.