Bug 270228

Summary: kdmrc has as default "/sbin/shutdown -p now" which sysvinit 2.88 don't know
Product: [Unmaintained] kdm Reporter: Phil Miller <philm>
Component: generalAssignee: kdm bugs tracker <kdm-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: antkoul, daniele.cocca, edgue, m.debruijne, pawlerson, woebbeking
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Chakra   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.3
Sentry Crash Report:
Attachments: Fix shutdown issue in Linux

Description Phil Miller 2011-04-06 17:18:34 UTC
Version:           unspecified (using KDE 4.6.2) 
OS:                Linux

sysvinit 2.88 don't recongize "/sbin/shutdown -p now" which is the default now with 4.6.2. Proper settings would be:

[Shutdown]
# The command (subject to word splitting) to run to halt the system.
# Default is "/sbin/halt"
#HaltCmd=

Or:

[Shutdown]
# The command (subject to word splitting) to run to halt the system.
# Default is "/sbin/shutdown -h now"
#HaltCmd=

Here the list of all the switches shutdown has atm:[phil@chakra-desktop buildroot]$ shutdown --help
shutdown: you must be root to do that!
Usage:    shutdown [-akrhPHfFnc] [-t sec] time [warning message]
                  -a:      use /etc/shutdown.allow
                  -k:      don't really shutdown, only warn.
                  -r:      reboot after shutdown.
                  -h:      halt after shutdown.
                  -P:      halt action is to turn off power.
                  -H:      halt action is to just halt.
                  -f:      do a 'fast' reboot (skip fsck).
                  -F:      Force fsck on reboot.
                  -n:      do not go through "init" but go down real fast.
                  -c:      cancel a running shutdown.
                  -t secs: delay between warning and kill signal.
                  ** the "time" argument is mandatory! (try "now") **


Reproducible: Always

Steps to Reproduce:
try to call "/sbin/shutdown -p now" 

Actual Results:  
you will get: shutdown: invalid option -- 'p'

Expected Results:  
Computer should shutdown
Comment 1 Phil Miller 2011-04-06 17:35:44 UTC
I forgot to add that you will land in tty1 with /sbin/shutdown -p now
Comment 2 Christoph Feck 2011-04-06 18:19:44 UTC
Is there a command that works both on Linux as well as FreeBSD (see bug 250989)?
Comment 3 Antonis K 2011-04-06 21:34:24 UTC
'shutdown -h now' should work on both linux and freebsd
Comment 4 Daniele Cocca 2011-04-07 00:56:31 UTC
IIRC, "shutdown -P -h now" should work on BSD too.
Comment 5 Phil Miller 2011-04-07 02:52:29 UTC
Well it is a little trickier than that. Here the manual of shutdown on freebsd:

http://www.freebsd.org/cgi/man.cgi?query=shutdown&sektion=8

They have no capital P and it seems they need -p to power it down. Only -h won't do it ... or am I wrong?
Comment 6 Andre Woebbeking 2011-04-07 18:43:29 UTC
What about "halt -p"? That seems to exist on both platforms. On my Debian Sid it's in /sbin. Is it the same location on freebsd?
Comment 7 Paweł 2011-04-07 23:19:47 UTC
The same problem here. Solved by "shutdown -P -h now". Btw. you have much bigger user base on Linux than on freebsd, so why Linux users have to suffer from this?
Comment 8 Michiel de Bruijne 2011-04-08 03:11:09 UTC
*** This bug has been confirmed by popular vote. ***
Comment 9 Phil Miller 2011-04-08 15:20:42 UTC
Can somebody point me to the setting where this gets defined:

kdebase/workspace/kdm/kcm/kdm-shut.cpp:
shutdown_lined->setUrl(KUrl(HALT_CMD));
Comment 10 Phil Miller 2011-04-08 15:40:50 UTC
Created attachment 58711 [details]
Fix shutdown issue in Linux
Comment 11 Oswald Buddenhagen 2011-04-08 19:00:52 UTC
Git commit 4b7ec7c9966df0c705bc0c9b9bff1010475347b6 by Oswald Buddenhagen.
Committed on 08/04/2011 at 19:02.
Pushed by ossi into branch 'KDE/4.6'.

linux shutdown wants -P instead of -p

BUG: 270228
FIXED-IN: 4.6.3

M  +4    -1    kdm/config.def     

http://commits.kde.org/kde-workspace/4b7ec7c9966df0c705bc0c9b9bff1010475347b6
Comment 12 Phil Miller 2011-04-08 20:24:54 UTC
I have to re-open this. shutdown -P now does nothing:


[phil@chakra-desktop buildroot]$ sudo shutdown -P now
shutdown: -H and -P flags can only be used along with -h flag.
Usage:    shutdown [-akrhPHfFnc] [-t sec] time [warning message]
                  -a:      use /etc/shutdown.allow
                  -k:      don't really shutdown, only warn.
                  -r:      reboot after shutdown.
                  -h:      halt after shutdown.
                  -P:      halt action is to turn off power.
                  -H:      halt action is to just halt.
                  -f:      do a 'fast' reboot (skip fsck).
                  -F:      Force fsck on reboot.
                  -n:      do not go through "init" but go down real fast.
                  -c:      cancel a running shutdown.
                  -t secs: delay between warning and kill signal.
                  ** the "time" argument is mandatory! (try "now") **

Either you change it to /sbin/shutdown -P -h now or as it was to /sbin/halt or /sbin/shutdown -h now.
Comment 13 Oswald Buddenhagen 2011-04-08 20:48:42 UTC
oh, so this is just a modifier and not an actual command. that explains the difference to the BSD syntax.
Comment 14 Oswald Buddenhagen 2011-04-08 20:54:44 UTC
Git commit 28b79d8d04cce4d0a0899cadcc8fe6fd69d38e01 by Oswald Buddenhagen.
Committed on 08/04/2011 at 20:58.
Pushed by ossi into branch 'KDE/4.6'.

actually, it wants -h -P, because -P is just a modifier

FAIL ...

BUG: 270228 (take 2)

M  +1    -1    kdm/config.def     

http://commits.kde.org/kde-workspace/28b79d8d04cce4d0a0899cadcc8fe6fd69d38e01
Comment 15 Lamarque V. Souza 2011-04-09 20:26:39 UTC
*** Bug 270432 has been marked as a duplicate of this bug. ***