logout box + no way to kill computer = data corruption

Bug #285141 reported by LimCore
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu
Fix Released
Wishlist
Unassigned

Bug Description

Bad design of logout in Ubuntu (gnome, kde, etc) leads to at least DOZEN use cases with possible data corruption from having to hardly shutdown the computer (i.e. power off).

Summary:
person with access to power-off hardware button should be allowed to use it to tell computer to shut down gracefully;
Because:
- perhaps he can not use GUI (keyboard driver bug, UPS power lost and not LCD, etc etc) so presenting him with a gui box with confirmation etc is BAD if pressing power button again doesnt work as "Ok, proceed!"
- he can anyway press and hold the button to hard-turn-off the box. But this is bad for filesystems.

Use case 1)
Power goes out, PC is on UPS, monitor is not (common), lights go out.
***UPS deamon*** was NOT configured (common for home users).
You press the power key to turn it off.
It does NOT turn off. It displays a nice logout confirmation box, especially if you had another session opened (VT1, or say VT8 another X session etc).
You can either hope to login as root, go to console, and type shutdown -h now in darkness, or data corruption in 3 minutes when UPS dies.

Or - gfx card died (happened to me due to reported nvidia/xorg bugs), so you can not use GUI and UPS deamon
doesn't know there is a problem.

Use case 2:
Thunderstorm closes in but you left PC running.
Family member / coworker / etc wants to turn it off, but ooops - need a password to unlock X...
you wait for thunderstorm or hard-power-off again.
Here, also adding a Power Off button to the password query would be nice.

Use case 3:
GFX and/or keyboard/mouse locked out / do not work (this happens).

Common solutions:
In KDE / Gnome
- when user presses power button 2nd time in 30 seconds (or, when confirmation box is already visible) then just force logout
- when logout (closing all applications etc) takes more then 10 seconds (i.e. some applications showed a box to confirm closing it etc), or when button is pressed again, just kill it

In Ubuntu (scripts?)
- when power button is pressed 4 times in 30 seconds then shutdown -h now -t 10
- when power button is pressed 5 times in 30 seconds then just kill -9 most applications, and sync

LimCore (limcore)
description: updated
LimCore (limcore)
description: updated
Revision history for this message
Sarah Kowalik (hobbsee-deactivatedaccount) wrote :

Use case 2:
Thunderstorm closes in but you left PC running.
Family member / coworker / etc wants to turn it off, but ooops - need a password to unlock X...
you wait for thunderstorm or hard-power-off again.
Here, also adding a Power Off button to the password query would be nice.

Please don't do this. At the very least, if you have to, hide it in gdm, so you only get to it after switching user.

If you have a kid (or whoever) coming along and pressing buttons, on a locked screen, it really shouldn't cause permanent session damage to the computer. A locked screen is designed so that the user's session can't be changed, until it gets unlocked again.

As for the rest, it already shuts down after 60 seconds anyway.

Revision history for this message
LimCore (limcore) wrote :

Oh my god I *again* lost load of files due to power outage + now way to quickly (~30 seconds UPS) shut down the damn box when screen is not working.

Also, lots of programs are really unresistant to data file corruptions - not even a warning message "oh pony I lost my files. Please restore file XYZ from backup." just the worst possible thing: *silent* corruption.
This goes to kmail and kde configuration (but probably to lots of other applications as well).

But we can fix at least that quickly:

This attached patch (against up to date ubuntu 8.04 acpid) will just execute shutdown -h if you press power button x2 (in 10 seconds)

I'm not good at bash/sh scripts, but it at least works. Can we apply this quickly, and then it can be upgraded to do other actions (like, kill application hogging all CPU etc).

Revision history for this message
LimCore (limcore) wrote :

Ok this version works actually.
There are 3 files - main event handler, that in parallel ( & ) executes the -nice version (for GUI)
and the -raw version (for hard shutdown).

This is because (at least on my box) then nice version that tries to run DCOP does not work but it hangs for around 30 seounds, blocking that event script to be triggered again at all.

Revision history for this message
LimCore (limcore) wrote :
Revision history for this message
Phillip Susi (psusi) wrote :

These days you get a dialog with a 60 second countdown to auto shutdown.

Also data is not allowed to sit in the cache for more than a few seconds before being flushed normally, so an idle locked computer won't lose anything if it loses power. If you must shutdown blind, alt-sysrq-s will force a sync.

Changed in ubuntu:
status: Confirmed → 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.