Bug 270022 - "Shutdown" should shutdown the computer
Summary: "Shutdown" should shutdown the computer
Status: RESOLVED DUPLICATE of bug 183274
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: 4.6
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-03 18:57 UTC by Mickaël Leduque
Modified: 2011-04-05 19:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickaël Leduque 2011-04-03 18:57:44 UTC
Version:           4.6 (using KDE 4.6.1) 
OS:                Linux

It is expected that when you engage the shutdown procedure (for example, by pressing shutdown in the menu), the computer will shutdown, and that the user doesn't have to keep looking at the computer to make sure it will.

I have two example of cases when that will not happen :
- when you're logged in on a VT (KDE will put a dialog box to show you the VT then wait until the next morning for you to notice).
- when you had VLC opened, even doing nothing ; in that case, there will be a notification saying that VLC had cancelled the shutdown ; then VLC is closed and the computer patiently awaits until the next morning.

In those cases, shutdown is a conscious operation from the user, he knew what he did, there is no reason not to shutdown.

Reproducible: Didn't try

Steps to Reproduce:
-switch to VT1 (Ctrl+Alt+F1)
-login
-switch to KDE (often, Ctrl+Alt+F7)
-shutdown in the menu

Actual Results:  
There is a dialog box that says you are logged in on VT1 and ask you if it should close it and shutdown or cancel shutdown.

Expected Results:  
The computer shuts down.
Comment 1 Lamarque V. Souza 2011-04-04 00:59:30 UTC
I do not agree. If the user forgets an important program running the computer should warns him/her of that when shutting down or we risk losing user data.
Comment 2 Christoph Feck 2011-04-04 01:21:19 UTC

*** This bug has been marked as a duplicate of bug 183274 ***
Comment 3 Mickaël Leduque 2011-04-04 10:04:49 UTC
Sorry,
1. this is not a duplicate of 183274 ; solving it will not solve this one
2. 183274 is only about one part of this bug, the tty part, and doesn't talk at all about (for example) VLC.

If you fix 183274, you *mitigate*, but you don't fix, this bug, *for the tty example*.
It does nothing about the random app (for example VLC) deciding that the system should not shutdown when I'm already in my car going to some other part of the city.
And that can't be considered a bug in that random app (say VLC), because if I report it and get it fixed, then it'll maybe just be replaced by one (ou three ? ten ?) other random app doing the same stupid thing.

>If the user forgets an important program running the computer...
There is none. If I decide to launch "shutdown", there is no important program left. Only program in a generic state that will be launched in a generic state when the session is started again.

Sure, if you don't want to make that the default, that's maybe sensible. But just tell me where the option is, I'll go tick it myself.
Comment 4 Lamarque V. Souza 2011-04-04 19:03:33 UTC
If you read the comments in 183274 they talk about your scenario and reached the some conclusion as I did: it is too risky so ask the user if he/she really wants to do that. Kdm cannot know which program is important or not, so asking the user is the right choice.

If you do not want a duplicate we will close this bug as WONTFIX.

*** This bug has been marked as a duplicate of bug 183274 ***
Comment 5 Mickaël Leduque 2011-04-04 22:29:42 UTC
Actually, I think it's possible to know.
I can only see one case when forcefully closing the session could have serious consequence. The case that were mentioned is when someone is doing a system upgrade or other administrative task. Those are the only case when shutting down could really break anything.

And that can only happen when doing those actions as root. If you're not root, you can't do anything unrecoverable.

By the way, I really think this should have some other opinion than yours. You(re the only one so far to have commented here.
Comment 6 Lamarque V. Souza 2011-04-04 23:31:25 UTC
If you are editing a file in LibreOffice for instance you will lose your unsaved changes if system shuts down. You can recover the file later but the recover will not contain your unsaved changes. The same can happen with several other editing programs that do not necessary run as root.

Anyway, there are several upgrade software out there, it is kind of hacky having support to all of them to detect if they are running or not.

Actually there are two people that thinks this is a duplicate and some more in 183274 who are against forcing shutdown without asking as you want it.
Comment 7 Mickaël Leduque 2011-04-05 00:13:21 UTC
OK, right, I see.
Is there any way to have it done *just for me*, as hackish as it could be (but does not imply recompiling) ?
Comment 8 Lamarque V. Souza 2011-04-05 02:23:46 UTC
You can execute "shutdown -h now" as root in konsole. You can configure /etc/sudoers so that you do not need to log as root to execute it, something like:

%wheel LOCALHOST=NOPASSWD: /usr/shutdown -h now

Anybody in the group wheel is able to execute that command without using password, just do:

sudo shutdown -h now

You can create a shortcut for it using systemsettings too.
Comment 9 Mickaël Leduque 2011-04-05 09:25:15 UTC
2011/4/5 Lamarque V. Souza <lamarque@gmail.com>:
> https://bugs.kde.org/show_bug.cgi?id=270022
>
>
>
>
>
> --- Comment #8 from Lamarque V. Souza <lamarque gmail com>  2011-04-05 02:23:46 ---
> You can execute "shutdown -h now" as root in konsole. You can configure
> /etc/sudoers so that you do not need to log as root to execute it, something
> like:
>
> %wheel LOCALHOST=NOPASSWD: /usr/shutdown -h now
>
> Anybody in the group wheel is able to execute that command without using
> password, just do:
>
> sudo shutdown -h now
>
> You can create a shortcut for it using systemsettings too.
>
> --

Well, it's not that I didn't know shutdown, it's just that I have
refrained to used it for... what ? many years ? There must be
something better...
Comment 10 Lamarque V. Souza 2011-04-05 18:32:09 UTC
Well, ultimately kdm uses halt, which uses shutdown, to... shut down the computer. You would be just by passing kdm, which is what you want, right?
Comment 11 Mickaël Leduque 2011-04-05 18:38:53 UTC
Will the session be saved correctly ? Last time I did, it wasn't, but I admit that's a very long time...
Comment 12 Lamarque V. Souza 2011-04-05 19:06:40 UTC
Probably not. You can close the current session running this as user before running the shutdown command with sudo:

qdbus org.kde.ksmserver /KSMServer logout 0 2 0 

You can change the last 0 to 2 to really force killing all opened sessions. The explanation for those three numbers are here:

$KDEDIR/include/kworkspace/kworkspace.h

They are the enums ShutdownConfirm, ShutdownType and ShutdownMode.