upstart doesn't obey /etc/default/halt

Bug #59134 reported by hunger
10
Affects Status Importance Assigned to Milestone
kdebase (Ubuntu)
Fix Released
Undecided
Unassigned
upstart (Ubuntu)
Fix Released
Medium
Scott James Remnant (Canonical)

Bug Description

Binary package hint: upstart

My system does not turn of anymore when choosing "power off". It does a half-hearted attempt to bring down the system (ignoring most of the init scripts that are run normally) and then sits there.

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

Sits where?

How are you choosing power off, is this a menu option or a command you are running?

Can you run "dpkg-query -W upstart upstart-compat-sysv sysv-rc initscripts" for me.

Before powering off, can you run "runlevel" and provide the output of that for me.

Changed in upstart:
assignee: nobody → keybuk
status: Unconfirmed → Needs Info
Revision history for this message
hunger (hunger) wrote :

I select "power off" in kdm.

When should I run "runlevel"? Imediately before shuting down or when clicking on the power off button?

Revision history for this message
hunger (hunger) wrote :

Both upstart and upstart-compat-sysv are version 0.2.1-5 IIRC. We went through this in IRC and you agreed that this is the version I should be using.

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

Before clicking the button

Yup, the version you have and the scripts you have are now right :) Is it still failing to shut down?

Revision history for this message
John Dong (jdong) wrote :

Scott,

I can confirm that if I choose "Shut Down" from KDE's log out dialog, upstart will not power off my system. I do get the "System Halted" message from the kernel, at which point I need to manually reach for a power button or SysRq-O, which does power down my system.

However, /sbin/poweroff works correctly in turning off the computer after executing shutdown scripts.

I have not tested /sbin/halt yet, but I remember that with sysvinit that also powered down my system... perhaps that behavior changed with upstart?

Revision history for this message
John Dong (jdong) wrote :

/sbin/halt does the same thing that kdm is doing -- that is, running all the shutdown scripts, then saying "System halted.", then staying there.

kdm did power down the system before upstart came along on my systems.... so is this an upstart problem or a kdm problem?

Revision history for this message
Roshan Shariff (roshan.shariff) wrote :

I can confirm this bug.

/sbin/halt, which is supposed to be equivalent to "shutdown -h now", doesn't work with upstart. Running it causes the system to shutdown normally, and print a kernel message saying "will now halt", but it doesn't actually power off. Running "shutdown -h now" works fine, as does the "Shut Down" option in the gnome panel or GDM.

My system has upstart 0.2.1-7 and associated packages, and / is on NFS.

Changed in upstart:
status: Needs Info → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

I compared upstart's halt/poweroff implementation to sysvinit's, and there are a few differences which might be relevant. After #define translation, the halt/poweroff bit in sysvinit does:

  reboot(RB_ENABLE_CAD);
  kill(1, SIGTSTP);
  if (do_poweroff)
    reboot(RB_POWER_OFF);
  reboot(RB_HALT);

The fallthrough appears to be deliberate; RB_ENABLE_CAD seems at least useful; and is it possible that the kernel's getting stuck before poweroff because init hasn't been SIGTSTPed?

Revision history for this message
Johan Kiviniemi (ion) wrote :

/etc/rc0.d/S90halt either halts or poweroffs the system depending on the setting in /etc/default/halt. The setting can be overridden with the env variable INIT_HALT.

That's what /etc/event.d/rc0-halt does: it contains "env INIT_HALT=HALT". I commented the line out, and "halt" worked just like it used to.

Revision history for this message
Sarah Kowalik (hobbsee-deactivatedaccount) wrote :

confirming here, on latest kubuntu.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: [Bug 59134] Re: upstart fails to power off my system

On Thu, 2006-09-07 at 12:48 +0000, Colin Watson wrote:

> I compared upstart's halt/poweroff implementation to sysvinit's, and
> there are a few differences which might be relevant. After #define
> translation, the halt/poweroff bit in sysvinit does:
>
> reboot(RB_ENABLE_CAD);
> kill(1, SIGTSTP);
> if (do_poweroff)
> reboot(RB_POWER_OFF);
> reboot(RB_HALT);
>
> The fallthrough appears to be deliberate; RB_ENABLE_CAD seems at least
> useful; and is it possible that the kernel's getting stuck before
> poweroff because init hasn't been SIGTSTPed?
>
This is pretty much the same as upstart's implementation ... the only
difference is that I use a switch() rather than a fall-through.

The kernel just has a switch() there too, so it's definitely not that.

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
Colin Watson (cjwatson) wrote : Re: upstart fails to power off my system

Oh, I missed the RB_ENABLE_CAD and SIGTSTP somehow. Sorry about that.

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

They're a bit further up to correct an ancient problem that the sync() could hang the machine; and CAD wasn't yet enabled so the sysadmin couldn't escape it.

Figured I might as well fix problems while changing the world <g>

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

This is definitely confirmed that the rc0 handling never looks at /etc/default/halt, so halt always halts the system because it doesn't know better

Changed in upstart:
importance: Untriaged → Medium
Revision history for this message
Bubba Siggler (bud3) wrote :

 I just installed the Edgy for the first Time. After the update my box wont shut down. I finally hit the reset button for a reboot work fine. Log back in an run a shut down. Worked great, plus the log in. this is a GDM box. If there is any thing I can sent for attachment let me know. I am having like alway get the BCM4318 wireless with wpa to work.

Cherokee

Revision history for this message
Roshan Shariff (roshan.shariff) wrote : Re: [Bug 59134] Re: upstart fails to power off my system

> I just installed the Edgy for the first Time. After the update my box
> wont shut down. I finally hit the reset button for a reboot work fine.

If you mean the first reboot doesn't work after upgrading from Dapper
(sysvinit) to Edgy (upstart), that's bug #58523. It's been fixed by
Scott and will probably be released in the next upload. The short-term
workaround is to save your work and close all your apps, and run "sudo
reboot -f".

Roshan

Changed in upstart:
status: Confirmed → Fix Committed
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

 upstart (0.2.5-1) edgy; urgency=low
 .
   * New upstream release:
     - no longer spins when no stalled event handler. Ubuntu: #59170.
     - shutdown works when under sysvinit. Ubuntu: #58523;
     - shutdown -k implemented. Ubuntu: #58723.
     - telinit sends shutdown event for 0, 1 and 6. Ubuntu: #58913.
     - basic manual pages included. Ubuntu: #58724.
 .
   * upstart-compat-sysv Replaces: sysvinit. Ubuntu: #59427.
   * upstart Recommends: upstart-compat-sysv, startup-tasks & system-services.
 .
   * New upstart-logd package includes the logd daemon that can will log
     output of jobs with "console logged" (the default) in their description
     to /var/log/boot.
 .
   * Add /etc/event.d/rc0 that is run on the "halt" event (neither -H or -P
     given), and modify rc0-halt to run on "system-halt" (-H given) and
     rc0-poweroff to run on "power-off" (-P given). Ubuntu: #59134.
   * Fix the control-alt-delete job to run on the "ctrlaltdel" event so
     that it's triggered properly. Ubuntu: #59398.
   * Fix single-user mode.

Changed in upstart:
status: Fix Committed → Fix Released
Revision history for this message
John Dong (jdong) wrote :

kdm still halts the system instead of powering down. I think this is partially kdm's fault now, so I've marked kdebase as affected.

Revision history for this message
Anthony Mercatante (tonio) wrote :

Unfortunately, kdm doesn't parse /etc/default/halt and the shutdown command is hardcoded...
I patched to match poweroff instead of halt. Works here so changing to fix released.

Changed in kdebase:
status: Unconfirmed → 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.