Shutdown from g-p-m doesn't use uspash

Bug #35182 reported by Jan Mynarik
40
Affects Status Importance Assigned to Milestone
gnome-power-manager (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

When run on battery and battery level is critical enough for g-p-m to shutdown my notebook, the shutdown process is not beautified with usplash like it is when shutting down from gdm, session logout dialog or 'restart' notification icon.

Running Dapper, g-p-m 2.13.93-0ubuntu3

Revision history for this message
Richard Hughes (richard-hughes) wrote :

At the moment, hal-system-power-shutdown has this:

#Try for common tools
if [ -x "/sbin/shutdown" ] ; then
        /sbin/shutdown -h now
        exit $?
elif [ -x "/usr/sbin/shutdown" ] ; then
        /usr/sbin/shutdown -h now
        exit $?
else
        unsupported
fi

so that it works on all distros. On Ubuntu, how do you shutdown on the command line so that usplash activates? It's easy to add to upstream hal if you give me the command.

Richard.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote : Re: Shutdown from g-p-m doesn't use usplash

I'm not involved in any development of update-notifier and/or gdm but this is what I've found.

From update-notifier/src/reboot.c (requests reboot from gdm after session end, logouts):

static void
request_reboot (void)
{
 GnomeClient *client;
 char *cmd[] = { GDM_SIGNAL, "--reboot", NULL };

 client = gnome_master_client ();
 g_return_if_fail (client != NULL);

 /* Tell gdm to reboot once we exit the session */
 g_spawn_sync (NULL, cmd, NULL, G_SPAWN_STDOUT_TO_DEV_NULL,
        NULL, NULL, NULL, NULL, NULL, NULL);

 /* Tell gnome-session to save and exit the session without asking
  * the user. */
 gnome_client_request_save (client,
       GNOME_SAVE_GLOBAL,
       TRUE,
       GNOME_INTERACT_NONE,
       FALSE,
       TRUE);
}

This is one of ubuntu patches (gdm/debian/patches/15_usplash.patch) for gdm to get it co-operate with usplash in case of boot and shutdown/reboot:

--- gdm-2.8.0.4/debian/init 2005-09-29 15:56:09.000000000 +0200
+++ gdm-2.8.0.4/debian/init 2005-09-29 15:56:58.000000000 +0200
@@ -50,6 +50,10 @@
    if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" -a "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2>/dev/null)" != "$DAEMON" ]; then
   log_warning_msg "Not starting GNOME Display Manager (gdm); it is not the default display manager."
  else
+ # if usplash is runing, make sure to stop it now, yes "start" kills it.
+ if pidof usplash > /dev/null; then
+ /etc/init.d/usplash start
+ fi
   log_begin_msg "Starting GNOME Display Manager..."
   start-stop-daemon --start --quiet --pidfile $PIDFILE --name gdm $SSD_ARG -- $CONFIG_FILE >/dev/null 2>&1 || log_end_msg 1
   log_end_msg 0
--- gdm-2.13.0.8/daemon/gdm.c 2006-02-10 07:04:13.000000000 +1100
+++ gdm-2.13.0.8/daemon/gdm.c 2006-02-23 12:31:42.000000000 +1100
@@ -601,6 +601,13 @@
 static void
 change_to_first_and_clear (gboolean restart)
 {
+ if (WEXITSTATUS(system("/sbin/usplash_down 2>/dev/null")) == 0) {
+ if (restart)
+ system("/sbin/usplash_write \"TEXT System is restarting, please wait...\"");
+ else
+ system("/sbin/usplash_write \"TEXT System is shutting down, please wait...\"");
+ } else {
+
  gdm_change_vt (1);
  VE_IGNORE_EINTR (close (0));
  VE_IGNORE_EINTR (close (1));
@@ -624,6 +631,8 @@
   printf (_("System is shutting down, please wait ..."));
  /* set to black */
  printf ("\033[0m\n\033[1m---\033[0m\n\n");
+
+ }
 }
 #endif /* __linux__ */

If I understand it right, g-p-m just sets policy for hal and hal takes care of shutdown even if GNOME is currently not running. Am I right?

Ideally the hal-system-power-shutdown script should try to shutdown computer via gdm; including session save, what it currently does (some gnome-session behaviour for the case of shutdown?). If gdm weren't running (should it be possible? kubuntu/kdm?), just copy the gdm's shutdown/restart behaviour.

Revision history for this message
Richard Hughes (richard-hughes) wrote :

Okay, thanks for doing the research on that. Condensing all you've found, does (as root):

/sbin/usplash_down
/sbin/usplash_write "System is shutting down, please wait..."
/sbin/shutdown -h now

shut your system down with usplash okay?

>Ideally the hal-system-power-shutdown script should try to shutdown
>computer via gdm

Nahh, this is the wrong way round, gdm should ask hal that it wants to shutdown, as hal is not aware of anything "per-session" as it's "per-system". The hal-system-power-shutdown script is to abstract how to do the actual shutdown, with distro tweaks (like the usplash thing) and where files are not in standard locations between distros.

This abstraction allows gdm/g-p-m/whatever to call the Shutdown() dbus methods without worrying about "how" the method is performed, and any tweaks only have to be done in one place (e.g. gdm, kdm, etc).

Richard.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

> /sbin/usplash_down
> /sbin/usplash_write "System is shutting down, please wait..."
> /sbin/shutdown -h now
>
> shut your system down with usplash okay?

Unfortunately it doesn't. It switches usplash on and writes "System is
shutting down ...." but then it blinks (probably during the stop of gdm)
and continues without usplash (even without text console shutdown, just
console login prompt is shown). Probably bug in gdm (in ubuntu).

> >Ideally the hal-system-power-shutdown script should try to shutdown
> >computer via gdm
>
> Nahh, this is the wrong way round, gdm should ask hal that it wants to
> shutdown, as hal is not aware of anything "per-session" as it's "per-
> system". The hal-system-power-shutdown script is to abstract how to do
> the actual shutdown, with distro tweaks (like the usplash thing) and
> where files are not in standard locations between distros.
>
> This abstraction allows gdm/g-p-m/whatever to call the Shutdown() dbus
> methods without worrying about "how" the method is performed, and any
> tweaks only have to be done in one place (e.g. gdm, kdm, etc).

I see, so current gdm behaviour is wrong (?). gdm should use hal to
reboot/shutdown.

Probably, this problem should be discussed with Ubuntu's gdm maintainer.

Pogo (that's me - Jan Mynarik :-))

Revision history for this message
Richard Hughes (richard-hughes) wrote :

>gdm should use hal to reboot/shutdown.

In an ideal world, yes. Then all the stuff like invoking usplash "just works" when you use gdm, g-p-m, kdm, whatever.

If:
/sbin/usplash_down
/sbin/usplash_write "System is shutting down, please wait..."
:works, then can you find out how gdm shuts down the system without blanking the screen? Thanks.

Richard.

Revision history for this message
Paul Sladen (sladen) wrote :

Descreasing the priority as this only happens when the user wasn't paying attention to the machine anyway!

Changed in gnome-power-manager:
status: Unconfirmed → Confirmed
Revision history for this message
Paul Sladen (sladen) wrote :

Closing this because there's been nothing for 2months and I was the last person to touch it anyway.

Please re-open if this is still happening.

Changed in gnome-power-manager:
status: Confirmed → Rejected
Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

I, as a reporter, didn't add anything else because from my point of view the report was complete. I thought this bug has been moved to dapper+1 and was to be fixed.

Revision history for this message
Paul Sladen (sladen) wrote :

Confirmed, this is a duplicate and I also had it this morning.

Changed in gnome-power-manager:
status: Rejected → Confirmed
Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

I'm not sure if this is a duplicate of recently seen behaviour (usplash doesn't show up immediately after shutdown from gnome-session). usplash has not been used for shutdown from g-p-m even when it worked perfectly from both gdm and gnome-session.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Daniel suggested that by mail:

"The usplash being late in shutdown is probably due to hal's shutdown
helper. Check out the script in the hal package for shutting down the
machine /usr/share/hal/scripts/hal-system-power-shutdown -- it just
calls shutdown -h now where perhaps it should call usplash_down first?"

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

@seb128:
That's what Richard said in comments. Ideally, even gdm should use hal-system-power-shutdown and all ubuntu/usplash specific things (for shutdown) should be done there in one place.

Revision history for this message
Josh (josh-ground-impact) wrote :

this shouldnt be minor, and be major, it completely hangs up the shutdown on 2 of my laptops, and i have to manually shut it down by holding the power button, or select restart then hit the power button once to send the term signals, very annoying on a laptop

battery charged, pluged in, unpluged it always does it

Revision history for this message
Ricardo Pérez López (ricardo) wrote :

I wonder if this bug could be a duplicate of Bug #40597.

Revision history for this message
Ricardo Pérez López (ricardo) wrote :

> this shouldnt be minor[...]

I agree. "Usplash down" is one of the "main" features of the new Dapper. If you see:

http://www.ubuntu.com/testing/flight5

"No Linux distribution has had a complete graphical shutdown process... until now. Starting with Flight 5, Ubuntu 6.06 now uses usplash to provide a graphical shutdown screen. This gives Ubuntu a more professional and user friendly feel overall. Users now see almost no text messages on the startup and shutdown screens."

Obviously, "Usplash down" makes the difference with other distros, and IMHO it should be fixed in order to get it working perfectly before Dapper release.

Revision history for this message
Sebastien Bacher (seb128) wrote :

The shutdown action from the session dialog is fixed with that upload:

 gnome-session (2.14.1-0ubuntu11) dapper; urgency=low
 .
   * debian/patches/11_session_dialog.patch,
     debian/patches/16_use_gpm.patch:
     - use only one patch, no need to have differents ones for the same feature
     - use GDM for shutdown action, fix usplash transition (Ubuntu: #35182)

Revision history for this message
Clemens (clast) wrote :

works for me now, can I close this bug or is there still some more stuff to be done here?

Changed in gnome-power-manager:
status: Confirmed → Fix Committed
Revision history for this message
Sebastien Bacher (seb128) wrote :

the original description of the bug still applies so better to let it open

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

As reporter, I will try the fix tonight and let you know.

Revision history for this message
Matt Zimmerman (mdz) wrote :

The original bug hasn't been fixed; its impact was expanded when we started using g-p-m for normal shutdown and reboot. Sebastien's change has reverted to the old behaviour, so this bug once again only affects shutdowns triggered by g-p-m.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

So finally, I can confirm that the original bug report is still valid. g-p-m doesn't use usplash when shutting down computer due to empty battery. Normal shutdown is using usplash though.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

Shouldn't this bug be changed to "open" again?

Revision history for this message
Paul Sladen (sladen) wrote :

Yes, re-open it if it's a bug and still present. It's fairly low priority though, because g-p-m will only shutdown the machine if nobody is around; and if nobody is around, nobody will see the lack of usplash :)

Changed in gnome-power-manager:
status: Fix Committed → Confirmed
Revision history for this message
Ricardo Pérez López (ricardo) wrote :

What is exactly the problem? The shutdown process works well for me (even the usplash down). Although I have a desktop computer, not a laptop...

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

Usplash is not used when gnome-power-manager shuts down the computer due to a critical battery level (0%).

Revision history for this message
Henrik Nilsen Omma (henrik) wrote :

Is this still happening on Gutsy? Removing dapper milestone.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

I will try to test it in Gutsy this week.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

I'm unable to test it as g-p-m doesn't currently do anything on low battery. And I've got it configured correctly in Power Management. Will look if there is a bug for this.

I will test it once g-p-m works for me on low battery.

Revision history for this message
Jan Mynarik (jan-mynarik) wrote :

Finally got to test it in gutsy (after problem with usplash not working at all). For me it's still not working (usplash during shutdown due to critical batter level).

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.